|
coastline 0.0.4
|
The application of the PC port: its main window and the messages of the window, the states of the game it runs each frame, and its start and shutdown. More...
#include <cstddef>#include <windows.h>#include "common/fatalerror.h"#include "common/screen.h"#include "common/session.h"
Go to the source code of this file.
Enumerations | |
| enum | { GAME_STATE_INIT_RESOURCES , GAME_STATE_ENTER_GAME_MODE , GAME_STATE_RUN_GAME_MODE , GAME_STATE_LOAD_GAME , GAME_STATE_RUN_FRONT_END } |
| The states of the game, in the order of g_apfnGameStateHandlers. More... | |
Functions | |
| int | GameState_InitResources (void) |
| Open the pod of the game files, load the first sound set and the names of the controls of the game controller, and go on to the front end. | |
| int | GameState_EnterGameMode (void) |
| Go on to run the mode of the game. | |
| int | GameState_RunGameMode (void) |
| Run a frame of the mode of the game. | |
| int | GameState_ShowLoadingScreenAndInitGame (void) |
| Set the display mode of the configuration, show the loading screen, set up the game, and go on to enter the mode of the game. | |
| int | GameState_RunFrontEnd (void) |
| Run a frame of the front end. | |
| void | SetGameStateFrontEnd (void) |
| Go back to the front end after a game, setting it up again. | |
| bool | OpenBossRallyPodAndInit (void) |
| Open BossRally.pod, and set up the renderer, the damage bitmaps of the paint, DirectInput, the keyboard, the music when it plays, and DirectSound when sound is on. | |
| void | ShowGlideSplashImage (const char *pszPath, int nChecksum) |
| Show an image of the Glide library over the whole screen. | |
| LRESULT CALLBACK | MainWindowProc (HWND hWnd, UINT nMessage, WPARAM wParam, LPARAM lParam) |
| Handle the messages of the main window. | |
| void | UpdateAppActiveStateFromActivate (WPARAM wParam) |
| Set whether the application is active from the state of WM_ACTIVATE. | |
| LRESULT | HandleWindowActivate (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_ACTIVATE. | |
| LRESULT | HandleWindowActivateApp (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_ACTIVATEAPP. | |
| LRESULT | HandleWindowClose (HWND hWnd) |
| Handle WM_CLOSE. | |
| LRESULT | HandleWindowCommand (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_COMMAND. | |
| LRESULT | HandleWindowDestroy (HWND hWnd) |
| Handle WM_DESTROY. | |
| LRESULT | HandleDisplayChange (HWND hWnd) |
| Handle WM_DISPLAYCHANGE. | |
| LRESULT | HandleWindowEraseBackground (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_ERASEBKGND. | |
| LRESULT | HandleWindowEnterMenuLoop (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_ENTERMENULOOP. | |
| LRESULT | HandleWindowExitMenuLoop (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_EXITMENULOOP. | |
| LRESULT | HandleWindowGetMinMaxInfo (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_GETMINMAXINFO. | |
| LRESULT | HandleWindowMove (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_MOVE. | |
| LRESULT | HandleWindowNcPaint (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_NCPAINT. | |
| LRESULT | HandleWindowSetCursor (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_SETCURSOR. | |
| LRESULT | HandleWindowSize (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_SIZE. | |
| LRESULT | HandleWindowSysCommand (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_SYSCOMMAND. | |
| LRESULT | HandleWindowPosChanging (HWND hWnd, WPARAM wParam, LPARAM lParam) |
| Handle WM_WINDOWPOSCHANGING. | |
| LRESULT | AttachRenderDeviceToWindow (HWND hWnd, LPARAM lParam) |
| Store the renderer that has created its objects in the user data of its window. | |
| LRESULT | DetachRenderDeviceFromWindow (HWND hWnd, LPARAM lParam) |
| Clear the renderer that is releasing its objects from the user data of its window. | |
| HRESULT | CreateRenderWindow (DWORD dwExStyle, LPCSTR pszClassName, LPCSTR pszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hParent, HMENU hMenu, HINSTANCE hInstance, LPVOID pParam, GUID *pDriverGuid, int nUnused, HWND *phWnd, DirectDrawRenderer **ppRenderer) |
| Create a window and the renderer that draws into it, and show the window. | |
| int | DestroyMainWindow (void) |
| Destroy the main window and its renderer. | |
| int | DispatchGameStateFrame (void) |
| Run a frame of the current state of the game. | |
| void | GetDXVersion (unsigned *pdwVersion, unsigned *pdwPlatform) |
| Query the installed DirectX version by creating its objects in turn. | |
| bool | FocusExistingBossRallyInstance (void) |
| Bring an instance of the game that is already running to the front. | |
| void | RefreshTotalPhysicalMemory (void) |
| Read the amount of physical memory the machine has. | |
| void | ReadInstallDirectoryFromRegistry (void) |
| Read the install directory from the registry into g_szInstallDirectory. | |
| bool | InitializeApplication (void) |
| Start the application: refuse DirectX before version 6 and a second instance, then create the main window. | |
| bool | CreateMainWindow (void) |
| Create the main window. | |
| void | RunMessageLoop (void) |
| Run the message loop until the game quits. | |
| void | ShutdownMainWindow (void) |
| Destroy the main window. | |
Variables | |
| int | g_dwAppExitCode |
| Exit code RallyMain() returns to the launcher. | |
| char | g_szInstallDirectory [] |
| Directory the game is installed in, read from the registry, with a trailing separator. | |
| HINSTANCE | g_hRallyMainInstance |
| Arguments of WinMain() as the launcher passed them to RallyMain(). | |
| HINSTANCE | g_hRallyMainPrevInstance |
| The previous application instance passed to RallyMain(). | |
| LPSTR | g_pszRallyMainCmdLine |
| The command line passed to RallyMain(). | |
| int | g_nRallyMainCmdShow |
| The initial window display mode passed to RallyMain(). | |
| size_t | g_dwTotalPhysicalMemory |
| The amount of physical memory of the machine, in bytes. | |
| HINSTANCE | g_hAppInstance |
| The module of the game, set by InitializeApplication(). | |
| HWND | g_hMainWindow |
| The main window. | |
| HACCEL | g_hAccelTable |
| The keyboard accelerators of the main window. | |
| WPARAM | g_dwAppActive |
| The first parameter of the last WM_ACTIVATE. | |
| int | g_dwActivateState |
| How the main window is activated, WA_INACTIVE, WA_ACTIVE, or WA_CLICKACTIVE. | |
| int | g_dwActivateMinimized |
| Whether the main window is minimised. | |
| int | g_dwGameState |
| The state of the game, an index into g_apfnGameStateHandlers. | |
| int(* | g_apfnGameStateHandlers [])(void) |
| The routine that runs a frame of each state of the game. | |
| int | g_dwGameModeFrameCounter |
| The frames the mode of the game has run. | |
| int | g_dwGameModeContinue |
| What GameState_RunGameMode() returns, 1 at the start. | |
| HCURSOR | g_hArrowCursor |
| The arrow cursor of the main window. | |
| DirectDrawRenderer * | g_pMainRenderWindow |
| The renderer of the main window. | |
The application of the PC port: its main window and the messages of the window, the states of the game it runs each frame, and its start and shutdown.
| anonymous enum |
The states of the game, in the order of g_apfnGameStateHandlers.
| int GameState_InitResources | ( | void | ) |
Open the pod of the game files, load the first sound set and the names of the controls of the game controller, and go on to the front end.
| int GameState_EnterGameMode | ( | void | ) |
Go on to run the mode of the game.
| int GameState_RunGameMode | ( | void | ) |
Run a frame of the mode of the game.
| int GameState_ShowLoadingScreenAndInitGame | ( | void | ) |
Set the display mode of the configuration, show the loading screen, set up the game, and go on to enter the mode of the game.
Direct3D sets the display mode once more after the loading screen.
| int GameState_RunFrontEnd | ( | void | ) |
Run a frame of the front end.
| void SetGameStateFrontEnd | ( | void | ) |
Go back to the front end after a game, setting it up again.
| bool OpenBossRallyPodAndInit | ( | void | ) |
Open BossRally.pod, and set up the renderer, the damage bitmaps of the paint, DirectInput, the keyboard, the music when it plays, and DirectSound when sound is on.
The Glide library shows its splash image once the renderer is set up.
| void ShowGlideSplashImage | ( | const char * | pszPath, |
| int | nChecksum ) |
Show an image of the Glide library over the whole screen.
| pszPath | The path of the image, ARGB1555 pixels after their width and height. |
| nChecksum | The Adler-32 the pixels must have, or 0 to skip the check. A mismatch exits. |
Handle the messages of the main window.
| hWnd | The main window. |
| nMessage | The message. |
| wParam | The first parameter of the message. |
| lParam | The second parameter of the message. |
| void UpdateAppActiveStateFromActivate | ( | WPARAM | wParam | ) |
Set whether the application is active from the state of WM_ACTIVATE.
| wParam | The first parameter of WM_ACTIVATE. |
Handle WM_ACTIVATE.
| hWnd | The main window. |
| wParam | The state of the activation. |
| lParam | The other window. |
Handle WM_ACTIVATEAPP.
| hWnd | The main window. |
| wParam | Whether the application is activated. |
| lParam | The thread of the other application. |
Handle WM_CLOSE.
| hWnd | The main window. |
Handle WM_COMMAND.
| hWnd | The main window. |
| wParam | The command. |
| lParam | The control of the command. |
Handle WM_DESTROY.
| hWnd | The main window. |
Handle WM_DISPLAYCHANGE.
| hWnd | The main window. |
Handle WM_ERASEBKGND.
| hWnd | The main window. |
| wParam | The device context. |
| lParam | Not used by the message. |
Handle WM_ENTERMENULOOP.
| hWnd | The main window. |
| wParam | Whether the menu is a popup. |
| lParam | Not used by the message. |
Handle WM_EXITMENULOOP.
| hWnd | The main window. |
| wParam | Whether the menu is a popup. |
| lParam | Not used by the message. |
Handle WM_GETMINMAXINFO.
| hWnd | The main window. |
| wParam | Not used by the message. |
| lParam | The MINMAXINFO of the window. |
Handle WM_MOVE.
| hWnd | The main window. |
| wParam | Not used by the message. |
| lParam | The position of the client area. |
Handle WM_NCPAINT.
| hWnd | The main window. |
| wParam | The region to paint. |
| lParam | Not used by the message. |
Handle WM_SETCURSOR.
| hWnd | The main window. |
| wParam | The window under the cursor. |
| lParam | The hit test and the message. |
Handle WM_SIZE.
| hWnd | The main window. |
| wParam | The kind of resize. |
| lParam | The size of the client area. |
Handle WM_SYSCOMMAND.
| hWnd | The main window. |
| wParam | The command. |
| lParam | The position of the cursor. |
Handle WM_WINDOWPOSCHANGING.
| hWnd | The main window. |
| wParam | Not used by the message. |
| lParam | The WINDOWPOS of the window. |
Store the renderer that has created its objects in the user data of its window.
| hWnd | The main window. |
| lParam | The renderer. |
Clear the renderer that is releasing its objects from the user data of its window.
| hWnd | The main window. |
| lParam | The renderer. |
| HRESULT CreateRenderWindow | ( | DWORD | dwExStyle, |
| LPCSTR | pszClassName, | ||
| LPCSTR | pszWindowName, | ||
| DWORD | dwStyle, | ||
| int | x, | ||
| int | y, | ||
| int | nWidth, | ||
| int | nHeight, | ||
| HWND | hParent, | ||
| HMENU | hMenu, | ||
| HINSTANCE | hInstance, | ||
| LPVOID | pParam, | ||
| GUID * | pDriverGuid, | ||
| int | nUnused, | ||
| HWND * | phWnd, | ||
| DirectDrawRenderer ** | ppRenderer ) |
Create a window and the renderer that draws into it, and show the window.
A renderer that does not start is reported in a message box and destroys the window.
| dwExStyle | The extended style of the window. |
| pszClassName | The class of the window. |
| pszWindowName | The title of the window. |
| dwStyle | The style of the window. |
| x | The left of the window. |
| y | The top of the window. |
| nWidth | The width of the window. |
| nHeight | The height of the window. |
| hParent | The parent, or nullptr for the desktop. |
| hMenu | The menu of the window. |
| hInstance | The module of the class, or nullptr for the game. |
| pParam | The parameter of the creation of the window. |
| pDriverGuid | The DirectDraw driver, or nullptr for the default. |
| nUnused | Not read. |
| phWnd | Receives the window, unless nullptr. |
| ppRenderer | Receives the renderer, unless nullptr. |
| int DestroyMainWindow | ( | void | ) |
Destroy the main window and its renderer.
| int DispatchGameStateFrame | ( | void | ) |
Run a frame of the current state of the game.
| void GetDXVersion | ( | unsigned * | pdwVersion, |
| unsigned * | pdwPlatform ) |
Query the installed DirectX version by creating its objects in turn.
| pdwVersion | Receives the version, 0x600 for DirectX 6, or 0 when DirectDraw is missing. |
| pdwPlatform | Receives the platform of Windows (VER_PLATFORM_WIN32_WINDOWS or VER_PLATFORM_WIN32_NT), or 0 when the version cannot be read. |
| bool FocusExistingBossRallyInstance | ( | void | ) |
Bring an instance of the game that is already running to the front.
| void RefreshTotalPhysicalMemory | ( | void | ) |
Read the amount of physical memory the machine has.
| void ReadInstallDirectoryFromRegistry | ( | void | ) |
Read the install directory from the registry into g_szInstallDirectory.
| bool InitializeApplication | ( | void | ) |
Start the application: refuse DirectX before version 6 and a second instance, then create the main window.
Only the Direct3D library has it.
| bool CreateMainWindow | ( | void | ) |
Create the main window.
| void RunMessageLoop | ( | void | ) |
Run the message loop until the game quits.
| void ShutdownMainWindow | ( | void | ) |
Destroy the main window.
Only the Direct3D library has it.
|
extern |
Exit code RallyMain() returns to the launcher.
|
extern |
Directory the game is installed in, read from the registry, with a trailing separator.
|
extern |
Arguments of WinMain() as the launcher passed them to RallyMain().
Only the Glide library stores them.
|
extern |
The previous application instance passed to RallyMain().
|
extern |
The command line passed to RallyMain().
|
extern |
The initial window display mode passed to RallyMain().
|
extern |
The amount of physical memory of the machine, in bytes.
|
extern |
The module of the game, set by InitializeApplication().
|
extern |
The main window.
|
extern |
The keyboard accelerators of the main window.
|
extern |
The first parameter of the last WM_ACTIVATE.
A frame runs only while it and g_dwActivateState are set and g_dwActivateMinimized is not.
|
extern |
How the main window is activated, WA_INACTIVE, WA_ACTIVE, or WA_CLICKACTIVE.
|
extern |
Whether the main window is minimised.
|
extern |
The state of the game, an index into g_apfnGameStateHandlers.
|
extern |
The routine that runs a frame of each state of the game.
|
extern |
The frames the mode of the game has run.
|
extern |
What GameState_RunGameMode() returns, 1 at the start.
|
extern |
The arrow cursor of the main window.
|
extern |
The renderer of the main window.