Skip to content

Commit

Permalink
RBRTM Shakedown and OnlineTournament "car selection" menu integration…
Browse files Browse the repository at this point in the history
… to show the preview image and car spec details.
  • Loading branch information
mika-n committed Jun 5, 2020
1 parent f5a509e commit fc195ba
Show file tree
Hide file tree
Showing 10 changed files with 526 additions and 168 deletions.
18 changes: 14 additions & 4 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ This **NGPCarMenu RBR plugin solves these problems** by doing following enhancem
- Longer car model names in car specs window (as much there is room on the screen).
- Longer car menu names (up to 30 chars).

Note! This plugin supports only the latest RichardBurnsRally_SSE.exe v1.02 version for Windows OS (haven't tested this under Wine/Linux, but the plugin probably works there also).
The plugin supports also **RBRTM Czech Tournament** plugin (V0.88). NGPCarMenu plugin shows the car preview image and car details in Shakedown and OnlineTournament "car selection" menus within RBRTM.

Note! NGPCarMenu supports only the latest RichardBurnsRally_SSE.exe v1.02 version for Windows OS (haven't tested this under Wine/Linux, but the plugin probably works there also).

![](misc/NGPCarMenu_SelectCarMenu.png)
![](misc/NGPCarMenu_RBRTMMenu.png)
![](misc/NGPCarMenu_PluginMenu.png)

## Download
Expand All @@ -30,12 +33,13 @@ Note! This plugin supports only the latest RichardBurnsRally_SSE.exe v1.02 versi
- Download the latest version from the link shown above (ZIP file).
- Unzip the NGPCarMenu-versionTag.zip file to the root folder of existing installation of RBR game (for example *c:\games\richardBurnsRally* ).
- Check *plugins\NGPCarMenu.ini.sample* file settings, especially the *RBRCITCarListPath* option. This option should point to the carList.ini file from NGP physics plugin (by default *RBRCIT\carlist\carList.ini* which is a relative path under the RBR installation folder).
- Alternatively you can use EasyRBR tool to setup cars. In that case uncomment the EasyRBRPath NGPCarMenu.ini entry and set path to EasyRBR\easyrbr.ini file.
- When RBR game with this plugin is started for the first time then the plugin will automatically copy the NGPCarMenu.ini.sample file as NGPCarMenu.ini file if it doesn't exist yet. If the NGPCarMenu.ini already exists then the plugin continues to use it and uses default value in all new options. Check the sample file for tips about those new options. This way you can simply unzip a new version on top of the existing NGPCarMenu plugin because you won't loose your existing customized NGPCarMenu.ini values.
- Alternatively you can use EasyRBR tool to setup cars. In that case uncomment the EasyRBRPath option in NGPCarMenu.ini and set path to EasyRBR\easyrbr.ini file.
- When RBR game is started for the first time then the plugin will automatically copy the NGPCarMenu.ini.sample file as NGPCarMenu.ini file if it doesn't exist yet. If the NGPCarMenu.ini already exists then the plugin continues to use it and uses default value in all new options. Check the sample file for tips about those new options. This way you can simply unzip a new version on top of the existing NGPCarMenu plugin because you won't loose your existing customized NGPCarMenu.ini values.
- Start *RichardBurnsRally_SSE.exe* game as usual and go to *"Options/Plugins/NGPCarMenu"* in-game menu.
- At first you probably don't have any car preview images under *Plugins\NGPCarMenu\preview* folder. Select *"Create car images"* menu command to generate new preview images. Sit down and wait while the plugin creates new preview images from all installed car models.
- Use the "Create car images" command when you have installed new custom cars for RBR via RBRCIT or EasyRBR tool.
- Now you are ready to race! Go to *"Quick Rally/Multiplayer/Season"* in-game menu and verify that you can see the new information and car preview images in *"Select Car"* menu.
- If you use RBRTM online tournament plugin then enable RBRTM_Integration option. If the car preview image is drawn at wrong location in RBRTM menus then check resolution specific RBRTM_CarPictureRect option in NGPCarMenu.ini file. Set correct rectangle coordinates where the car preview image should be dran (pro tip. Take fullscreen screenshot and use Paint app to see the correct coordinates of the bottom left "empty rectangle area" in Shakedown menu).

The NGPCarMenu.ini file has various screen resolution specific options. There are default values for the most common resolutions, but if the resolution you use is not there then you should add new resolution entry and set a value to at least ScreenshotCropping option. This option defines the rectangle area used in a car preview image screenshot. If you are upgrading from an old version then your existing NGPCarMenu.ini file remains as it is and all new INI options use a default value. Refer to NGPCarMenu.ini.sample for more information about new options.

Expand All @@ -55,14 +59,17 @@ rbr\Plugins\NGPCarMenu.ini options (see the INI file for more details):
| ScreenshotReplay | Replay filename the plugin uses to generate preview images. |
| ScreenshotFileType | PNG or BMP file format in car preview image files. There is also in-game plugin option to set this value. |
| ScreenshotAPIType | 0 or 1. 0=DirectX framebuffer capture while creating preview images. 1=GDI capture. Some Win7 PCs seemed to have issues with DX9 framebuffer captures (wrong colors), so this option 1 (GDI) may help in those scenarios. |
| RBRCITCarListPath | Path to NGP carList.ini configuration file (NGP car specs). If you use RBRCIT tool then the tool has downloaded the file in RBRCIT folder |
| RBRCITCarListPath | Path to NGP carList.ini configuration file (NGP car specs). If you use RBRCIT tool then the tool has downloaded the file in RBRCIT folder. |
| EasyRBRPath | Path to EasyRBR.ini configuration file (EasyRBR car manager tool configurations). By default this is commented out, so NGPCarMenu assumes RBRCIT tool is used. By uncommenting this line NGPCarMenu uses custom car information from EasyRBR car manager tool. |
| ScreenshotCropping | Cropping rectangle for the screenshot. Make it "big enough but not too big" to fill the bottom part of "Select Car" RBR menu screen (empty string or 0 0 0 0 uses full screen in a car preview images). |
| CarSelectLeftBlackBar | Optional rectangle black bar to hide the stock RBR "left frame" image in "Select Car" menu (empty string or 0 0 0 0 disables the black side bar). The first value (left pos) also defines the X-pos where the car preview image is drawn. |
| CarSelectRightBlackBar | (the same as above) |
| Car3DModelInfoPosition | 3D model into textbox X Y position. Empty or missing uses the default position. 320 200 would set both X and Y positions, but having just 320 value would set X position only and Y would be at default position. |
| ScreenshotCarPosition | Car position within the replay video while taking the car preview screenshot. *(not yet implemented)* |
| ScreenshotCamPosition | Camera position while taking the screenshot. *(not yet implemented)* |
| RBRTM_Integration | 0 or 1. 0=RBRTM integration disabled. 1=RBRTM integration enabled (if the RBRTM plugin is installed and it is V0.88 version) |
| RBRTM_CarPictureRect | Rectangle coordinates where the car preview image is drawn in RBRTM Shakedown and OnlineTournament menus (left top right bottom) |
| RBRTM_CarPictureCropping | Rectangle coordinates of cropping area of the preview image shown in RBRTM menus *(not yet implemented)* |

## Questions and Answers
- **Does "Create car image" command overwrite existing car preview images?** No, the plugin uses *"Create only missing images"* option by default. However, you can change this option in the plugin's in-game menu to *"All car images"* option. This option re-creates all car images.
Expand All @@ -77,6 +84,8 @@ rbr\Plugins\NGPCarMenu.ini options (see the INI file for more details):
- **Can I use this plugin with the original RBR car models without NGP plugin?** Hmmm... Can't see a single reason why NGP car models are not used in RBR. Anyway, in that case you don't need this plugin because the original game has all the information needed for original car models.
- **What are rbr\plugins\NGPCarMenu\preview\1920x1080 and 1366x768 folders?** This plugin saves new car preview images per resolution (the same preview image may not be the best one for all native resolutions). The *preview* folder has a subfolder which matches the resolution you use (the plugin creates the folder if it is missing). Also, NGPCarMenu.ini file should have a configuration entry block per resolution.
- **Why the "Create car image" replay sometimes continues to run as a normal replay video after the last car?** It could happen if the last generated car is actually the same carID used while recording the replay video. In this case you can quit the replay by pressing ESC key.
- **Why the car preview image is in wrong location in RBRTM menus?** The current version of NGPCarMenu has a crappy routine to map RBR in-game coordinates to native screen resolution coordinates. Some resolutions are not handled correctly. To fix the issue tweak RBRTM_CarPictureRect option in NGPCarMenu.ini file and set better coordinates (left top right bottom).
- **Why the car preview image in RBRTM menu has wrong aspect ratio in some resolutions?** The current version of NGPCarMenu has a crappy routine to map RBR in-game coordinates to native screen resolution coordinates. Also, the RBRTM_CarPictureCropping option is not yet implemented which would help to scale portion of the original preview image in correct aspect ratio.

- **What is the folder structure used by this plugin?** The DLL and INI plugin files must be in the Plugins directory under the RBR game root folder. Replays RBR folder should have a replay file set in *ScreenshotReplay* option. The file hierarchy is something like this:
c:\apps\richardBurnsRally\plugins\NGPCarMenu.dll
Expand All @@ -93,6 +102,7 @@ Also, some Windows OS setups limit writing new files under c:\program files\ or
- Next Generation Physics RBR plugin, NGP. (author: WorkerBee). [NGP Home page](http://www.ly-racing.de/viewtopic.php?t=7878)
- FixUp RBR plugin. (author: WorkerBee). [FixUp Home page](http://www.ly-racing.de/viewtopic.php?t=7878)
- Pacenote RBR plugin. (author: WorkerBee). [Pacenote Home page](http://www.ly-racing.de/viewtopic.php?t=6848)
- RBRTM Czech Tournament plugin. (author: Wally). [RBRTM Home page](https://rbr.onlineracing.cz/?setlng=eng)
- RBR Car Installation Tool, RBRCIT. (author: Zissakos). [RBRCIT Home page](https://github.com/zissakos/RBRCIT)
- EasyRBR car and track manager tool. (author: Plankgas/PTD). [EasyRBR Home page](https://www.ptd-3d.com/easyrbr/)

Expand Down
Binary file modified misc/NGPCarMenu_PluginMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added misc/NGPCarMenu_RBRTMMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions src/D3D9Font/D3DFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ HRESULT CD3DFont::DrawText(int _sx, int _sy, DWORD dwColor, const WCHAR* strText
// Adjust for character spacing
auto spaceSize = m_font->GetCharacterSize(m_pd3dDevice, L' ');
float startX = sx;
float endX = sx;

// Fill vertex buffer
FONT2DVERTEX* vertices = NULL;
Expand Down Expand Up @@ -497,12 +498,23 @@ HRESULT CD3DFont::DrawText(int _sx, int _sy, DWORD dwColor, const WCHAR* strText
}

sx += w;

// If this is multiline output then endX will be the width of the longest line
if (sx > endX)
endX = sx;
}

// Unlock and render the vertex buffer
m_pVB->Unlock();
if (trianglesCount > 0)
{
// Optionally clear background under the text
if (dwFlags & D3DFONT_CLEARTARGET)
{
D3DRECT rec = { _sx, _sy, static_cast<long>(endX), static_cast<long>(sy) + spaceSize.cy };
m_pd3dDevice->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 0, 0, 0), 0, 0);
}

for (size_t i = 0; i < textures.size(); i++)
{
m_pd3dDevice->SetTexture(0, textures[i]);
Expand All @@ -516,3 +528,9 @@ HRESULT CD3DFont::DrawText(int _sx, int _sy, DWORD dwColor, const WCHAR* strText

return S_OK;
}

HRESULT CD3DFont::DrawText(int _sx, int _sy, DWORD dwColor, const CHAR* strText, DWORD dwFlags)
{
std::wstring wszText = _ToWString(std::string(strText));
return DrawText(_sx, _sy, dwColor, wszText.c_str(), dwFlags);
}
2 changes: 2 additions & 0 deletions src/D3D9Font/D3DFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define D3DFONT_BORDER 0x0010
#define D3DFONT_COLORTABLE 0x0020

#define D3DFONT_CLEARTARGET 0x0080

// Defined deprecated D3Dx9.h struct because the old DX9 derived code uses these structs
typedef struct D3DXVECTOR4 {
Expand Down Expand Up @@ -269,6 +270,7 @@ class CD3DFont
public:
// 2D and 3D text drawing functions
//HRESULT DrawText(FLOAT x, FLOAT y, DWORD dwColor, const WCHAR* strText, DWORD dwFlags = 0L);
HRESULT DrawText(int x, int y, DWORD dwColor, const CHAR* strText, DWORD dwFlags = 0L);
HRESULT DrawText(int x, int y, DWORD dwColor, const WCHAR* strText, DWORD dwFlags = 0L);

// Function to get extent of text
Expand Down
Loading

0 comments on commit fc195ba

Please sign in to comment.