coastline 0.0.4
Loading...
Searching...
No Matches
frontend.h
Go to the documentation of this file.
1#pragma once
2
8
9#include <windows.h>
10// The headers below need the types of windows.h.
11#include <cstdio>
12
13#include <ddraw.h>
14
15#include "common/assetnames.h"
18#include "win32/menufont.h"
19
21#define SAVE_FILE_NAME_COUNT 100
23#define SAVE_FILE_NAME_SIZE 0x104
25#define MENU_PANEL_WIDGET_COUNT 200
27#define MENU_SCREEN_PANEL_COUNT 20
28
31public:
39
46 virtual ~SaveFileList();
47
56 virtual int ScanSaveFiles(const char *pszPattern);
57
62 const char *GetName(int index) const {
63 return aszNames[index];
64 }
65
70 void SetName(int index, const char *text) {
71 std::strcpy(aszNames[index], text);
72 }
73
80 void SetFormattedName(int index, const char *format, int value) {
81 std::sprintf(aszNames[index], format, value);
82 }
83
84private:
86
95 virtual int CountMatchingFiles(const char *pszPattern);
96
105 virtual void GenerateNextSaveFileName(char *pszPattern, char **ppszName);
106
115 virtual int WriteSeasonDescFile(int nUnused);
116
125 virtual int LoadSeasonDescription(short nSlot);
126
136 virtual int SetEntryFromSaveFileName(const char *pszFileName, const char *pszDescription);
137};
138
139class MenuScreen;
140class MenuWidget;
145class MenuItemList;
146
150 unsigned dwSize;
152 unsigned char *pData;
153};
154
161public:
174 virtual ~MenuItemList();
175
189 virtual int
190 AddItem(const char *text, unsigned flags, unsigned char style, const RECT *bounds, bool full);
203 virtual int Initialize(unsigned flags,
204 const RECT *bounds,
205 int visibleRows,
206 int firstVisibleRow,
207 int backgroundImage);
208
216 virtual int UpdateAndRenderMenuWidget(int selection);
224 virtual int UpdateItemAndNotify(int nIndex);
225
236 virtual int SetItemData(const void *data, unsigned size, int index);
237
245 virtual int RemoveItem(int index);
246
251 MenuFont &GetFont(int index) {
252 return fonts[index];
253 }
254
255 unsigned short GetItemCount() const {
256 return wItemCount;
257 }
258
262 const void *GetItemData(int index) const {
263 return itemData[index].pData;
264 }
265
269 void *GetItemData(int index) {
270 return itemData[index].pData;
271 }
272
273 unsigned GetFlags() const {
274 return dwFlags;
275 }
276
281 unsigned SetFlags(unsigned value) {
282 return dwFlags = value;
283 }
284
289 int SetVerticalScrollbar(int value) {
290 return bVerticalScrollbar = value;
291 }
292
297 void SetSelectionChangedCallback(int (*callback)(MenuItemList *, int *)) {
298 pfnSelectionChanged = callback;
299 }
300
305 void SetItemChangedCallback(int (*callback)(MenuItemList *, int)) {
306 pfnItemChanged = callback;
307 }
308
309 float GetMinScrollThumbY() const {
310 return fMinScrollThumbY;
311 }
312
313 float GetMaxScrollThumbY() const {
314 return fMaxScrollThumbY;
315 }
316
317 float GetScrollThumbY() const {
318 return fScrollThumbY;
319 }
320
324 void SetScrollThumbY(float value) {
325 fScrollThumbY = value;
326 }
327
331 void SetScrollThumbTop(int value) {
332 rcScrollThumb.top = value;
333 }
334
338 void SetScrollThumbBottom(int value) {
339 rcScrollThumb.bottom = value;
340 }
341
342private:
347 virtual int BlitSurfaceById(unsigned short image, float x, float y);
352 virtual int Draw(int selection);
357 virtual int ReturnOne();
358
363 virtual int UpdateHoverInRect(const RECT *bounds);
368 virtual int ProcessInput(int *selection);
369
370 int (*pfnSelectionChanged)(MenuItemList *, int *);
371 void (*pfnScrollUp)(void);
372 void (*pfnScrollDown)(void);
373 void (*pfnScrollDrag)(void);
374 int (*pfnItemChanged)(MenuItemList *, int);
375 unsigned dwFlags;
376 float fX;
377 float fY;
378 float fBackgroundX;
379 float fBackgroundY;
380 MenuFont fonts[100];
381 MenuItemData itemData[100];
382 unsigned short wItemCount;
383 short nFirstVisibleRow;
384 unsigned short wVisibleRowCount;
385 short nScrollUpImage;
386 short nScrollDownImage;
387 short nBackgroundImage;
388 short nScrollThumbImage;
389 RECT rcBounds;
390 RECT rcScrollUp;
391 RECT rcScrollDown;
392 RECT rcHorizontalScrollLeft;
393 RECT rcHorizontalScrollRight;
394 RECT rcScrollThumb;
395 int bScrollUpHovered;
396 int bScrollDownHovered;
397 [[maybe_unused]] char abUnknown1a9a4[8]; /* +0x1a9a4 */
398 float fScrollThumbX;
399 float fScrollThumbY;
400 int bScrollDragging;
401 int bHorizontalScrollbar;
402 int bVerticalScrollbar;
403 float fMinScrollThumbX;
404 float fMaxScrollThumbX;
405 float fMinScrollThumbY;
406 float fMaxScrollThumbY;
407 float fScrollThumbTravel;
408};
409
416public:
429 virtual ~MenuWidget();
438 virtual int UpdateBlinkTimer();
439
440private:
445 virtual int Draw();
446
447public:
455 virtual bool Update();
456
457private:
462 virtual int DrawCurrentImage();
463
464public:
474 virtual int BlitSurfaceById(int nImage, int x, int y);
475
476private:
481 virtual int DrawSpriteRegion(const RECT *pRect);
486 virtual int DrawSprite();
491 virtual bool UpdateHoverState();
496 virtual int InitSlideAnimation(int nDuration);
501 virtual long double ComputeSlideOffset(int nTicks);
506 virtual int StartSlideAnimation();
511 virtual int UpdateSlideAnimation();
512
513public:
524 virtual void
525 SetText(const char *pszText, unsigned dwTextFlags, unsigned char bStyle, const RECT *pRect);
539 virtual void Initialize(MenuScreen *pOwner,
540 float x,
541 float y,
542 unsigned dwItemFlags,
543 unsigned dwSecondary,
544 unsigned dwTertiary,
545 int nMode,
546 short nImage);
547
548private:
553 virtual bool IsBlockedByModalDialog();
554
555public:
558 return pScreen;
559 }
560
564 MenuFont &GetFont(int index) {
565 return fonts[index];
566 }
567
569 return itemList;
570 }
571
572 unsigned GetFlags() const {
573 return dwFlags;
574 }
575
579 void SetFlags(unsigned value) {
580 dwFlags = value;
581 }
582
583 float GetX() const {
584 return fX;
585 }
586
587 float GetY() const {
588 return fY;
589 }
590
594 void SetX(float value) {
595 fX = value;
596 }
597
601 void SetY(float value) {
602 fY = value;
603 }
604
608 void SetSpriteId(short value) {
609 nSpriteId = value;
610 }
611
612 short GetSpriteId() const {
613 return nSpriteId;
614 }
615
620 void SetAnimationSpriteId(int index, short value) {
621 anSpriteIds[index] = value;
622 }
623
627 void SetImageMode(int value) {
628 nImageMode = value;
629 }
630
634 void SetImageRects(const RECT *rects) {
635 pImageRects = rects;
636 }
637
642 void SetCustomFrameDurations(bool value) {
643 bCustomFrameDurations = value;
644 }
645
651 void SetFrameDuration(int index, int value) {
652 anFrameDurations[index] = value;
653 }
654
655 short GetLinkedWidgetCount() const {
656 return nLinkedWidgetCount;
657 }
658
662 short GetLinkedWidgetIndex(int index) const {
663 return anLinkedWidgetIndices[index];
664 }
665
669 void SetLinkedWidgetCount(short value) {
670 nLinkedWidgetCount = value;
671 }
672
677 void SetLinkedWidgetIndex(int index, short value) {
678 anLinkedWidgetIndices[index] = value;
679 }
680
682 return rcBounds.left;
683 }
684
686 return rcBounds.top;
687 }
688
692 void SetBoundsLeft(LONG value) {
693 rcBounds.left = value;
694 }
695
699 void SetBoundsTop(LONG value) {
700 rcBounds.top = value;
701 }
702
706 void SetBoundsRight(LONG value) {
707 rcBounds.right = value;
708 }
709
713 void SetBoundsBottom(LONG value) {
714 rcBounds.bottom = value;
715 }
716
721 void SetUpdateCallback(int (*callback)(MenuWidget *)) {
722 pfnUpdate = callback;
723 }
724
725 auto GetUpdateCallback() const {
726 return pfnUpdate;
727 }
728
732 void SetActionCallback(int (*callback)(MenuActionWidget *)) {
733 pfnAction = callback;
734 }
735
736 auto GetActionCallback() const {
737 return pfnAction;
738 }
739
743 void SetIdleActionCallback(int (*callback)(MenuWidget *)) {
744 pfnIdleAction = callback;
745 }
746
750 void SetTextEditCompleteCallback(int (*callback)(MenuWidget *)) {
751 pfnTextEditComplete = callback;
752 }
753
755 return pfnTextEditComplete;
756 }
757
761 void SetBeforeUpdateCallback(int (*callback)(MenuWidget *)) {
762 pfnBeforeUpdate = callback;
763 }
764
766 return pfnBeforeUpdate;
767 }
768
772 void SetAfterUpdateCallback(int (*callback)(MenuWidget *)) {
773 pfnAfterUpdate = callback;
774 }
775
777 return pfnAfterUpdate;
778 }
779
780private:
781 inline MenuWidget *LinkedMenuWidget(int index);
782 inline bool UpdateMenuSlideAxis(int enabled,
783 signed char direction,
784 const float &saved,
785 const float &target,
786 float &current);
787
788 int (*pfnUpdate)(MenuWidget *);
789 int (*pfnAction)(MenuActionWidget *);
790 int (*pfnIdleAction)(MenuWidget *);
791 int (*pfnTextEditComplete)(MenuWidget *);
792 int (*pfnBeforeUpdate)(MenuWidget *);
793 int (*pfnAfterUpdate)(MenuWidget *);
794 unsigned dwFlags;
795 [[maybe_unused]] char abUnknown20[4]; /* +0x20 */
796 unsigned dwSecondaryFlags;
797 unsigned dwTertiaryFlags;
798 char abUnknown2c[4]; /* +0x2c */
799 float fSavedX;
800 float fSavedY;
801 float fSavedZ;
802 float fX;
803 float fY;
804 float fZ;
805 short nWidth;
806 short nHeight;
807 [[maybe_unused]] char abUnknown4c[4]; /* +0x4c */
808 RECT rcBounds;
809 [[maybe_unused]] char abUnknown60[0xc8]; /* +0x60 */
810 short nAnimationFrame;
811 char abUnknown12a[10000]; /* +0x12a */
812 [[maybe_unused]] char abUnknown283a[2]; /* +0x283a */
813 [[maybe_unused]] char abUnknown283c[200]; /* +0x283c */
814 [[maybe_unused]] char abUnknown2904[100]; /* +0x2904 */
815 int nImageMode;
816 int bCustomFrameDurations;
817 int nAnimationLastTime;
818 int nAnimationElapsed;
819 int anFrameDurations[50];
820 short anSpriteIds[50];
821 [[maybe_unused]] char abUnknown2aa4[10]; /* +0x2aa4 */
822 [[maybe_unused]] char abUnknown2aae[6]; /* +0x2aae */
823 short nLinkedWidgetCount;
824 short anLinkedWidgetIndices[25];
825 MenuScreen *pScreen;
826 [[maybe_unused]] char abUnknown2aec[4]; /* +0x2aec */
827 char abUnknown2af0[100]; /* +0x2af0 */
828 [[maybe_unused]] char abUnknown2b54[4]; /* +0x2b54 */
829 [[maybe_unused]] char abUnknown2b58[4]; /* +0x2b58 */
830 MenuFont fonts[3];
831 int bSlideX;
832 int bSlideY;
833 signed char nSlideDirectionX;
834 signed char nSlideDirectionY;
835 float fSlideTargetX;
836 float fSlideTargetY;
837 int bSliding;
838 float fSlideStart;
839 float fSlideEnd;
840 float fSlideStep;
841 int nSlideLastTime;
842 int nSlideElapsed;
843 [[maybe_unused]] char abUnknown3830[8]; /* +0x3830 */
844 MenuItemList itemList;
845 short nSpriteId;
846 const RECT *pImageRects;
847};
848
852public:
862
871
879 static int UpdateCdTrackSelection(MenuWidget *pWidget);
880
889 static int OnMusicTrackChanged(MenuItemList *pList, int *pTrack);
890
898 static int OnCycleSfxVolume(MenuActionWidget *pWidget);
899
908
916 static int OnBackAndSave(MenuActionWidget *pItem);
917};
918
921public:
930 static int OnAcceptAndSave(MenuActionWidget *pWidget);
931
941
949 static int OnCycleHandlingType(MenuWidget *pWidget);
950
958 static int OnCycleTireType(MenuWidget *pWidget);
959
967 static int OnCycleSuspensionType(MenuWidget *pWidget);
968
977
986
994 static int UpdateTiresImage(MenuWidget *pWidget);
995
1003 static int UpdateShocksImage(MenuWidget *pWidget);
1004
1013 static int OnCycleCar(MenuActionWidget *pItem);
1014
1023 static int UpdateCarNameLabel(MenuWidget *pWidget);
1024
1033
1041 static int UpdateShocksLabel(MenuWidget *pWidget);
1042
1050 static int UpdateTiresLabel(MenuWidget *pWidget);
1051
1060 static int UpdateCarImage(MenuWidget *pWidget);
1061
1070
1079
1088
1097
1106};
1107
1111public:
1120 static int OnStartNewSeason(MenuWidget *pWidget);
1121
1129 static int OnBack(MenuActionWidget *pItem);
1130};
1131
1134public:
1142 static int OnToggleTextEdit(MenuWidget *pWidget);
1143
1152
1161};
1162
1165public:
1173 static int OnToggleTextEdit(MenuWidget *pWidget);
1174
1183 static int OnBack(MenuActionWidget *pItem);
1184};
1185
1188public:
1198};
1199
1202public:
1209 static int UpdateDeviceSelection(MenuWidget *pWidget);
1210
1218 static int OnSetDriver(MenuWidget *pWidget);
1219};
1220
1223public:
1231 static int UpdateModeSelection(MenuWidget *pWidget);
1232
1242 static int OnSetMode(MenuWidget *pWidget);
1243};
1244
1247public:
1257
1265 static int OnToggleForceFeedback(MenuWidget *pWidget);
1266
1274 static int OnToggleSkidMarks(MenuWidget *pWidget);
1275
1283 static int OnToggleCarShadow(MenuWidget *pWidget);
1284
1293
1301 static int UpdateCarShadowImage(MenuWidget *pWidget);
1302
1311
1319 static int UpdateSkidMarksImage(MenuWidget *pWidget);
1320
1328 static int UpdateCarShadowLabel(MenuWidget *pWidget);
1329
1337 static int UpdateSkidMarksLabel(MenuWidget *pWidget);
1338
1347
1357
1365 static int OnBack(MenuActionWidget *pItem);
1366};
1367
1370public:
1378 static int OnRestoreDefaults(MenuWidget *pWidget);
1379
1387 static int OnCycleInputDevice(MenuWidget *pWidget);
1388
1397
1406
1414 static int OnBack(MenuActionWidget *pItem);
1415};
1416
1419public:
1428
1436 static int OnBack(MenuActionWidget *pItem);
1437};
1438
1441public:
1449 static int UpdateActionSelection(MenuWidget *pWidget);
1450
1459 static int UpdateBindingLabel(MenuWidget *pWidget);
1460
1470
1481 static int PollKeyCapture(MenuWidget *pWidget);
1482
1490 static int BeginKeyCapture(MenuWidget *pWidget);
1491
1499 static int OnBack(MenuActionWidget *pItem);
1500};
1501
1504public:
1512 static int UpdateSlotSelection(MenuWidget *pWidget);
1513};
1514
1517public:
1528
1537 static int OnLoadAutoSave(MenuWidget *pWidget);
1538
1547
1555 static int OnBack(MenuActionWidget *pItem);
1556};
1557
1560public:
1571
1579 static int OnCarSetup(MenuWidget *pWidget);
1580
1590 static int OnSlotSelected(MenuItemList *pList, int *pnSlot);
1591
1599 static int OnBack(MenuActionWidget *pItem);
1600};
1601
1604public:
1612 static int OnPlayCredits(MenuWidget *pWidget);
1613};
1614
1617public:
1626 static int OnAccept(MenuWidget *pWidget);
1627
1637
1645 static int OnBack(MenuActionWidget *pItem);
1646};
1647
1650public:
1658 static int OnSelectIpx(MenuWidget *pWidget);
1659
1667 static int UpdateIpxItem(MenuWidget *pWidget);
1668
1676 static int OnSelectTcpIp(MenuWidget *pWidget);
1677
1685 static int UpdateTcpIpItem(MenuWidget *pWidget);
1686
1694 static int OnSelectModem(MenuWidget *pWidget);
1695
1703 static int UpdateModemItem(MenuWidget *pWidget);
1704
1712 static int OnBack(MenuActionWidget *pItem);
1713};
1714
1718public:
1727 static int OnEscape(MenuWidget *pWidget);
1728
1737 static int OnCycleCarClass(MenuWidget *pWidget);
1738
1748
1757 static int OnBackAsHost(MenuActionWidget *pItem);
1758};
1759
1762public:
1770 static int UpdateCarGroupImage(MenuWidget *pWidget);
1771
1780};
1781
1787public:
1795 static int PollChatListSelection(MenuWidget *pWidget);
1796
1805 static int SendChatMessage(MenuWidget *pWidget);
1806
1814 static int OnBootPlayer(MenuWidget *pWidget);
1815
1825 static int OnRefreshSessionDesc(MenuWidget *pWidget);
1826
1835 static int OnEscape(MenuWidget *pWidget);
1836
1844 static int UpdateSelectedPlayer(MenuWidget *pWidget);
1845};
1846
1849public:
1857 static int OnBack(MenuActionWidget *pItem);
1858
1867
1876
1885
1894
1903
1912};
1913
1916public:
1924 static int DrawPromptBox(MenuWidget *pWidget);
1925};
1926
1929public:
1939
1947 static int OnToggleTextEdit(MenuWidget *pWidget);
1948
1956 static int OnBack(MenuActionWidget *pItem);
1957};
1958
1962public:
1971 static int OnYes(MenuWidget *pWidget);
1972
1980 static int OnNo(MenuWidget *pWidget);
1981};
1982
1985public:
1993 static int UpdateBackButtonText(MenuWidget *pWidget);
1994
2002 static int OnOptions(MenuWidget *pWidget);
2003
2011 static int OnSaveSeason(MenuWidget *pWidget);
2012
2021
2030
2038 static int OnBack(MenuActionWidget *pItem);
2039
2047 static int UpdateBestTimeLabel(MenuWidget *pWidget);
2048
2056 static int UpdateBestLapLabel(MenuWidget *pWidget);
2057};
2058
2061public:
2071 static int OnConfirmQuit(MenuWidget *pWidget);
2072
2080 static int OnBack(MenuActionWidget *pItem);
2081};
2082
2085public:
2093 static int OnSelectLap1(MenuWidget *pWidget);
2094
2102 static int OnSelectLap2(MenuWidget *pWidget);
2103
2111 static int OnSelectLap3(MenuWidget *pWidget);
2112
2120 static int OnSelectTotalTime(MenuWidget *pWidget);
2121
2130
2139
2148};
2149
2152public:
2161
2170
2178 static int OnBack(MenuActionWidget *pItem);
2179};
2180
2183public:
2193
2203
2213
2221 static int OnBack(MenuActionWidget *pItem);
2222
2231
2240
2249 static int OnContinue(MenuActionWidget *pItem);
2250};
2251
2254public:
2261 static int UpdateLapCountLabel(MenuWidget *pWidget);
2262
2269 static int UpdateTrackImage(MenuWidget *pWidget);
2270
2277 static int UpdateWeatherImage(MenuWidget *pWidget);
2278
2285 static int OnCycleTrack(MenuActionWidget *pItem);
2286
2294
2302
2309 static int UpdateTrackNameLabel(MenuWidget *pWidget);
2310
2317 static int UpdateWeatherLabel(MenuWidget *pWidget);
2318
2325 static int OnBack(MenuActionWidget *pItem);
2326
2334};
2335
2338public:
2345 static int OnYes(MenuWidget *pWidget);
2346
2353 static int OnNo(MenuWidget *pWidget);
2354};
2355
2358public:
2365 static int HandleTextEntry(MenuWidget *pWidget);
2366
2373 static int OnSlotSelected(MenuItemList *pList, int *pnSlot);
2374
2381 static int UpdateSlotSelection(MenuWidget *pWidget);
2382
2389 static int OnSlotNameEntered(MenuItemList *pList, int nStatus);
2390
2397 static int InvokeBackHandler(MenuWidget *pWidget);
2398
2406
2414
2422
2430
2437 static int OnBack(MenuActionWidget *pItem);
2438
2446
2454
2462};
2463
2466public:
2473 static int HandleTextEntry(MenuWidget *pWidget);
2474
2481 static int OnSlotSelected(MenuItemList *pList, int *pnSlot);
2482
2489 static int OnSlotNameEntered(MenuItemList *pList, int status);
2490
2497 static int OnBack(MenuActionWidget *pItem);
2498};
2499
2502public:
2509 static int UpdateSlotSelection(MenuWidget *pWidget);
2510};
2511
2514public:
2521 static int PollAnyKey(MenuWidget *pWidget);
2522
2530
2538};
2539
2542public:
2549 static int UpdateYearLabel(MenuWidget *pWidget);
2550
2557 static int UpdateRoundLabel(MenuWidget *pWidget);
2558};
2559
2562public:
2569 static int UpdateRoundLabel(MenuWidget *pWidget);
2570
2578
2585 static int OnCarSetup(MenuWidget *pWidget);
2586
2593 static int OnResetRound(MenuWidget *pWidget);
2594
2601 static int OnOptions(MenuWidget *pWidget);
2602
2609 static int OnSaveSeason(MenuWidget *pWidget);
2610
2617 static int OnBack(MenuActionWidget *pItem);
2618};
2619
2622public:
2630
2637 static int UpdateRoundPlaceLabel(MenuWidget *pWidget);
2638
2645 static int UpdateSeasonNameLabel(MenuWidget *pWidget);
2646
2654
2662};
2663
2666public:
2673 static int OnBack(MenuActionWidget *pItem);
2674};
2675
2678public:
2685 static int UpdateTrackImage(MenuWidget *pWidget);
2686
2693 static int UpdateRaceTimeLabel(MenuWidget *pWidget);
2694
2701 static int UpdateBestLapLabel(MenuWidget *pWidget);
2702};
2703
2706public:
2713 static int OnBack(MenuActionWidget *pItem);
2714};
2715
2716#ifdef __cplusplus
2717extern "C" {
2718#endif
2719
2729
2739
2749
2759
2767
2775
2782
2790
2800
2801#if TGR_BRD3D
2802
2803#endif
2804
2812
2820
2829
2837
2845
2855
2865
2875
2885
2895
2905
2915
2924
2933
2940
2947
2957
2978extern RECT g_rcMenuAudioListBox;
2980
2990
2999
3008
3017
3026
3035
3043
3053
3062
3071
3078
3085int CompareDisplayModes(const void *left, const void *right);
3086
3094
3097extern RECT g_rcMenuLoadSeasonListBox;
3099
3109
3118
3126
3136int ProcessMenuTextEditInput(MenuWidget *pWidget, short nFont);
3137
3140 unsigned nStringId;
3142};
3143
3149extern KeyConfigEntry g_aKeyConfigEntries[KEY_CONFIG_ENTRY_COUNT];
3150
3155extern int g_dwCapturedKeyBindingValue;
3157
3165
3175
3183
3193
3199extern int g_bRaceSetupShowCarSetup;
3201
3211
3221
3231
3241
3251
3261
3270
3279
3288#ifdef __cplusplus
3289}
3290#endif
3291
3297extern const short g_awTimeAttackTrackImageIds[];
3298
3303extern const signed char g_abForceFeedbackImageIds[2];
3304
3309extern const short g_awTrackImageIds[];
3310
3315extern const signed char g_abWeatherImageIds[];
3316
3321extern const int g_adwForceFeedbackMenuIndexToValue[2];
3322
3327extern const int g_adwSkidMarksMenuIndexToValue[2];
3328
3333extern const int g_adwCarShadowMenuIndexToValue[2];
3334
3339extern const int g_adwSpecularLightingMenuIndexToValue[2];
3340
3345extern const signed char g_abTransmissionImageIds[2];
3346
3351extern const signed char g_abTireImageIds[3];
3352
3357extern const signed char g_abSuspensionImageIds[3];
3358
3363extern const signed char g_abInputDeviceImageIds[4];
3364
3369extern const signed char g_abServiceProviderImageIds[4];
3370
3375extern const signed char g_abCarShadowImageIds[2];
3376
3381extern const signed char g_abSpecularLightingImageIds[2];
3382
3387extern const int g_awSkidMarksImageIds[2];
3388
3393extern int g_dwMenuTextEditActive;
3395
3397#define MENU_CURSOR_WIDGET_INDEX (MENU_PANEL_WIDGET_COUNT - 1)
3398
3401 int (*pfnBeforeWidgets)(void);
3402 int (*pfnAfterWidgets)(void);
3403 int (*pfnUpdate)(void);
3404 int nFlags;
3405 unsigned short wWidgetCount;
3407 float fX;
3408 float fY;
3409 MenuScreen *pScreen;
3410 unsigned short wNavigationCount;
3411 unsigned short wSelectedIndex;
3412
3413public:
3421
3430
3437 virtual ~MenuPanel();
3445 virtual bool RunFrame();
3446
3448 void SetBeforeWidgetsCallback(int (*callback)(void)) {
3449 pfnBeforeWidgets = callback;
3450 }
3451
3452 void SetAfterWidgetsCallback(int (*callback)(void)) {
3453 pfnAfterWidgets = callback;
3454 }
3455
3456 int SetFlags(int value) {
3457 return nFlags = value;
3458 }
3459
3460 unsigned short GetWidgetCount() const {
3461 return wWidgetCount;
3462 }
3463
3464 unsigned short SetWidgetCount(unsigned short value) {
3465 return wWidgetCount = value;
3466 }
3467
3468 MenuWidget *GetWidget(int index) const {
3469 return apWidgets[index];
3470 }
3471
3472 MenuWidget *SetWidget(int index, MenuWidget *widget) {
3473 return apWidgets[index] = widget;
3474 }
3475
3476 float GetX() const {
3477 return fX;
3478 }
3479
3480 float SetX(float value) {
3481 return fX = value;
3482 }
3483
3484 float GetY() const {
3485 return fY;
3486 }
3487
3488 float SetY(float value) {
3489 return fY = value;
3490 }
3491
3493 return pScreen = screen;
3494 }
3495
3496 unsigned short GetNavigationCount() const {
3497 return wNavigationCount;
3498 }
3499
3500 unsigned short SetNavigationCount(unsigned short value) {
3501 return wNavigationCount = value;
3502 }
3503};
3504
3507public:
3521 virtual ~MenuScreen();
3522
3523private:
3531 virtual bool BeginFrame();
3539 virtual bool EndFrame();
3540
3541public:
3548 static int OnReturnToMainMenu(MenuWidget *pWidget);
3549
3557 virtual bool RunFrame();
3567 virtual bool ActivateMenuScreen();
3575 virtual void FlipAndWait();
3584 virtual void ShutdownFrontEnd(int bPartial);
3592 virtual void DestroyPanels();
3601
3603 auto GetBuildCallback() const {
3604 return pfnBuildMenu;
3605 }
3606
3607 void SetBuildCallback(int (*callback)(MenuScreen *)) {
3608 pfnBuildMenu = callback;
3609 }
3610
3611 bool IsBuilt() const {
3612 return bBuilt != 0;
3613 }
3614
3615 void SetBuilt(bool value) {
3616 bBuilt = value;
3617 }
3618
3619 unsigned short GetPanelCount() const {
3620 return wPanelCount;
3621 }
3622
3623 unsigned short SetPanelCount(unsigned short value) {
3624 return wPanelCount = value;
3625 }
3626
3627 unsigned short SetCurrentPanelIndex(unsigned short value) {
3628 return wCurrentPanel = value;
3629 }
3630
3631 MenuPanel *GetPanel(int index) const {
3632 return apPanels[index];
3633 }
3634
3635 MenuPanel *SetPanel(int index, MenuPanel *panel) {
3636 return apPanels[index] = panel;
3637 }
3638
3640 return pCurrentPanel;
3641 }
3642
3643 bool IsRunning() const {
3644 return bRunning != 0;
3645 }
3646
3647 void SetRunning(bool value) {
3648 bRunning = value;
3649 }
3650
3651 int GetPanelActive(int index) const {
3652 return anPanelActive[index];
3653 }
3654
3655 int SetPanelActive(int index, int value) {
3656 return anPanelActive[index] = value;
3657 }
3658
3659 SaveFileList *GetFileList(int index) const {
3660 return apFiles[index];
3661 }
3662
3663 unsigned short GetPanelResetWidgetIndex() const {
3664 return wPanelResetWidgetIndex;
3665 }
3666
3667 inline void ResetPanelActivation(unsigned short widgetIndex);
3668
3669private:
3670 int (*pfnBuildMenu)(MenuScreen *pScreen);
3671 int dwFlags;
3672 int bBuilt;
3673 unsigned short wPanelCount;
3674 unsigned short wCurrentPanel;
3676 MenuPanel *pCurrentPanel;
3677 int bRunning;
3679 int anPanelActive[MENU_SCREEN_PANEL_COUNT];
3680 unsigned short wPanelResetWidgetIndex;
3681 SaveFileList *apFiles[2];
3682};
3683
3684#ifdef __cplusplus
3685extern "C" {
3686#endif
3687
3698
3706
3714
3721extern void *g_pFrontEndScratchBuffer;
3722
3724#define MENU_IMAGE_COUNT 145
3726#define MENU_IMAGE_PATH_SIZE 0x104
3727
3730#if TGR_BRD3D
3731 IDirectDrawSurface *pSurface;
3732 DDSURFACEDESC desc;
3733#else
3735#endif
3736 char *pszPath;
3737};
3738
3746
3753extern unsigned short g_wMenuImageLoadedCount;
3754
3757 int anValues[3];
3758};
3759
3761#define FRONT_END_RESOURCE_SLOT_COUNT 60
3763#define FRONT_END_RESOURCE_FLAG_COUNT 100
3764
3772
3780
3788
3796
3804
3812
3825extern RECT g_rcMenuTitleBar;
3830extern RECT g_rcMenuListBox;
3835extern RECT g_rcMenuLeftColumn;
3840extern RECT g_rcMenuRightColumnWide;
3854extern RECT g_rcMenuRightColumn;
3859extern RECT g_rcMenuRightLabel;
3867extern const char g_szSpace[];
3872extern char g_szEmptyString[1];
3874
3882
3890
3898
3906
3914
3922
3930
3938
3944extern int g_adwCarNameStringIds[];
3949extern int g_adwTrackNameStringIds[];
3950
3955extern int g_adwWeatherLabelStrIds[];
3956
3961extern int g_adwTransmissionLabelStrIds[];
3962
3967extern int g_adwSuspensionLabelStrIds[];
3968
3973extern int g_adwInputDeviceLabelStrIds[];
3974
3979extern int g_adwServiceProviderLabelStrIds[];
3980
3985extern int g_adwCarShadowLabelStrIds[];
3986
3991extern int g_adwSkidMarksLabelStrIds[];
3992
3997extern int g_adwSpecularLightingLabelStrIds[];
3998
4003extern int g_adwForceFeedbackLabelStrIds[];
4005
4015
4025
4036
4041extern const int g_adwTireLabelStrIds[3];
4042
4046extern const int g_adwCarImageIds[32];
4048
4057int IsGameCdInDrive(int nDrive);
4058
4067
4075
4085
4095
4102
4121
4129
4137
4147
4155
4163
4173
4183
4193
4203
4213
4223
4230
4240
4250
4260
4268
4278
4286void SetActiveMenuItemText(const char *pszText);
4287
4293extern const RECT g_rcMenuRootTitleBar;
4294
4299extern MenuWidget *g_pOptionsSubMenu;
4300
4305extern int g_dwFileListSelectedSlot;
4307
4317
4319#define MENU_GLYPH_RECT_COUNT 68
4321#define MENU_ALT_GLYPH_RECT_COUNT 20
4323#define MENU_LARGE_ICON_RECT_COUNT 15
4325#define MENU_LARGE_ICON_3_COLUMN_RECT_COUNT 9
4326
4334
4342
4350#ifdef __cplusplus
4351}
4352#endif
4353
4360
4367extern MenuSprite g_aMenuSprites[];
4368
4376extern int g_dwMenuSurfaceInitCount;
4377
4378#if TGR_BRD3D
4384extern IDirectDraw2 *g_pMenuDirectDraw;
4385
4386#ifdef __cplusplus
4387extern "C" {
4388#endif
4389
4397bool InitMenuDirectDrawSurfaces(void);
4398#ifdef __cplusplus
4399}
4400#endif
4401
4402#endif /* TGR_BRD3D */
4403
4404#if TGR_RENDERER == TGR_RENDERER_GLIDE
4411
4420#endif
4421
4422#ifdef __cplusplus
4423extern "C" {
4424#endif
4425
4436#ifdef __cplusplus
4437}
4438#endif
4439
4440#if TGR_BRD3D
4441#ifdef __cplusplus
4442extern "C" {
4443#endif
4444
4450void SelectConfiguredDisplayMode(void);
4451#ifdef __cplusplus
4452}
4453#endif
4454
4455#endif
4456
4458#define INPUT_DEVICE_MENU_CHOICES 4
4459
4460#ifdef __cplusplus
4461extern "C" {
4462#endif
4463
4471
4479
4489
4498int ShowSaveGhostMenu(int nUnused);
4499
4509
4517
4518#if TGR_BRD3D
4519
4520#endif /* TGR_BRD3D */
4521
4528extern int g_dwMenuScreenActivated;
4529
4536extern int g_dwLobbyLaunchHandled;
4537
4545
4555
4569void BlitSurfaceRegion(int nDestX, int nDestY, WORD wImage, const RECT *pRect, DWORD dwFlags);
4570
4579
4586extern int g_dwNetworkMenuState;
4587
4595
4603
4611
4619
4627
4635
4643
4651
4659
4666extern int g_dwCheatAllCarsUnlocked;
4667
4675
4677struct CheatCode {
4678 void (*pfnApply)(void);
4679 const char *pszCode;
4680};
4681
4683#define CHEAT_CODE_COUNT 7
4684
4692
4694#define CHEAT_INPUT_BUFFER_SIZE 32
4695
4703
4710extern int g_dwCheatInputCount;
4711
4718extern int g_dwLastWmCharParam;
4719
4728
4736
4743extern int g_dwSelectedSessionIndex;
4744
4751extern int g_dwSelectedCdTrack;
4752
4759extern int g_dwSessionListRefreshing;
4760
4767extern int g_dwTrackMenuIndex;
4768
4775extern int g_dwSelectedWeather;
4776
4784
4791extern int g_dwSelectedCarClass;
4792
4801
4810int IsCarSelectable(int nCar);
4811
4820
4824 unsigned nStringId;
4825};
4826
4828#define ERROR_MESSAGE_COUNT 8
4829
4837
4851FrontEndWindowProc(void *pUnused, HWND hWnd, UINT nMessage, WPARAM wParam, LPARAM lParam);
4852
4858
4860#define KEY_CHARACTER_COUNT 98
4861
4869
4879
4885extern int g_adwCarMenuIndexToCarId[32];
4886
4891extern int g_adwTireMenuIndexToTireType[3];
4892
4897extern int g_adwSuspensionMenuIndexToType[3];
4898
4903extern int g_adwWeatherMenuIndexToWeather[5];
4904
4909extern int g_adwTrackMenuIndexToTrackId[15];
4910
4915extern int g_adwTransmissionMenuIndexToType[2];
4917
4926unsigned IsTrackSelectable(int nTrack);
4927
4937
4947
4957
4967
4977
4987
4997
5007
5016
5025
5035
5045
5055
5065
5075
5085
5095#ifdef __cplusplus
5096}
5097#endif
Callbacks for PC music-track selection and persistent music and sound-effect volume.
Definition frontend.h:851
static int UpdateCdTrackSelection(MenuWidget *pWidget)
Draw and process the CD track list, accepting nonnegative activated-row results.
static int OnCycleMusicVolume(MenuActionWidget *pWidget)
Select the music volume channel, cycle its 0..9 level using mouse edges, and apply it.
static int OnCycleSfxVolume(MenuActionWidget *pWidget)
Select the sound-effect volume channel, cycle its 0..9 level using mouse edges, and apply it.
static int UpdateVolumeLevelIndicatorPos(MenuWidget *pWidget)
Position the volume indicator for the selected music or sound-effect channel.
static int OnMusicTrackChanged(MenuItemList *pList, int *pTrack)
Select the CD track two greater than the activated list index.
static int OnBackAndSave(MenuActionWidget *pItem)
Destroy the audio-options screen, return to cached Options, back up choices, and save config.
static int UpdateVolumeChannelImage(MenuWidget *pWidget)
Update the volume-channel image and its first animation frame.
Callbacks for car, handling, equipment, and navigation choices in the PC car-setup menus.
Definition frontend.h:920
static int OnOpenSaveSeason(MenuActionWidget *pItem)
Open season saving and install its return callback for car setup.
static int UpdateShocksImage(MenuWidget *pWidget)
Select the sprite for the current suspension choice.
static int UpdateTiresLabel(MenuWidget *pWidget)
Refresh the primary label for the current tyre choice and process active text editing.
static int OnAcceptAndSave(MenuActionWidget *pWidget)
Stop the setup screen, back up choices, save config, and attempt an automatic season save.
static int OnCycleCar(MenuActionWidget *pItem)
Cycle selectable cars using mouse edges and resolve the chosen car identifier.
static int UpdateCarNameLabel(MenuWidget *pWidget)
Refresh the car-name label, or the placeholder before a ghost selection is loaded,...
static int OnCycleTransmissionType(MenuWidget *pWidget)
Cycle the transmission menu index through 0..1 using mouse edges and resolve its type.
static int UpdateTransmissionLabel(MenuWidget *pWidget)
Refresh the primary transmission label and process active text editing.
static int UpdateCarImage(MenuWidget *pWidget)
Select the current car sprite unless the ghost-load screen has no loaded selection.
static int UpdateTiresImage(MenuWidget *pWidget)
Select the sprite for the current tyre choice.
static int OnBackToTimeAttack(MenuActionWidget *pItem)
Destroy the active setup screen, clear setup references, and restore cached Time Attack.
static int OnBackToSeasonProgressInfo(MenuActionWidget *pItem)
Destroy the active setup screen, clear setup references, and restore season progress.
static int OnCycleTireType(MenuWidget *pWidget)
Cycle the tyre menu index through 0..2 using mouse edges and resolve the tyre type.
static int OnCycleHandlingType(MenuWidget *pWidget)
Cycle the handling menu index through 0..7 using mouse edges and update the chosen handling.
static int UpdateShocksLabel(MenuWidget *pWidget)
Refresh the primary label for the current suspension choice and process active text editing.
static int OnBackToRaceSetup(MenuActionWidget *pItem)
Destroy the active setup screen, clear its cache, and restore the cached main menu.
static int UpdateSteeringIndicatorPos(MenuWidget *pWidget)
Position the steering indicator for the selected handling choice.
static int OnOpenOptions(MenuActionWidget *pItem)
Open Options and install its return callback for car setup.
static int UpdateTransmissionImage(MenuWidget *pWidget)
Select the sprite for the current transmission choice.
static int OnCycleSuspensionType(MenuWidget *pWidget)
Cycle the suspension menu index through 0..2 using mouse edges and resolve its type.
Callbacks for starting a championship season and returning to the root menu.
Definition frontend.h:1110
static int OnStartNewSeason(MenuWidget *pWidget)
Reset championship choices and open pre-race information for a new season.
static int OnBack(MenuActionWidget *pItem)
Destroy the active season menu, clear its cache, and return to the root screen.
Text-entry and network-provider presentation callbacks for the connection menu.
Definition frontend.h:1133
static int UpdateServiceProviderImage(MenuWidget *pWidget)
Select the sprite for the current network service provider.
static int UpdateServiceProviderLabel(MenuWidget *pWidget)
Refresh and measure the provider label, then process its text-input update.
static int OnToggleTextEdit(MenuWidget *pWidget)
Begin text editing and toggle the primary caret when no menu text edit is active.
Text-entry and return callbacks for creating a network game.
Definition frontend.h:1164
static int OnToggleTextEdit(MenuWidget *pWidget)
Begin text editing and toggle the primary caret when no menu text edit is active.
static int OnBack(MenuActionWidget *pItem)
Destroy game creation, restore session selection, and enable joining an existing session.
State-update callbacks for the network game-creation screen.
Definition frontend.h:1187
static int EnableContinueIfNameEntered(MenuWidget *pWidget)
Enable game creation after text has been entered.
Device-list and driver-selection callbacks for the Direct3D backend.
Definition frontend.h:1201
static int UpdateDeviceSelection(MenuWidget *pWidget)
Draw and process the device list, updating the selected device on row activation.
static int OnSetDriver(MenuWidget *pWidget)
Resolve the selected row's device GUID, update config, and return to video options.
Display-mode list and configuration callbacks for the video-options screen.
Definition frontend.h:1222
static int UpdateModeSelection(MenuWidget *pWidget)
Draw and process the mode list, updating the selected mode on row activation.
static int OnSetMode(MenuWidget *pWidget)
Apply the chosen display mode to the configuration and return to the video options.
Configuration, image, and label callbacks for PC graphics and force-feedback options.
Definition frontend.h:1246
static int OnToggleSpecularLighting(MenuWidget *pWidget)
Cycle the specular-lighting choice using mouse edges and update its config value.
static int UpdateSpecularLightingImage(MenuWidget *pWidget)
Select the sprite for the current specular-lighting choice.
static int UpdateCarShadowImage(MenuWidget *pWidget)
Select the sprite for the current car-shadow choice.
static int UpdateCarShadowLabel(MenuWidget *pWidget)
Refresh and measure the car-shadow label, then process its text-input update.
static int UpdateSkidMarksImage(MenuWidget *pWidget)
Select the sprite for the current skid-mark choice.
static int OnToggleCarShadow(MenuWidget *pWidget)
Cycle the car-shadow choice using mouse edges and update its config value.
static int UpdateForceFeedbackLabel(MenuWidget *pWidget)
Refresh the force-feedback label, displaying Off when feedback is unavailable.
static int UpdateSkidMarksLabel(MenuWidget *pWidget)
Refresh and measure the skid-mark label, then process its text-input update.
static int OnToggleForceFeedback(MenuWidget *pWidget)
Cycle the force-feedback choice using mouse edges and update its config value.
static int OnToggleSkidMarks(MenuWidget *pWidget)
Cycle the skid-mark choice using mouse edges and update its config value.
static int UpdateForceFeedbackImage(MenuWidget *pWidget)
Draw the force feedback choice, displaying off when the device lacks support.
static int OnBack(MenuActionWidget *pItem)
Destroy the active game-options screen, clear its cache, and return to cached Options.
static int UpdateSpecularLightingLabel(MenuWidget *pWidget)
Refresh and measure the specular-lighting label, then process its text-input update.
Input-device selection, default bindings, and label callbacks for PC controls.
Definition frontend.h:1369
static int OnRestoreDefaults(MenuWidget *pWidget)
Reload default bindings when the selected device index is in 0..3.
static int UpdateInputDeviceLabel(MenuWidget *pWidget)
Refresh and measure the input-device label, then process its text-input update.
static int OnBack(MenuActionWidget *pItem)
Destroy the active input-options screen, clear its cache, and return to cached Options.
static int UpdateInputDeviceImage(MenuWidget *pWidget)
Select the sprite for the current input device.
static int OnCycleInputDevice(MenuWidget *pWidget)
Cycle among device indices 0, 2, and 3 using mouse edges, then select and back up bindings.
Session-list and return callbacks for joining or creating a network game.
Definition frontend.h:1418
static int UpdateSessionSelection(MenuWidget *pWidget)
Draw and process the session list, updating the selected session on row activation.
static int OnBack(MenuActionWidget *pItem)
Destroy session selection, clear join/create references, restore connection, and disconnect.
Action selection, key capture, and binding-warning callbacks for PC input configuration.
Definition frontend.h:1440
static int PollKeyCapture(MenuWidget *pWidget)
Poll keyboard, joystick, or mouse capture, update the selected binding, and detect duplicates.
static int UpdateActionSelection(MenuWidget *pWidget)
Draw and process the action list, updating the selected action on row activation.
static int UpdateDuplicateBindingWarning(MenuWidget *pWidget)
Update the duplicate-binding warning and highlight an affected selected action.
static int OnBack(MenuActionWidget *pItem)
Destroy key configuration, return to cached input options, and release the joystick device.
static int UpdateBindingLabel(MenuWidget *pWidget)
Refresh the binding label or capture prompt, measure it, and process its text-input update.
static int BeginKeyCapture(MenuWidget *pWidget)
Enable key capture, clear pending character input, and reset keyboard edge state if needed.
Saved-file list selection callbacks.
Definition frontend.h:1503
static int UpdateSlotSelection(MenuWidget *pWidget)
Draw and process the save-slot list, updating the selected slot on row activation.
Championship save loading, continuation, and return callbacks.
Definition frontend.h:1516
static int OnBack(MenuActionWidget *pItem)
Destroy season loading, clear its selection and labels, and restore the cached season menu.
static int OnLoadAutoSave(MenuWidget *pWidget)
Attempt to load the automatic season save and open pre-race information in championship mode.
static int OnContinueSeason(MenuActionWidget *pItem)
Open pre-race information for the loaded season and install the return callback to loading.
static int UpdateContinueButtonState(MenuWidget *pWidget)
Enable continuing after a championship slot has been opened.
Saved time-attack selection, car setup, and return callbacks.
Definition frontend.h:1559
static int OnSlotSelected(MenuItemList *pList, int *pnSlot)
Load a numbered TimeAttack slot, restore its race selections and profile, and synchronise progress.
static int OnCarSetup(MenuWidget *pWidget)
Open car setup for the loaded time attack and install its return callback.
static int UpdateItemEnabledState(MenuWidget *pWidget)
Enable a time attack item after a saved slot has been selected.
static int OnBack(MenuActionWidget *pItem)
Destroy ghost loading, clear its cache, and restore the cached Time Attack menu.
Root-menu callbacks for entering the credits sequence.
Definition frontend.h:1603
static int OnPlayCredits(MenuWidget *pWidget)
Select the credits or cheat-enabled outro session and stop the front end for playback.
Menu text with a 1024-byte internal buffer, glyph metrics, drawing style, and text-entry state.
Definition menufont.h:40
Menu list with 100 font and payload slots, optional scrolling, and selection callbacks.
Definition frontend.h:160
virtual int AddItem(const char *text, unsigned flags, unsigned char style, const RECT *bounds, bool full)
Append a text row, removing the oldest row first when all 100 slots are used.
int SetVerticalScrollbar(int value)
Store vertical scrollbar state without rebuilding layout.
Definition frontend.h:289
MenuItemList()
Initialise an empty list with null callbacks, disabled scrolling, and no images.
unsigned GetFlags() const
Definition frontend.h:273
float GetMaxScrollThumbY() const
Definition frontend.h:313
void SetScrollThumbY(float value)
Store a vertical thumb position without clamping or updating its rectangle.
Definition frontend.h:324
unsigned SetFlags(unsigned value)
Replace list flags without rebuilding layout.
Definition frontend.h:281
void SetSelectionChangedCallback(int(*callback)(MenuItemList *, int *))
Replace the row-activation callback without invoking it.
Definition frontend.h:297
virtual int Initialize(unsigned flags, const RECT *bounds, int visibleRows, int firstVisibleRow, int backgroundImage)
Copy list bounds and configure visible rows, background, and enabled scrollbar geometry.
virtual int SetItemData(const void *data, unsigned size, int index)
Copy bytes into slot payload storage, allocating only when the slot has no buffer.
MenuFont & GetFont(int index)
Definition frontend.h:251
virtual int UpdateAndRenderMenuWidget(int selection)
Draw the list and process input when text editing and modal dialogs do not block input.
void SetItemChangedCallback(int(*callback)(MenuItemList *, int))
Replace the text-edit completion callback without invoking it.
Definition frontend.h:305
unsigned short GetItemCount() const
Definition frontend.h:255
void SetScrollThumbTop(int value)
Change the thumb rectangle's top without updating its stored floating-point position.
Definition frontend.h:331
virtual int UpdateItemAndNotify(int nIndex)
Measure a row, process active text editing, and notify its completion or cancellation.
void * GetItemData(int index)
Definition frontend.h:269
float GetMinScrollThumbY() const
Definition frontend.h:309
float GetScrollThumbY() const
Definition frontend.h:317
virtual int RemoveItem(int index)
Clear a row and shift later rows towards the start without releasing payload allocations.
virtual ~MenuItemList()
Destroy font storage without releasing attached payload allocations.
const void * GetItemData(int index) const
Definition frontend.h:262
void SetScrollThumbBottom(int value)
Change the thumb rectangle's bottom without resizing other layout fields.
Definition frontend.h:338
A panel of a screen of the front end.
Definition frontend.h:3400
float GetY() const
Definition frontend.h:3484
MenuScreen * SetScreen(MenuScreen *screen)
Associate the panel with screen.
Definition frontend.h:3492
int SetFlags(int value)
Replace the panel flags.
Definition frontend.h:3456
unsigned short GetNavigationCount() const
Definition frontend.h:3496
virtual bool RunFrame()
Run a frame of every item of the panel.
void SetBeforeWidgetsCallback(int(*callback)(void))
Set the callback invoked before panel widgets run.
Definition frontend.h:3448
MenuWidget * SetWidget(int index, MenuWidget *widget)
Replace the widget at index.
Definition frontend.h:3472
unsigned short GetWidgetCount() const
Definition frontend.h:3460
float SetX(float value)
Set the panel's horizontal position.
Definition frontend.h:3480
MenuPanel()
Clear widget pointers and panel selections.
float SetY(float value)
Set the panel's vertical position.
Definition frontend.h:3488
virtual ~MenuPanel()
Destroy the panel without deleting its widget pointers.
MenuWidget * GetWidget(int index) const
Definition frontend.h:3468
unsigned short SetNavigationCount(unsigned short value)
Replace the number of navigable widgets.
Definition frontend.h:3500
int RestoreSelection()
Clamp the saved menu hover index to this panel's navigation range and select it.
float GetX() const
Definition frontend.h:3476
unsigned short SetWidgetCount(unsigned short value)
Replace the number of widgets in the panel.
Definition frontend.h:3464
void SetAfterWidgetsCallback(int(*callback)(void))
Set the callback invoked after panel widgets run.
Definition frontend.h:3452
A screen of the front end menus.
Definition frontend.h:3506
virtual void DestroyPanels()
Delete every widget of every panel and the panels, and put the hover back on the first item.
virtual void FlipAndWait()
Flip the frame to the display and wait for the flip to finish.
int SetPanelActive(int index, int value)
Set whether the panel at index is active.
Definition frontend.h:3655
static int OnReturnToMainMenu(MenuWidget *pWidget)
Return to the main menu from another front-end screen.
unsigned short SetCurrentPanelIndex(unsigned short value)
Set the index of the current panel.
Definition frontend.h:3627
virtual bool RunFrame()
Run a frame of the screen, and shut the front end down once the screen stops running.
virtual HRESULT ClearBackBuffer()
Clear the back buffer of the display.
SaveFileList * GetFileList(int index) const
Definition frontend.h:3659
unsigned short SetPanelCount(unsigned short value)
Replace the number of panels in the screen.
Definition frontend.h:3623
unsigned short GetPanelResetWidgetIndex() const
Definition frontend.h:3663
int GetPanelActive(int index) const
Definition frontend.h:3651
MenuPanel * GetPanel(int index) const
Definition frontend.h:3631
MenuScreen()
Create a running screen with two lists of saved files.
void SetBuilt(bool value)
Set whether the screen has been built.
Definition frontend.h:3615
void ResetPanelActivation(unsigned short widgetIndex)
Reset panel activation and select widgetIndex.
unsigned short GetPanelCount() const
Definition frontend.h:3619
auto GetBuildCallback() const
Definition frontend.h:3603
void SetRunning(bool value)
Set whether the screen is running.
Definition frontend.h:3647
virtual bool ActivateMenuScreen()
Make the screen the one that shows.
void SetBuildCallback(int(*callback)(MenuScreen *))
Set the callback that builds the screen.
Definition frontend.h:3607
bool IsRunning() const
Definition frontend.h:3643
MenuPanel * GetCurrentPanel() const
Definition frontend.h:3639
virtual ~MenuScreen()
Free the lists of saved files.
MenuPanel * SetPanel(int index, MenuPanel *panel)
Replace the panel at index.
Definition frontend.h:3635
virtual void ShutdownFrontEnd(int bPartial)
Free the cached screens of the front end.
bool IsBuilt() const
Definition frontend.h:3611
Front-end panel widget with text, sprites, animations, and input callbacks.
Definition frontend.h:415
void SetImageMode(int value)
Store the image-animation mode without resetting timers.
Definition frontend.h:627
void SetUpdateCallback(int(*callback)(MenuWidget *))
Install a widget-update callback without invoking it.
Definition frontend.h:721
auto GetBeforeUpdateCallback() const
Definition frontend.h:765
LONG GetBoundsTop() const
Definition frontend.h:685
void SetActionCallback(int(*callback)(MenuActionWidget *))
Install an activation callback without invoking it.
Definition frontend.h:732
void SetIdleActionCallback(int(*callback)(MenuWidget *))
Install an idle callback without invoking it.
Definition frontend.h:743
virtual ~MenuWidget()
Destroy embedded fonts and list storage without releasing borrowed screens or rectangles.
auto GetAfterUpdateCallback() const
Definition frontend.h:776
void SetX(float value)
Store a horizontal position without updating bounds or font coordinates.
Definition frontend.h:594
void SetAnimationSpriteId(int index, short value)
Store a sprite identifier in one animation slot.
Definition frontend.h:620
virtual void SetText(const char *pszText, unsigned dwTextFlags, unsigned char bStyle, const RECT *pRect)
Copy text into font slot zero, measure it, and update widget bounds and text dimensions.
void SetLinkedWidgetCount(short value)
Store link count without initialising the corresponding link indices.
Definition frontend.h:669
MenuItemList & GetItemList()
Definition frontend.h:568
void SetY(float value)
Store a vertical position without updating bounds or font coordinates.
Definition frontend.h:601
void SetBoundsTop(LONG value)
Store the top bound without updating other layout fields.
Definition frontend.h:699
MenuScreen * GetScreen() const
Definition frontend.h:557
virtual void Initialize(MenuScreen *pOwner, float x, float y, unsigned dwItemFlags, unsigned dwSecondary, unsigned dwTertiary, int nMode, short nImage)
Assign the parent screen and position, combine flag groups, and set the first sprite.
void SetTextEditCompleteCallback(int(*callback)(MenuWidget *))
Install a text-edit completion callback without invoking it.
Definition frontend.h:750
void SetFrameDuration(int index, int value)
Store a custom frame duration without changing animation progress.
Definition frontend.h:651
void SetCustomFrameDurations(bool value)
Select custom frame timings and per-frame source rectangles without initialising either.
Definition frontend.h:642
void SetSpriteId(short value)
Store the current sprite identifier without updating geometry.
Definition frontend.h:608
void SetBoundsRight(LONG value)
Store the right bound without updating other layout fields.
Definition frontend.h:706
float GetY() const
Definition frontend.h:587
void SetAfterUpdateCallback(int(*callback)(MenuWidget *))
Install a callback run by the panel after the widget update.
Definition frontend.h:772
MenuFont & GetFont(int index)
Definition frontend.h:564
float GetX() const
Definition frontend.h:583
LONG GetBoundsLeft() const
Definition frontend.h:681
MenuWidget()
Initialise inactive callbacks, default flags and position, and empty animation/link storage.
virtual int BlitSurfaceById(int nImage, int x, int y)
Blit a menu sprite's stored source rectangle at the supplied destination.
short GetLinkedWidgetCount() const
Definition frontend.h:655
void SetBoundsLeft(LONG value)
Store the left bound without updating other layout fields.
Definition frontend.h:692
auto GetTextEditCompleteCallback() const
Definition frontend.h:754
short GetSpriteId() const
Definition frontend.h:612
auto GetUpdateCallback() const
Definition frontend.h:725
void SetBeforeUpdateCallback(int(*callback)(MenuWidget *))
Install a callback run by the panel before the widget update.
Definition frontend.h:761
void SetFlags(unsigned value)
Replace primary widget flags without updating layout.
Definition frontend.h:579
unsigned GetFlags() const
Definition frontend.h:572
virtual bool Update()
Run a frame of the item.
short GetLinkedWidgetIndex(int index) const
Definition frontend.h:662
void SetBoundsBottom(LONG value)
Store the bottom bound without updating other layout fields.
Definition frontend.h:713
virtual int UpdateBlinkTimer()
Advance enabled image animation using elapsed milliseconds and mark widgets for redraw.
void SetImageRects(const RECT *rects)
Replace the borrowed source-rectangle array used for custom animation frames.
Definition frontend.h:634
auto GetActionCallback() const
Definition frontend.h:736
void SetLinkedWidgetIndex(int index, short value)
Assign one linked widget index without changing link count.
Definition frontend.h:677
Modem-number entry, provider selection, and connection-screen return callbacks.
Definition frontend.h:1616
static int EnableContinueIfNumberEntered(MenuWidget *pWidget)
Enable continuing after a modem number has been entered.
static int OnAccept(MenuWidget *pWidget)
Select the modem provider and restore the cached join or create screen.
static int OnBack(MenuActionWidget *pItem)
Destroy modem entry, clear its references, and restore the cached connection screen.
Provider selection, hover animation, and return callbacks for multiplayer connections.
Definition frontend.h:1649
static int OnSelectModem(MenuWidget *pWidget)
Select the modem provider and attempt to open the session join/create screen.
static int OnBack(MenuActionWidget *pItem)
Destroy provider selection, clear its cache, and restore the cached multiplayer-name screen.
static int UpdateModemItem(MenuWidget *pWidget)
Select the modem provider and update its widget's hover and animation appearance.
static int OnSelectIpx(MenuWidget *pWidget)
Select IPX and attempt to open the session join/create screen.
static int UpdateTcpIpItem(MenuWidget *pWidget)
Select TCP/IP and update the provider widget's hover and animation appearance.
static int OnSelectTcpIp(MenuWidget *pWidget)
Select TCP/IP and attempt to open the session join/create screen.
static int UpdateIpxItem(MenuWidget *pWidget)
Select IPX and update the provider widget's hover and animation appearance.
Multiplayer race-setup callbacks using the shared session and cached connection screens.
Definition frontend.h:1717
static int OnBackAsHost(MenuActionWidget *pItem)
Return a host to game creation, disconnect, and restore provider discovery when needed.
static int OnCycleCarClass(MenuWidget *pWidget)
Cycle car classes 0..4 using mouse edges and apply the selected car-group preset.
static int OnBackAsClient(MenuActionWidget *pItem)
Return a client to session selection, disconnect, and restore provider discovery when needed.
static int OnEscape(MenuWidget *pWidget)
Exit an active network game launched through a lobby.
Sprite-update callbacks for multiplayer car-group choices.
Definition frontend.h:1761
static int UpdateCarGroupSubImage(MenuWidget *pWidget)
Select the secondary car-group sprite, using -1 for groups outside 1..4.
static int UpdateCarGroupImage(MenuWidget *pWidget)
Select the car-group sprite, using the default image for groups outside 1..4.
Network car-setup callbacks for chat, player selection, readiness, and session transitions.
Definition frontend.h:1786
static int SendChatMessage(MenuWidget *pWidget)
Copy primary text into the shared chat buffer, send it, and clear both text buffers.
static int PollChatListSelection(MenuWidget *pWidget)
Draw and process the chat list without storing a newly activated row index.
static int OnEscape(MenuWidget *pWidget)
Process network escape, lobby return, host readiness, or the pending race-start transition.
static int UpdateSelectedPlayer(MenuWidget *pWidget)
Process player-list selection and read the selected row's application data as its player ID.
static int OnRefreshSessionDesc(MenuWidget *pWidget)
Query session readiness and send a start request for a ready host or toggle client readiness.
static int OnBootPlayer(MenuWidget *pWidget)
Send a removal request for the selected player unless the selection is the local player.
Return callbacks that destroy the active Options screen and restore a cached destination.
Definition frontend.h:1848
static int OnBackToCarSetup(MenuActionWidget *pItem)
Destroy Options, clear its cache, and restore cached car setup.
static int OnBack(MenuActionWidget *pItem)
Destroy Options, clear its cache, and restore the root menu.
static int OnBackToPreRaceInfo(MenuActionWidget *pItem)
Destroy Options, clear its cache, and restore cached pre-race information.
static int OnBackToSeasonProgressInfo(MenuActionWidget *pItem)
Destroy Options, clear its cache, and restore cached season progress.
static int OnBackToRaceResultsInfo(MenuActionWidget *pItem)
Destroy Options, clear its cache, and restore cached race-results information.
static int OnBackToRaceResultsSummary(MenuActionWidget *pItem)
Destroy Options, clear its cache, and restore the cached race-results summary.
static int OnBackToRaceResultsTotals(MenuActionWidget *pItem)
Destroy Options, clear its cache, and restore cached race-results totals.
Drawing callbacks for the overwrite-confirmation prompt.
Definition frontend.h:1915
static int DrawPromptBox(MenuWidget *pWidget)
Draw a segmented prompt surround sized from the primary font's measured width.
Player-name editing, continuation, and root-menu return callbacks.
Definition frontend.h:1928
static int OnToggleTextEdit(MenuWidget *pWidget)
Begin text editing and toggle the primary caret when no menu text edit is active.
static int OnBack(MenuActionWidget *pItem)
Destroy player-name entry, clear its references, and restore the root menu.
static int EnableContinueIfNameEntered(MenuWidget *pWidget)
Enable continuing after a player name has been entered.
Confirmation callbacks for abandoning a championship from pre-race information.
Definition frontend.h:1961
static int OnNo(MenuWidget *pWidget)
Restore cached pre-race information without destroying the confirmation screen.
static int OnYes(MenuWidget *pWidget)
Destroy confirmation and cached pre-race screens, clear the pre-race cache and screen pointer,...
Championship pre-race records, options, saving, and exit-confirmation callbacks.
Definition frontend.h:1984
static int OnBack(MenuActionWidget *pItem)
Activate the previously built pre-race exit-confirmation screen.
static int UpdateBestLapLabel(MenuWidget *pWidget)
Draw the season's best lap time for the saved round's track, or a placeholder when unloaded.
static int OnOptions(MenuWidget *pWidget)
Open Options and install its return callback to pre-race information.
static int OnBackToLoadSeason(MenuActionWidget *pItem)
Destroy pre-race information, clear its references, and restore cached season loading.
static int OnBackToChampionshipSeason(MenuActionWidget *pItem)
Destroy pre-race information, clear its references, and restore the cached season menu.
static int UpdateBestTimeLabel(MenuWidget *pWidget)
Draw the season's best race time for the saved round's track, or a placeholder when unloaded.
static int OnSaveSeason(MenuWidget *pWidget)
Open season saving and install its return callback to pre-race information.
static int UpdateBackButtonText(MenuWidget *pWidget)
Refresh and measure the Back label according to championship and resume state.
Application-exit confirmation and root-menu return callbacks.
Definition frontend.h:2060
static int OnConfirmQuit(MenuWidget *pWidget)
Back up choices, save config, shut down the front end and DirectPlay, and exit the application.
static int OnBack(MenuActionWidget *pItem)
Destroy quit confirmation, clear its cache, and restore the root menu.
Lap selection, timing labels, and submenu callbacks for race-results information.
Definition frontend.h:2084
static int OnSelectTotalTime(MenuWidget *pWidget)
Select the complete race time for results display.
static int OnOpenSaveSeason(MenuActionWidget *pItem)
Open season saving and install its return callback to race-results information.
static int OnSelectLap3(MenuWidget *pWidget)
Select the third lap's recorded time for results display.
static int OnSelectLap2(MenuWidget *pWidget)
Select the second lap's recorded time for results display.
static int OnOpenOptions(MenuActionWidget *pItem)
Open Options and install its return callback to race-results information.
static int OnSelectLap1(MenuWidget *pWidget)
Select the first lap's recorded time for results display.
static int UpdateSelectedTimeLabel(MenuWidget *pWidget)
Format and draw the selected lap or complete race time using the primary font.
Submenu and return callbacks for the championship race-results summary.
Definition frontend.h:2151
static int OnBack(MenuActionWidget *pItem)
Destroy the results summary, clear its cache, and restore cached race-results information.
static int OnOpenSaveSeason(MenuActionWidget *pItem)
Open season saving and install its return callback to the results summary.
static int OnOpenOptions(MenuActionWidget *pItem)
Open Options and install its return callback to the results summary.
Season points, progress labels, submenu callbacks, and continuation from results totals.
Definition frontend.h:2182
static int OnOpenOptions(MenuActionWidget *pItem)
Open Options and install its return callback to results totals.
static int OnContinue(MenuActionWidget *pItem)
Restore championship settings and points from progress, then select the next screen.
static int OnBack(MenuActionWidget *pItem)
Destroy results totals, clear its cache, and restore the cached results summary.
static int UpdateRoundsCompletedLabel(MenuWidget *pWidget)
Draw the number of completed rounds in the race results.
static int OnOpenSaveSeason(MenuActionWidget *pItem)
Open season saving and install its return callback to results totals.
static int UpdatePointsNeededLabel(MenuWidget *pWidget)
Draw the remaining points for the season stored in the resume state.
static int UpdateTotalPointsLabel(MenuWidget *pWidget)
Draw the total points of the race results.
Callbacks for selecting a track, weather, and lap count.
Definition frontend.h:2253
static int UpdateWeatherImage(MenuWidget *pWidget)
Choose the weather image from the selected championship round or weather menu.
static int UpdateTrackNameLabel(MenuWidget *pWidget)
Draw the selected track name, or the ghost-slot prompt when no ghost is selected.
static int OnCycleWeather(MenuActionWidget *pItem)
Cycle the weather selection and notify network peers.
static int OnBackToTimeAttack(MenuActionWidget *pItem)
Return from race setup to the time attack menu.
static int UpdateWeatherLabel(MenuWidget *pWidget)
Draw the selected weather, or the ghost-slot prompt when no ghost is selected.
static int OnCycleLapCount(MenuActionWidget *pItem)
Cycle the lap count from 1 through 12 and notify network peers.
static int OnCycleTrack(MenuActionWidget *pItem)
Cycle through available tracks, including unlocked bonus tracks, and notify network peers.
static int OnBack(MenuActionWidget *pItem)
Return from race setup to the root menu.
static int UpdateTrackImage(MenuWidget *pWidget)
Choose the track image from the selected championship round or track menu.
static int UpdateLapCountLabel(MenuWidget *pWidget)
Draw the selected lap count unless an empty ghost slot is showing.
Callbacks for confirming an exit from the championship results.
Definition frontend.h:2337
static int OnNo(MenuWidget *pWidget)
Return to race-result totals without closing the season.
static int OnYes(MenuWidget *pWidget)
Discard the cached results screens and return to the root menu.
The names of the saved files a screen of the front end lists.
Definition frontend.h:30
virtual int ScanSaveFiles(const char *pszPattern)
Read descriptions from the last 128 bytes of matching saved files.
SaveFileList()
Clear every name.
void SetFormattedName(int index, const char *format, int value)
Format one integer into a slot without checking the destination capacity.
Definition frontend.h:80
void SetName(int index, const char *text)
Copy a terminated name into a slot without checking the destination capacity.
Definition frontend.h:70
virtual ~SaveFileList()
Do nothing.
const char * GetName(int index) const
Definition frontend.h:62
Callbacks for selecting and naming a championship save slot.
Definition frontend.h:2357
static int OnBack(MenuActionWidget *pItem)
Return from the save menu to race results.
static int OnBackToRaceResultsInfo(MenuActionWidget *pItem)
Return from the save menu to the race-result details.
static int HandleTextEntry(MenuWidget *pWidget)
Process championship save text confirmation or cancellation.
static int OnBackToSeasonProgressInfo(MenuActionWidget *pItem)
Return from the save menu to championship progress.
static int OnBackToRaceResultsSummary(MenuActionWidget *pItem)
Return from the save menu to the race-result summary.
static int UpdateSlotSelection(MenuWidget *pWidget)
Update the selected save slot and notify its item during text entry.
static int InvokeBackHandler(MenuWidget *pWidget)
Invoke the save menu's return callback and restore championship mode.
static int OnBackToPreRaceInfo(MenuActionWidget *pItem)
Return from the save menu to pre-race information.
static int OnSlotSelected(MenuItemList *pList, int *pnSlot)
Start naming a new championship slot or activate confirmation for an existing file.
static int UpdateItemEnabledState(MenuWidget *pWidget)
Enable the Continue item after a slot has been named.
static int OnBackToRaceResultsTotals(MenuActionWidget *pItem)
Return from the save menu to the race-result totals.
static int OnBackToCarSetup(MenuActionWidget *pItem)
Return from the save menu to car setup.
static int OnSlotNameEntered(MenuItemList *pList, int nStatus)
Save a named championship slot, or restore its previous label when naming is cancelled.
Callbacks for the time attack save menu.
Definition frontend.h:2465
static int HandleTextEntry(MenuWidget *pWidget)
Process time attack save text confirmation or cancellation.
static int OnSlotSelected(MenuItemList *pList, int *pnSlot)
Open overwrite confirmation for an existing ghost slot, or start naming an empty slot.
static int OnBack(MenuActionWidget *pItem)
Return from the ghost save menu to time attack.
static int OnSlotNameEntered(MenuItemList *pList, int status)
Save the named ghost slot, or restore its old label when naming is cancelled.
Callbacks for the time attack save-slot screen.
Definition frontend.h:2501
static int UpdateSlotSelection(MenuWidget *pWidget)
Update the ghost save-slot selection using the championship slot-list handler.
Callbacks for the championship completion screen.
Definition frontend.h:2513
static int PollAnyKey(MenuWidget *pWidget)
Advance the championship completion screen when input is detected.
static int UpdateSecondaryBannerImage(MenuWidget *pWidget)
Select the secondary completion banner from championship flags and season progress.
static int UpdatePrimaryBannerImage(MenuWidget *pWidget)
Select the primary completion banner from championship flags and season progress.
Callbacks for the selected championship file's labels.
Definition frontend.h:2541
static int UpdateRoundLabel(MenuWidget *pWidget)
Draw the championship round as a one-based number.
static int UpdateYearLabel(MenuWidget *pWidget)
Draw the championship year as a one-based number.
Callbacks for championship progress and actions.
Definition frontend.h:2561
static int OnSaveSeason(MenuWidget *pWidget)
Open the championship save screen and configure its return action.
static int UpdateRoundLabel(MenuWidget *pWidget)
Draw the season progress round with its label and two separating spaces.
static int UpdatePointsNeededLabel(MenuWidget *pWidget)
Draw the remaining points required to advance, with negative results clamped to zero.
static int OnCarSetup(MenuWidget *pWidget)
Open car setup for the current championship and configure its return action.
static int OnBack(MenuActionWidget *pItem)
Return from championship progress to pre-race information.
static int OnResetRound(MenuWidget *pWidget)
Reset the saved championship round to the first round.
static int OnOptions(MenuWidget *pWidget)
Open options and configure the return action for championship progress.
Callbacks for championship standings and totals.
Definition frontend.h:2621
static int UpdateTotalPointsLabel(MenuWidget *pWidget)
Draw the sum of the selected season's four race scores, or zero before loading.
static int UpdateYearOrdinalLabel(MenuWidget *pWidget)
Draw the year with the translated suffix for its ordinal.
static int UpdateRoundPointsLabel(MenuWidget *pWidget)
Draw the points earned in the selected championship round.
static int UpdateSeasonNameLabel(MenuWidget *pWidget)
Draw the selected championship class name when its text is available.
static int UpdateRoundPlaceLabel(MenuWidget *pWidget)
Draw the finishing place in the selected championship round.
Callbacks for the time attack menu.
Definition frontend.h:2665
static int OnBack(MenuActionWidget *pItem)
Return from time attack to the root menu.
Callbacks for the selected time attack record.
Definition frontend.h:2677
static int UpdateTrackImage(MenuWidget *pWidget)
Update the selected time attack track image after a saved slot has been selected.
static int UpdateBestLapLabel(MenuWidget *pWidget)
Draw the ghost's best lap time.
static int UpdateRaceTimeLabel(MenuWidget *pWidget)
Draw the ghost's best race time.
Callbacks for the video options screen.
Definition frontend.h:2705
static int OnBack(MenuActionWidget *pItem)
Return from video options to the options menu.
CheatCode g_aCheatCodes[]
The cheats, ending with a NULL sequence.
T sprintf(T... args)
The selections of the menus that the game reads, which the menus of the PC release and those of the S...
#define KEY_CONFIG_ENTRY_COUNT
The number of controls displayed by key configuration.
Definition frontendstate.h:15
The images of 16-bit RGB 565 pixels the Glide renderer loads from bitmaps and copies to the frame buf...
T strcpy(T... args)
A cheat: the sequence of button changes that applies it, newest first, ending in 0xFFFF.
Definition input.h:57
const char * pszCode
Definition frontend.h:4679
void(* pfnApply)(void)
Definition frontend.h:4678
An error of the game that ShowErrorMessage() can show.
Definition frontend.h:4822
int bFatal
Definition frontend.h:4823
unsigned nStringId
Definition frontend.h:4824
A resource of the front end.
Definition frontend.h:3756
int anValues[3]
Definition frontend.h:3757
A key of text input and the character it types.
Definition frontend.h:4854
DWORD dwKey
Definition frontend.h:4855
char chText
Definition frontend.h:4856
A keyboard configuration row and its label resource.
Definition frontend.h:3139
unsigned nStringId
Definition frontend.h:3140
int nControl
Definition frontend.h:3141
An image of the menus and the file it is loaded from.
Definition frontend.h:3729
char * pszPath
Definition frontend.h:3736
Rgb565Image * pImage
Definition frontend.h:3734
Byte payload associated with a menu-list slot.
Definition frontend.h:148
unsigned char * pData
Allocated payload storage, or null before attachment; native removal does not release it.
Definition frontend.h:152
unsigned dwSize
Number of payload bytes last copied into the slot.
Definition frontend.h:150
A sprite of the menus, a part of a menu image.
Definition frontend.h:4355
int nImage
Definition frontend.h:4356
RECT rc
Definition frontend.h:4357
DWORD dwFlags
Definition frontend.h:4358
A bitmap of RGB 565 pixels with a transparent colour key.
Definition rgb565image.h:19
void ApplyCarGroupPreset(void)
Set the cars of the chosen class and choose the first of them, when the class changed since the last ...
int ProcessCheatInputAndValidateEntity(MenuWidget *pWidget)
Process cheat-code input and update the menu item's active state.
KeyCharacter g_KeyNameLookupTable[KEY_CHARACTER_COUNT]
The keys of text input, each typing the printable character of its own code.
MenuSprite g_aMenuSprites[]
The sprites of the menus.
int ShowRaceResultsSummaryScreen(MenuWidget *pWidget=nullptr)
Show cached race summary results and build an exit confirmation on the first visit.
void RefreshSessionListSlots(void)
Remove player-list items by index before enumerating a session's players.
MenuImage g_aMenuImages[MENU_IMAGE_COUNT]
The images of the menus.
MenuWidget * g_pSaveTimeAttackMenu
The menu to save a time attack.
int BuildJoinCreateGameUI(MenuScreen *pScreen)
Build the menu for joining or creating a network game.
int g_dwLobbyLaunchHandled
Whether the lobby was entered for a game launched from a lobby.
int g_dwSelectedCdTrack
The track of the CD the menus show, counted from the first music track.
int ReturnToVideoOptionsFromResolution(MenuWidget *pWidget)
Destroy display mode panels and restore the cached input configuration screen.
void Cheat_DisableVehicleDeformation(void)
Stop the vehicles deforming, play the sound of this cheat, and set the network menus to state 3.
int OnTcpIpPortEdited(MenuWidget *pWidget)
Save the edited TCP/IP port in the game configuration.
int OnPlayerNameEdited(MenuWidget *pWidget)
Update the player name from the text field and enable continuing when it is nonempty.
int ShowGameOptionsMenu(MenuWidget *pWidget)
int ShowRaceResultsScreen(void)
Show the screen of the results of a race.
int BuildDisplayModeSelectUI(MenuScreen *pScreen)
Build display mode selection on the supplied screen.
void BlitSurfaceRegion(int nDestX, int nDestY, WORD wImage, const RECT *pRect, DWORD dwFlags)
Draw a part of a menu image into the back buffer.
int SeasonRoundList_ClearBrowsingFlag(MenuWidget *pWidget=nullptr)
Select the current round for season previews.
int g_dwUnusedWeatherMenuValue
An unused value cleared with the menu selections.
int EnterTimeAttackMode(void)
Enter the time attack mode, first showing the menus of a finished time attack when the first vehicle ...
#define CHEAT_CODE_COUNT
The number of entries of g_aCheatCodes, with the entry that ends it.
Definition frontend.h:4683
int IsGameCdInDrive(int nDrive)
Check whether a drive contains a CD-ROM volume labelled Boss Rally.
void * g_pFrontEndScratchBuffer
A buffer of the front end, passed to FrontEndWindowProc() and not read by it.
int BuildResultsSummaryExitSeasonConfirmUI(MenuScreen *pScreen)
Build confirmation for exiting a season after the results summary.
int ShowOptionsMenu(MenuWidget *pWidget)
int ShowQuitGameConfirmMenu(MenuWidget *pWidget)
int ShowTimeAttackMenu(MenuWidget *pWidget)
Show the menu of a finished time attack, when it is not shown already.
MenuScreen * g_pRootMenuScreen
The screen the front end starts at.
int ShowAudioOptionsMenu(MenuWidget *pWidget)
bool RestoreMenuSurfaces(void)
Restore the surfaces of the loaded menu images and load their bitmaps into them again.
int ShowChampionshipSeasonMenu(MenuWidget *pWidget)
int ShowCreateGameScreen(MenuWidget *pWidget)
Show the screen that creates a network game.
int ShowInputOptionsMenu(MenuWidget *pWidget)
Open cached input options, building the screen on its first visit.
int ShowSaveSeasonScreen(MenuWidget *pWidget)
Show cached season saving, building the screen on its first visit.
int ShowKeyConfigScreen(MenuWidget *pWidget)
Open cached key configuration, building the screen on its first visit.
MenuWidget * g_pD3DDeviceSelectMenu
The menu that chooses the Direct3D device.
#define MENU_IMAGE_COUNT
The number of entries of g_aMenuImages.
Definition frontend.h:3724
ErrorMessage g_ErrorMessageTable[ERROR_MESSAGE_COUNT]
The errors of the game, indexed by the code of the error.
int DrawGameplaySliderB(MenuWidget *pWidget)
Draw the music volume slider.
int g_dwMenuScreenActivated
Whether ActivateMenuScreen() is entering the screen the game returns to.
int BuildRaceResultsSummaryUI(MenuScreen *pScreen)
Build the race-results summary screen.
#define MENU_SCREEN_PANEL_COUNT
The number of panels of a MenuScreen.
Definition frontend.h:27
int ShowVideoOptionsMenu(MenuWidget *pWidget)
Open cached video options, building the screen on its first visit.
#define SAVE_FILE_NAME_SIZE
The size of a name of a SaveFileList.
Definition frontend.h:23
MenuWidget * g_pMultiplayerGameSetupMenu
The menu of the setup of a network game.
int ShowD3DDeviceSelectMenu(MenuWidget *pWidget)
Open Direct3D device selection and populate its settings lists.
unsigned short g_wMenuImageLoadedCount
The number of entries of g_aMenuImages loaded.
int IsCarSelectable(int nCar)
Report whether a car can be chosen in the current mode of the game.
int g_dwSelectedCarClass
The chosen class of car.
int BuildOptionsMenuUI(MenuScreen *pScreen)
Build the main options menu.
int ShowMultiplayerConnectionScreen(MenuWidget *pWidget=nullptr)
Open cached connection settings, building the screen on its first visit.
#define ERROR_MESSAGE_COUNT
The number of entries of g_ErrorMessageTable.
Definition frontend.h:4828
int g_dwCheatOutroSequenceEnabled
Whether the cheat that shows the closing sequence was entered.
int ToggleMenuItemTextEditB(MenuWidget *pWidget)
Toggle text editing for the selected time-attack slot and back up its previous label.
int ShowNotEnoughPointsScreen(MenuWidget *pWidget)
Show cached championship failure results, building the screen on its first visit.
int ShowRaceResultsTotalsScreen(MenuWidget *pWidget=nullptr)
Show cached race totals, building the screen on its first visit.
int CompleteConnectionTextEdit(MenuWidget *pWidget)
Accept the edited text of a connection field.
const char g_szSpace[]
A one-space string used by menu labels and the Glide texture cache.
void Cheat_Lynette_UnlockBonusCars(void)
Unlock the bonus cars, play the sound of a cheat, and set the network menus to state 2.
int CompareDisplayModes(const void *left, const void *right)
Compare display modes by colour depth, width, then height for sorting.
int ReturnToVideoOptionsFromDeviceSelect(MenuWidget *pWidget)
Destroy device selection panels and restore the cached input configuration screen.
MenuScreen * g_pActiveMenuScreen
The screen of the front end that is showing.
#define CHEAT_INPUT_BUFFER_SIZE
The number of entries of g_anCheatInputBuffer.
Definition frontend.h:4694
MenuWidget MenuActionWidget
Common widget representation used by menu action callbacks.
Definition frontend.h:142
int BuildCreateGameMenuUI(MenuScreen *pScreen)
Build the network game-creation screen.
int BuildSeasonCongratsUI(MenuScreen *pScreen)
Build the championship congratulations screen.
int BuildRaceResultsInfoUI(MenuScreen *pScreen)
Build the race-results information screen.
MenuItemList * g_pSaveTimeAttackEditMenu
The field of the name of a saved time attack.
int g_dwLastWmCharParam
The last character the window received, or 0 once it is read.
int BuildPlayerNameEntryUI(MenuScreen *pScreen)
Build the player-name entry screen for network play.
int RestoreMenuItemTextB(MenuWidget *pWidget)
Restore the previous time-attack label when editing was active.
void ResetGameModeConfig(void)
Reset the track, the weather, the car and its settings, and the input device, to the keyboard,...
int PopulateDisplayDeviceList(void)
Populate available display devices.
bool ReleaseMenuSurfacesAndFail(HWND hWnd)
Release the surfaces of the menu images and exit the game.
int FindGameCdDrive(void)
Search CD-ROM drives for the Boss Rally disc and restore the original working directory.
int RestoreMenuItemTextA(MenuWidget *pWidget)
Restore the previous season-save label when editing was active.
int ShowDisplayModeSelectMenu(MenuWidget *pWidget)
Open display mode selection and populate its settings lists after successful creation.
void Cheat_Sophia_EnableOutroSequence(void)
Show the closing sequence, play the sound of a cheat, and set the network menus to state 2.
int OnChatMessageEdited(MenuWidget *pWidget)
Copy the edited chat text into the outgoing message buffer.
RECT g_aMenuGlyphRects[MENU_GLYPH_RECT_COUNT]
The 16 by 16 glyphs of the menus, eight to a row.
MenuWidget * g_pNetworkPlayerListMenu
The list of the players of network play.
int g_dwSelectedWeather
The chosen weather.
#define MENU_GLYPH_RECT_COUNT
The number of entries of g_aMenuGlyphRects.
Definition frontend.h:4319
int OnListDialogItemSelected(MenuWidget *pWidget)
Advance to pre-race information and discard the points dialog.
void RestoreMenuSelections(void)
Copy adwMenuSelectionBackup of g_GlobalRallyConfig and its other settings back into the choices of th...
int PopulateDisplayModeList(void)
Populate available display modes for the selected device.
int SeasonRoundList_UpdateRoundSelection(MenuWidget *pWidget)
Update the selected round from the season preview list.
int BuildMultiplayerGameSetupUI(MenuScreen *pScreen)
Build race settings for a network game.
LRESULT WINAPI FrontEndWindowProc(void *pUnused, HWND hWnd, UINT nMessage, WPARAM wParam, LPARAM lParam)
Give a message of the main window to the front end.
int BuildSeasonProgressInfoUI(MenuScreen *pScreen)
Build the current championship progress screen.
#define SAVE_FILE_NAME_COUNT
The number of names of a SaveFileList.
Definition frontend.h:21
int BuildGameOptionsUI(MenuScreen *pScreen)
Build gameplay options on the supplied screen.
void Cheat_Hazel_UnlockAllTracks(void)
Unlock every track, play the sound of a cheat, and set the network menus to state 2.
int DrawGameplaySliderA(MenuWidget *pWidget)
Draw the sound-effects volume slider.
void ProcessCheatCodeInput(void)
Add the last character the window received to the characters of the cheats, in lowercase,...
int BuildChampionshipSeasonUI(MenuScreen *pScreen)
Build the championship season-selection screen.
int ShowLoadSeasonMenu(MenuWidget *pWidget)
Show cached season loading, building the screen on its first visit.
void EnterNetworkLobbyScreen(void)
Show the lobby of network play.
#define KEY_CHARACTER_COUNT
The number of entries of g_KeyNameLookupTable.
Definition frontend.h:4860
RECT g_rcMenuCenterPanel
Bounds used for the centre panel of the multiplayer session list.
int ShowHostRaceSetupScreen(MenuWidget *pWidget)
Host a session and show the race setup of the network game.
int DetectDuplicateKeyBindings(int nDevice)
Mark repeated key bindings in the selected device's action table.
int BuildMultiplayerConnectionUI(MenuScreen *pScreen)
Build connection-provider choices on the supplied screen.
void Cheat_Brielle_UnlockBonusTracks(void)
Unlock the bonus tracks, play the sound of a cheat, and set the network menus to state 2.
MenuScreen * g_pCachedMenu_GameplaySettings
The cached screen of the settings of the game.
int BuildLoadTimeAttackMenuUI(MenuScreen *pScreen)
Build the time-attack load-slot screen.
#define MENU_ALT_GLYPH_RECT_COUNT
The number of entries of g_aMenuAltGlyphRects.
Definition frontend.h:4321
MenuScreen * g_pCachedMenu_RaceSetupNetwork
The cached screen of the setup of a network race.
NetworkMenuWidget * g_pNetworkCarSetupMenu
The menu of the setup of the car of network play.
int ShowRaceSetupMenu(MenuWidget *pWidget)
int g_dwNetworkMenuState
The state of the network menus.
int ProcessMenuTextEditInput(MenuWidget *pWidget, short nFont)
Process text entry and notify the widget when editing finishes.
int BuildRaceResultsTotalsUI(MenuScreen *pScreen)
Build the race-results totals screen.
MenuWidget * g_pModemContinueItem
The item that continues from the modem screen.
int g_anCheatInputBuffer[CHEAT_INPUT_BUFFER_SIZE]
The last characters typed for the cheats, a ring that wraps at its end.
int BuildNetworkCarSetupUI(MenuScreen *pScreen)
Build player, car, and chat controls for network car setup.
int ShowJoinCreateGameScreen(MenuWidget *pWidget)
void SetActiveMenuItemText(const char *pszText)
Set the root menu item's text when the item exists.
Rgb565Image * g_pMenuFrameSurface
The frame the menus are drawn into, the size of the frame buffer.
MenuScreen * g_pCachedMenu_Championship
The cached screen of the championship.
#define MENU_PANEL_WIDGET_COUNT
The number of widgets of a MenuPanel.
Definition frontend.h:25
bool InitializeFrontEndResources(void)
Set up the front end.
int SeasonRoundList_SetBrowsingFlag(MenuWidget *pWidget=nullptr)
Select saved-round browsing for season previews.
int BuildKeyConfigUI(MenuScreen *pScreen)
Build key configuration on the supplied screen.
int BuildPreRaceInfoUI(MenuScreen *pScreen)
Build the pre-race information screen.
int BuildNotEnoughPointsUI(MenuScreen *pScreen)
Build the insufficient-points screen after a championship race.
RECT g_aMenuAltGlyphRects[MENU_ALT_GLYPH_RECT_COUNT]
The 39 by 44 glyphs of the menus, five to a row.
int BuildQuitGameConfirmUI(MenuScreen *pScreen)
Build the confirmation screen for quitting the game.
int OnTcpIpAddressEdited(MenuWidget *pWidget)
Save the edited TCP/IP address in the game configuration.
int g_dwTrackMenuIndex
The chosen track.
int BuildPreRaceExitSeasonConfirmUI(MenuScreen *pScreen)
Build confirmation for exiting a season before a race.
int PopulateVideoSettingsLists(void)
Populate the video settings lists.
int ReturnToNetworkLobbyScreen(void)
Show the lobby of network play again after a race.
int g_dwActiveDisplayModeIndex
The entry of the list of display modes in use.
int g_dwCheatBonusTracksUnlocked
Whether the cheat that unlocks the bonus tracks was entered.
int OnSessionNameEdited(MenuWidget *pWidget)
Update the session name from the text field and enable continuing when it is nonempty.
int ShowNetworkCarSetupScreen(MenuWidget *pWidget=nullptr)
Open car setup for network play and update the host session settings.
MenuWidget NetworkMenuWidget
Common widget representation used by network menu callbacks.
Definition frontend.h:144
int BuildSaveSeasonUI(MenuScreen *pScreen)
Build the season save-slot screen.
void InitMenuSpriteRects(void)
Set the rectangles of the sprites of the menus.
int ShowModemDialUpScreen(MenuWidget *pWidget)
Open cached modem connection options, building the screen on its first visit.
int g_dwCheatBonusCarsUnlocked
Whether the cheat that unlocks the bonus cars was entered.
int BuildModemConnectionUI(MenuScreen *pScreen)
Build modem connection options on the supplied screen.
int BuildD3DDeviceSelectUI(MenuScreen *pScreen)
Build Direct3D device selection on the supplied screen.
int g_dwSelectedDisplayModeIndex
The selected row in the display-mode list, updated by Direct3D and Glide device selection.
RECT g_rcMenuNetworkPlayers
Bounds of the network player list beside the session menu.
int OnPressAnyKeyContinue(MenuWidget *pWidget)
Advance to pre-race information and reset the season totals after congratulations.
int BuildSaveTimeAttackMenuUI(MenuScreen *pScreen)
Build the time-attack save-slot screen.
int g_dwMenuSurfaceInitCount
The number of times the menu images were loaded.
int BuildCarSetupUI(MenuScreen *pScreen)
Build car selection and handling controls on the supplied screen.
int ValidateEntityState(MenuWidget *pWidget)
Update a menu item's font and sprite for its active state.
int g_dwCheatAllCarsUnlocked
Whether the cheat that unlocks every car was entered.
MenuWidget * g_pPlayerNameContinueItem
The item that continues from the name of the player.
int BuildTimeAttackMenuUI(MenuScreen *pScreen)
Build the time-attack setup screen.
int g_adwKeyBindingDuplicateFlags[KEY_CONFIG_ENTRY_COUNT]
Flags marking duplicate bindings in each key-configuration row.
int ShowSaveGhostMenu(int nUnused)
Show the menu to save the ghost car of a time attack, when it is not shown already.
int BuildInputOptionsUI(MenuScreen *pScreen)
Build input options on the supplied screen.
void CheckCheatCodeMatches(void)
Apply each cheat whose word the characters of the cheats end with.
int BuildLoadSeasonUI(MenuScreen *pScreen)
Build the saved-season selection screen.
NetworkMenuWidget * g_pNetworkSessionJoinMenu
The menu to join a network session.
bool InitMenuSurfaces(void)
Create g_pMenuFrameSurface, show the loading screen unless this is the first call,...
int RaceResultsPanel_PostUpdateRestoreSeasonProgress(void)
Restore the current season position after drawing the results panel.
int BuildRaceSetupUI(MenuScreen *pScreen)
Build track, car, and weather settings for an arcade race.
int RaceResultsPanel_PreUpdateSelectLastRace(void)
Display the previous race's season position in the results panel.
void Cheat_Benjamin_UnlockAllCars(void)
Unlock every car, play the sound of a cheat, and set the network menus to state 2.
int BuildAudioOptionsUI(MenuScreen *pScreen)
Build the CD music and volume controls on an audio options screen.
int BuildVideoOptionsUI(MenuScreen *pScreen)
Build video options on the supplied screen.
int ShowLoadGhostMenu(MenuWidget *pWidget)
void ReleaseMenuSurfaces(void)
Release the surfaces of the loaded menu images.
int ShowSeasonCongratsScreen(MenuWidget *pWidget)
Show cached championship congratulations, building the screen on its first visit.
int BuildFrontEndRootMenuUI(MenuScreen *pScreen)
Build the items of the root screen of the front end.
int ShowMultiplayerNameScreen(MenuWidget *pWidget)
RECT g_rcMenuDeviceListBox
The menu bounds of the display-device list.
int JoinSessionAndShowRaceSetup(MenuWidget *pWidget=nullptr)
int ShowSeasonProgressInfoScreen(MenuWidget *pWidget=nullptr)
Open the season progress screen with the currently selected round.
int ToggleMenuItemTextEditA(MenuWidget *pWidget)
Toggle text editing for the selected season-save slot and back up its previous label.
int ReturnToMultiplayerLobby(MenuWidget *pWidget)
Destroy the active network setup screen and restore the cached race setup.
NetworkMenuWidget * g_pJoinCreateGameMenu
The list of sessions of the screen to join or create a network game, while it exists.
int ShowCarSetupScreen(MenuWidget *pWidget)
int g_dwSessionListRefreshing
Whether the list of network sessions is refreshing.
int GetSelectedSessionGuid(GUID *guid)
Copy the selected session's instance GUID when its menu item has one.
char LookupKeyCharacter(DWORD dwKey)
The character a key of text input types.
int ShowPreRaceInfoScreen(MenuWidget *pWidget)
Show cached pre-race information and build an exit confirmation on the first visit.
int g_dwCheatInputCount
The entry of g_anCheatInputBuffer the next character fills.
int g_dwCheatAllTracksUnlocked
Whether the cheat that unlocks every track was entered.
unsigned IsTrackSelectable(int nTrack)
Report a track's selection mask or a cheat override.
int ReturnToMainMenuFromSeason(MenuWidget *pWidget)
Reset time attack choices and restore race setup after a season.
MenuWidget * g_pDisplayModeSelectMenu
The menu that chooses the display mode.
int ValidateEntityStateAlwaysTrue(MenuWidget *pWidget)
Update a menu item's active state while always accepting the update.
int g_dwSelectedSessionIndex
The index of the network session chosen in the list of sessions.
int OnModemPhoneNumberEdited(MenuWidget *pWidget)
Save the edited modem number and enable continuing when it is nonempty.
typedef DWORD
typedef HRESULT
typedef HWND
typedef LONG
typedef LPARAM
typedef LRESULT
typedef UINT
typedef WINAPI
typedef WORD
typedef WPARAM