From a64e1008385dd2eef5f44f9adb135f7644da92fd Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Sun, 4 May 2008 01:47:55 -0700 Subject: [PATCH] Removed the old menu systems. --- src/avp/avpitems.cpp | 1512 --------------------- src/avp/avpitems.hpp | 297 ----- src/avp/avppages.cpp | 1820 -------------------------- src/avp/avppages.hpp | 164 --- src/avp/database.c | 602 --------- src/avp/database.h | 72 - src/avp/menudefs.h | 258 ---- src/avp/menus.c | 816 ------------ src/avp/player.c | 13 +- src/avp/projmenu.cpp | 678 ---------- src/avp/projmenu.hpp | 273 ---- src/avp/support/consbind.cpp | 2 +- src/avp/support/rebitems.cpp | 870 ------------ src/avp/support/rebitems.hpp | 358 ----- src/avp/support/rebmenus.cpp | 1722 ------------------------ src/avp/support/rebmenus.hpp | 981 -------------- src/avp/win95/frontend/avp_intro.cpp | 1 - src/avp/win95/frontend/avp_intro.h | 11 +- src/avp/win95/intro.cpp | 359 ----- src/avp/win95/intro.hpp | 10 - src/avp/win95/menuplat.cpp | 1228 ----------------- src/avp/win95/multmenu.c | 844 ------------ src/avp/win95/pldnet.c | 1 - 23 files changed, 12 insertions(+), 12880 deletions(-) delete mode 100644 src/avp/avpitems.cpp delete mode 100644 src/avp/avpitems.hpp delete mode 100644 src/avp/avppages.cpp delete mode 100644 src/avp/avppages.hpp delete mode 100644 src/avp/database.c delete mode 100644 src/avp/database.h delete mode 100644 src/avp/menudefs.h delete mode 100644 src/avp/menus.c delete mode 100644 src/avp/projmenu.cpp delete mode 100644 src/avp/projmenu.hpp delete mode 100644 src/avp/support/rebitems.cpp delete mode 100644 src/avp/support/rebitems.hpp delete mode 100644 src/avp/support/rebmenus.cpp delete mode 100644 src/avp/support/rebmenus.hpp delete mode 100644 src/avp/win95/intro.cpp delete mode 100644 src/avp/win95/intro.hpp delete mode 100644 src/avp/win95/menuplat.cpp delete mode 100644 src/avp/win95/multmenu.c diff --git a/src/avp/avpitems.cpp b/src/avp/avpitems.cpp deleted file mode 100644 index 15ad8d8..0000000 --- a/src/avp/avpitems.cpp +++ /dev/null @@ -1,1512 +0,0 @@ -/******************************************************************* - * - * DESCRIPTION: avpitems.cpp - * - * AUTHOR: David Malcolm - * - * HISTORY: Created 30/3/98: AvP-specific menu items - * - *******************************************************************/ - -/* Includes ********************************************************/ -#include "3dc.h" - - #include "avpitems.hpp" - - #if UseRebMenus - #include "indexfnt.hpp" - #include "strtab.hpp" - #include "usr_io.h" - #include "db.h" - - #define UseLocalAssert Yes - #include "ourasert.h" - - #ifdef __WATCOMC__ - #pragma warning 139 5 - #pragma message("Disabled Warning W139") - #endif - #endif - - - -/* Version settings ************************************************/ - -/* Constants *******************************************************/ - -/* Macros **********************************************************/ - -/* Imported function prototypes ************************************/ - -/* Imported data ***************************************************/ -#ifdef __cplusplus - extern "C" - { -#endif - #if 0 - extern OurBool DaveDebugOn; - extern FDIEXTENSIONTAG FDIET_Dummy; - extern IFEXTENSIONTAG IFET_Dummy; - extern FDIQUAD FDIQuad_WholeScreen; - extern FDIPOS FDIPos_Origin; - extern FDIPOS FDIPos_ScreenCentre; - extern IFOBJECTLOCATION IFObjLoc_Origin; - extern UncompressedGlobalPlotAtomID UGPAID_StandardNull; - extern IFCOLOUR IFColour_Dummy; - extern IFVECTOR IFVec_Zero; - #endif -#ifdef __cplusplus - }; -#endif - - - -/* Exported globals ************************************************/ - -/* Internal type definitions ***************************************/ -#if UseRebMenus -namespace RebMenus -{ - namespace TextLabels - { - class Effects - { - private: - static TextID theID[KEYCONFIG_NUMITEMS]; - - public: - static TextID Get( enum KeyConfigItems in ) - { - GLOBALASSERT( in < KEYCONFIG_NUMITEMS ); - - return theID[in]; - } - }; - - class Methods - { - public: - private: - }; - }; -}; // namespace RebMenus -#endif // UseRebMenus - -/* Internal function prototypes ************************************/ - -/* Internal globals ************************************************/ -#if UseRebMenus -// static -TextID -RebMenus :: TextLabels :: Effects :: theID[KEYCONFIG_NUMITEMS] = -{ - TEXTSTRING_PCKEY_FORWARD, // KEYCONFIG_FORWARD, - TEXTSTRING_PCKEY_BACKWARD, // KEYCONFIG_BACKWARD, - TEXTSTRING_PCKEY_LEFT, // KEYCONFIG_TURN_LEFT, - TEXTSTRING_PCKEY_RIGHT, // KEYCONFIG_TURN_RIGHT, - TEXTSTRING_PCKEY_STRAFE, // KEYCONFIG_STRAFE, - TEXTSTRING_PCKEY_STRAFE_LEFT, // KEYCONFIG_STRAFE_LEFT, - TEXTSTRING_PCKEY_STRAFE_RIGHT, // KEYCONFIG_STRAFE_RIGHT, - TEXTSTRING_PCKEY_LOOK_UP, // KEYCONFIG_LOOK_UP, - TEXTSTRING_PCKEY_LOOK_DOWN, // KEYCONFIG_LOOK_DOWN, - TEXTSTRING_PCKEY_CENTRE_VIEW, // KEYCONFIG_CENTRE_VIEW, - TEXTSTRING_PCKEY_WALK, // KEYCONFIG_WALK, - TEXTSTRING_PCKEY_CROUCH, // KEYCONFIG_CROUCH, - TEXTSTRING_PCKEY_JUMP, // KEYCONFIG_JUMP, - TEXTSTRING_PCKEY_OPERATE, // KEYCONFIG_OPERATE, - TEXTSTRING_PCKEY_CHANGE_VISION, // KEYCONFIG_VISION, - TEXTSTRING_PCKEY_NEXT_WEAPON, // KEYCONFIG_NEXT_WEAPON, - TEXTSTRING_PCKEY_PREVIOUS_WEAPON, // KEYCONFIG_PREVIOUS_WEAPON, - TEXTSTRING_PCKEY_FIRE_PRIMARY, // KEYCONFIG_FIRE_PRIMARY, - TEXTSTRING_PCKEY_FIRE_SECONDARY // KEYCONFIG_FIRE_SECONDARY, -}; -#endif - -/* Exported function definitions ***********************************/ -#if UseRebMenus -/////////////////////////////////////////////////////////////////////////////// -// Project-specific item types: /////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// class Item_NetworkStatus : public Item -// Process various keypresses: -OurBool -RebMenus :: Item_NetworkStatus :: Navigate -( - enum NavigationOp // aNavOp -) -{ - // return = was message processed - - return No; -} - -void -RebMenus :: Item_NetworkStatus :: Diagnostic -( - OurBool // bSelected -) const -{ -} - - -// Methods relating to rendering: -void -RebMenus :: Item_NetworkStatus :: Render -( - const RenderContext& theContext, - OurBool // bSelected -) const -{ - #if 0 - textprintXY - ( - theContext . Pos() . x, - theContext . Pos() . y, - "Item_NetworkStatus" - ); - #endif - - IndexedFont* pFont = IndexedFont :: GetFont - ( - Fonts :: GetIndex - ( - Yes // OurBool bSelected - ) - ); - GLOBALASSERT(pFont); - - r2pos R2Pos_StartOfRow = theContext . Pos(); - - // Title row: - { - // Column title: player name - { - r2pos R2Pos_Where = R2Pos_StartOfRow; - SCString* pSCString_Name = new SCString("NAME"); - - pFont -> RenderString_Clipped - ( - R2Pos_Where, // struct r2pos& R2Pos_Cursor, - theContext . ClipRect(), // const struct r2rect& R2Rect_Clip, - (ONE_FIXED-1), // int FixP_Alpha, - *pSCString_Name // const SCString& SCStr - ); - - pSCString_Name -> R_Release(); - } - - // Column title: player species - { - r2pos R2Pos_Where = theContext . Pos_Column1(); - - SCString* pSCString_Name = new SCString("SPECIES"); - - pFont -> RenderString_Clipped - ( - R2Pos_Where, // struct r2pos& R2Pos_Cursor, - theContext . ClipRect(), // const struct r2rect& R2Rect_Clip, - (ONE_FIXED-1), // int FixP_Alpha, - *pSCString_Name // const SCString& SCStr - ); - - pSCString_Name -> R_Release(); - } - - R2Pos_StartOfRow . y += pFont -> GetHeight(); - } - - for (int i=0;i RenderString_Clipped - ( - R2Pos_Where, // struct r2pos& R2Pos_Cursor, - theContext . ClipRect(), // const struct r2rect& R2Rect_Clip, - (ONE_FIXED-1), // int FixP_Alpha, - *pSCString_Name // const SCString& SCStr - ); - - pSCString_Name -> R_Release(); - } - - // Species: - { - r2pos R2Pos_Where = R2Pos_StartOfRow; - R2Pos_Where . x += theContext . Column0_W(); - - SCString* pSCString_Species = &StringTable :: GetSCString - ( - GetTextIDForCharacterType(slotPlayerData . characterType) - ); - - pFont -> RenderString_Clipped - ( - R2Pos_Where, // struct r2pos& R2Pos_Cursor, - theContext . ClipRect(), // const struct r2rect& R2Rect_Clip, - (ONE_FIXED-1), // int FixP_Alpha, - *pSCString_Species // const SCString& SCStr - ); - - pSCString_Species -> R_Release(); - } - - // Ready to start "Ok" text: - if ( slotPlayerData . startFlag ) - { - r2pos R2Pos_Where = R2Pos_StartOfRow; - R2Pos_Where . x += theContext . Column0_W() + 150; - // hardcoded size - - SCString* pSCString_Ok = &StringTable :: GetSCString - ( - TEXTSTRING_MULTI_OK - ); - - pFont -> RenderString_Clipped - ( - R2Pos_Where, // struct r2pos& R2Pos_Cursor, - theContext . ClipRect(), // const struct r2rect& R2Rect_Clip, - (ONE_FIXED-1), // int FixP_Alpha, - *pSCString_Ok // const SCString& SCStr - ); - } - } - else - { - // Empty slot: - r2pos R2Pos_Where = R2Pos_StartOfRow; - - SCString* pSCString_EmptySlot = new SCString("--------"); - // LOCALISEME() - - pFont -> RenderString_Clipped - ( - R2Pos_Where, // struct r2pos& R2Pos_Cursor, - theContext . ClipRect(), // const struct r2rect& R2Rect_Clip, - (ONE_FIXED-1), // int FixP_Alpha, - *pSCString_EmptySlot // const SCString& SCStr - ); - - pSCString_EmptySlot -> R_Release(); - } - - R2Pos_StartOfRow . y += pFont -> GetHeight(); - } - -} - -RebMenus :: SizeInfo -RebMenus :: Item_NetworkStatus :: GetSizeInfo(void) const -{ - IndexedFont* pFont = IndexedFont :: GetFont - ( - Fonts :: GetIndex - ( - Yes // OurBool bSelected - ) - ); - GLOBALASSERT(pFont); - - int WidthPlayerName = - ( - ( - (NET_PLAYERNAMELENGTH ) - * - ( pFont -> GetMaxWidth() ) - ) - +5 // add a little spacing - ); - - int WidthSpecies = 80; - // for now - - r2size R2Size_PlayerNames - ( - // Width: - (WidthPlayerName + WidthSpecies), - - // Height: - ( - ( NET_MAXPLAYERS + 1 ) - // + 1 to allow for title row - * - ( pFont -> GetHeight() ) - ) - ); - - return SizeInfo - ( - R2Size_PlayerNames, - WidthPlayerName - ); -} - -// static -TextID -RebMenus :: Item_NetworkStatus :: GetTextIDForCharacterType -( - NETGAME_CHARACTERTYPE characterType -) -{ - switch(characterType) - { - default: GLOBALASSERT(0); // then fall through - case(NGCT_Marine): - { - return TEXTSTRING_MULTI_MARINE; - } - case(NGCT_Predator): - { - return TEXTSTRING_MULTI_PREDATOR; - } - case(NGCT_Alien): - { - return TEXTSTRING_MULTI_ALIEN; - } - } -} - - -#if 0 -typedef struct netgame_playerdata -{ - DPID playerId; - char name[NET_PLAYERNAMELENGTH]; - NETGAME_CHARACTERTYPE characterType; - int scores[NET_MAXPLAYERS]; - unsigned char startFlag; -}NETGAME_PLAYERDATA; - -typedef struct netgame_gamedata -{ - NETGAME_STATES myGameState; - NETGAME_CHARACTERTYPE myCharacterType; - unsigned char myStartFlag; - NETGAME_PLAYERDATA playerData[NET_MAXPLAYERS]; - int teamScores[NET_MAXTEAMS]; - NETGAME_TYPE gameType; - unsigned char levelNumber; - unsigned int scoreLimit; - unsigned char timeLimit; - int GameTimeElapsed; -}NETGAME_GAMEDATA; -#endif - - -#if 0 -#endif - -#if 0 - case(MMSelect_Start): - { - netGameData.myStartFlag=1; - if(AvP.Network==I_Host) - { - int myIndex; - myIndex = PlayerIdInPlayerList(AVPDPNetID); - LOCALASSERT(myIndex!=NET_IDNOTINPLAYERLIST); - netGameData.playerData[myIndex].startFlag = 1; - } - break; - } -#endif - - - -// class Item_NetworkErrorView : public Item -RebMenus :: Item_NetworkErrorView :: Item_NetworkErrorView -( -) : Item - ( - OnOffAppearance() - ) -{ -} - -RebMenus :: Item_NetworkErrorView :: ~Item_NetworkErrorView() -{ -} - -// Process various keypresses: -OurBool -RebMenus :: Item_NetworkErrorView :: Navigate -( - enum NavigationOp // aNavOp -) -{ - // return = was message processed - return No; -} - -void -RebMenus :: Item_NetworkErrorView :: Diagnostic -( - OurBool // bSelected -) const -{ - textprint("Item_NetworkErrorView :: Diagnostic()\n"); -} - - -// Methods relating to rendering: -void -RebMenus :: Item_NetworkErrorView :: Render -( - const RenderContext& theContext, - OurBool // bSelected -) const -{ - SCString* pSCString_Error = GetStringForCurrentNetworkError(); - - #if 0 - textprintXY - ( - theContext . Pos() . x, - theContext . Pos() . y, - "Item_NetworkErrorView:%s", - pSCString_Error -> pProjCh() - ); - #endif - - IndexedFont* pFont = IndexedFont :: GetFont - ( - Fonts :: GetIndex - ( - Yes // OurBool bSelected - ) - ); - GLOBALASSERT(pFont); - - r2pos R2Pos_Where = theContext . Pos(); - - pFont -> RenderString_Clipped - ( - R2Pos_Where, // struct r2pos& R2Pos_Cursor, - theContext . ClipRect(), // const struct r2rect& R2Rect_Clip, - (ONE_FIXED-1), // int FixP_Alpha, - *pSCString_Error // const SCString& SCStr - ); - - pSCString_Error -> R_Release(); -} - -RebMenus :: SizeInfo -RebMenus :: Item_NetworkErrorView :: GetSizeInfo(void) const -{ - SCString* pSCString_Error = GetStringForCurrentNetworkError(); - - SizeInfo theSizeInfo - ( - pSCString_Error -> CalcSize - ( - Fonts::GetIndex - ( - Yes // OurBool bSelected - ) - ), - 0 - ); - - pSCString_Error -> R_Release(); - - return theSizeInfo; -} - -// private: -// static -SCString* -RebMenus :: Item_NetworkErrorView :: GetStringForCurrentNetworkError(void) -{ - return &StringTable :: GetSCString - ( - GetTextIDForCurrentNetworkError() - ); -} - -// static -TextID -RebMenus :: Item_NetworkErrorView :: GetTextIDForCurrentNetworkError(void) -{ - switch(netGameData.myGameState) - { - default: LOCALASSERT(1==0); - case(NGS_Error_GameFull): - { - return TEXTSTRING_MULTI_GAMEFULL; - } - case(NGS_Error_GameStarted): - { - return TEXTSTRING_MULTI_ALREADYSTARTED; - } - case(NGS_Error_HostLost): - { - return TEXTSTRING_MULTI_CONNECTIONLOST; - } - } -} - -// class Item_VideoModeSelector : public Item -// public: -RebMenus :: Item_VideoModeSelector :: Item_VideoModeSelector -( - OnOffAppearance theOnOffApp_New -) : Item - ( - theOnOffApp_New - ) -{ -} - -// Process various keypresses: -OurBool -RebMenus :: Item_VideoModeSelector :: Navigate( enum NavigationOp aNavOp ) -{ - // return = was message processed - switch (aNavOp) - { - case NavOp_Left: - Dec(); - return Yes; - - case NavOp_Right: - case NavOp_Trigger: - Inc(); - return Yes; - } - return No; -} - -void -RebMenus :: Item_VideoModeSelector :: Diagnostic(OurBool bSelected) const -{ -} - -void -RebMenus :: Item_VideoModeSelector :: Render -( - const RenderContext& theContext, - OurBool bSelected -) const -{ - RenderAppearance - ( - theContext, - bSelected - ); - - RenderContext valueContext = theContext . NextColumn(); - - IndexedFont* pFont = IndexedFont :: GetFont - ( - Fonts :: GetIndex - ( - bSelected - ) - ); - GLOBALASSERT( pFont ); - - r2pos R2Pos_Cursor = valueContext . Pos(); - - SCString* pSCString_Value = VideoModeSelection :: DescribeCurrentSelection(); - GLOBALASSERT(pSCString_Value); - - pFont -> RenderString_Clipped - ( - R2Pos_Cursor, - valueContext . ClipRect(), - Label_FixP_Alpha, - *pSCString_Value - ); - - pSCString_Value -> R_Release(); - -} - -RebMenus :: SizeInfo -RebMenus :: Item_VideoModeSelector :: GetSizeInfo(void) const -{ - return AppearanceSizeInfo() . AddColumn - ( - SizeInfo - ( - r2size - ( - 150, - 21 - ), - 0 - ) - ); -} - -void -RebMenus :: Item_VideoModeSelector :: Dec(void) -{ - VideoModeSelection :: Dec(); -} - -void -RebMenus :: Item_VideoModeSelector :: Inc(void) -{ - VideoModeSelection :: Inc(); -} - -// class Item_KeyConfig_PageView : public Item -// public: -RebMenus :: Item_KeyConfig_PageView :: Item_KeyConfig_PageView -( - OnOffAppearance theOnOffApp_New, - int NumEffectsPerPage_New -) : Item - ( - theOnOffApp_New - ), - bDebounced(No), - NumEffectsPerPage_Val(NumEffectsPerPage_New), - NumPages_Val - ( - // total num effects divided by num effects per page, - // using an old trick to round up: - (KEYCONFIG_NUMITEMS + (NumEffectsPerPage_New-1))/ NumEffectsPerPage_New - ), - CurrentPage_Val(0) -{ - GLOBALASSERT( pSingleton == NULL ); - pSingleton = this; -} - -RebMenus :: Item_KeyConfig_PageView :: ~Item_KeyConfig_PageView() -{ - if (this == pActive) - { - pActive = NULL; - } - - GLOBALASSERT( pSingleton == this ); - pSingleton = NULL; -} - - -// Process various keypresses: -OurBool -RebMenus :: Item_KeyConfig_PageView :: Navigate( enum NavigationOp aNavOp ) -{ - GLOBALASSERT( NULL == pActive ); - - // return = was message processed - switch (aNavOp) - { - case NavOp_Up: - if (SelectionY>0) - { - SelectionY--; - return Yes; - } - else - { - return No; - } - case NavOp_Down: - if (SelectionY< GetFinalYForPage(CurrentPage_Val)) - { - SelectionY++; - return Yes; - } - else - { - return No; - } - case NavOp_Left: - case NavOp_Right: - SelectionX = 1 - SelectionX; - return Yes; - - case NavOp_Home: - SelectionY = 0; - return Yes; - - case NavOp_End: - SelectionY = GetFinalYForPage(CurrentPage_Val); - return Yes; - - case NavOp_Trigger: - // Expect input: - pActive = this; - return Yes; - - case NavOp_Cancel: - return No; - - default: GLOBALASSERT(0); - } - return No; -} - -void -RebMenus :: Item_KeyConfig_PageView :: Diagnostic(OurBool bSelected) const -{ - textprint("Item_KeyConfig_PageView :: Diagnostic():"); - - DiagnosticAppearance(bSelected); - - for (int i=0;i RenderString_Clipped - ( - R2Pos_Cursor, - theContext . ClipRect(), - Label_FixP_Alpha, - theSCString_EffectLabel - ); - - } - - // Primary method: - if - ( - ! - ( - ExpectingKey() - && - bSelected - && - (SelectionX==0) - && - (SelectionY==viewRow) - ) - - ) - { - SCString* pSCString_Method0 = GetMethodString - ( - pPrimary -> GetMethod(theEffect) - ); - - r2pos R2Pos_Cursor = R2Pos_I; - R2Pos_Cursor .x += theContext . Column0_W(); - - #if 0 - if (bSelected && (SelectionY == viewRow) && (SelectionX==0)) - { - textprintXY - ( - R2Pos_Cursor . x -20, - R2Pos_Cursor . y, - "*" - ); - } - #endif - - ( - bSelectedY && (SelectionX==0) - ? - pFont_Selected - : - pFont_Unselected - ) -> RenderString_Clipped - ( - R2Pos_Cursor, - theContext . ClipRect(), - Label_FixP_Alpha, - *pSCString_Method0 - ); - - pSCString_Method0 -> R_Release(); - } - - // Secondary method: - if - ( - ! - ( - ExpectingKey() - && - bSelected - && - (SelectionX==1) - && - (SelectionY==viewRow) - ) - ) - { - SCString* pSCString_Method1 = GetMethodString - ( - pSecondary -> GetMethod(theEffect) - ); - - r2pos R2Pos_Cursor = R2Pos_I; - R2Pos_Cursor .x += theContext . Column0_W() + 110; - - #if 0 - if (bSelected && (SelectionY == viewRow) && (SelectionX==1)) - { - textprintXY - ( - R2Pos_Cursor . x -20, - R2Pos_Cursor . y, - "*" - ); - } - #endif - - ( - bSelectedY && (SelectionX==1) - ? - pFont_Selected - : - pFont_Unselected - ) -> RenderString_Clipped - ( - R2Pos_Cursor, - theContext . ClipRect(), - Label_FixP_Alpha, - *pSCString_Method1 - ); - - pSCString_Method1 -> R_Release(); - } - - - R2Pos_I . y += theSCString_EffectLabel . CalcSize - ( - Fonts :: GetIndex - ( - bSelected - ) - ) . h; - - theSCString_EffectLabel . R_Release(); - } - } -} - -RebMenus :: SizeInfo -RebMenus :: Item_KeyConfig_PageView :: GetSizeInfo(void) const -{ - SizeInfo thisSizeInfo = AppearanceSizeInfo(); - - // Calc size as if all items were present: - for (int i=0;i=0); - GLOBALASSERT( SelectionY < KEYCONFIG_NUMITEMS ); - - - enum KeyConfigItems theEffect; - OurBool bGotEffect = GetEffectForRowOnPage - ( - SelectionY, - CurrentPage_Val, - theEffect // enum KeyConfigItems& outEffect - ); - - pConfig -> SetMethod - ( - theEffect, - theMethod - ); - - pActive = NULL; - -} - -void -RebMenus :: Item_KeyConfig_PageView :: NxtPage(void) -{ - if (CurrentPage_Val < (NumPages_Val-1)) - { - CurrentPage_Val++; - } - else - { - CurrentPage_Val=0; - } -} -void -RebMenus :: Item_KeyConfig_PageView :: PrvPage(void) -{ - if (CurrentPage_Val > 0) - { - CurrentPage_Val--; - } - else - { - CurrentPage_Val=(NumPages_Val-1); - } -} - -// static -SCString* -RebMenus :: Item_KeyConfig_PageView :: GetMethodString( unsigned char inPhysicalKey ) -{ - TextID theTextID; - - if - ( - RebMenus :: Item_KeyConfig_PageView :: GetKeyLabel - ( - inPhysicalKey, - theTextID // TextID& outTextID - ) - ) - { - return &StringTable :: GetSCString(theTextID); - } - else - { - ProjChar theProjChar[2]; - - if (inPhysicalKey >= KEY_A && inPhysicalKey <= KEY_Z) - { - theProjChar[0] = ProjChar(int(inPhysicalKey) - KEY_A + 'A'); - } - else if (inPhysicalKey >= KEY_0 && inPhysicalKey <= KEY_9) - { - theProjChar[0] = ProjChar(int(inPhysicalKey) - KEY_0 + '0'); - } - else - { - theProjChar[0] = 0; - } - - theProjChar[1] = 0; - - return new SCString(theProjChar); - } -} - -void -RebMenus :: Item_KeyConfig_PageView :: Selected_Hook -( - enum NavigationOp theNavOp -) -{ - switch (theNavOp) - { - default: GLOBALASSERT(0); - case NavOp_Up: - SelectionY = GetFinalYForPage(CurrentPage_Val); - break; - case NavOp_Down: - SelectionY = 0; - break; - case NavOp_Left: - SelectionX = 1; - break; - case NavOp_Right: - SelectionX = 0; - break; - case NavOp_Home: - SelectionY = 0; - break; - case NavOp_End: - SelectionY = GetFinalYForPage(CurrentPage_Val); - break; - case NavOp_Trigger: - break; - case NavOp_Cancel: - break; - } -} - - -// private: -// static -TextID -RebMenus :: Item_KeyConfig_PageView :: GetEffectLabel( enum KeyConfigItems inEffect) -{ - // takes an effect (e.g. jump) and returns - // a text label to use - return TextLabels :: Effects :: Get( inEffect ); -} - - -OurBool -RebMenus :: Item_KeyConfig_PageView :: GetKeyLabel -( - int inPhysicalKey, - TextID& outTextID -) -{ - // takes a physical method key and attempts to find a text - // string to use for it, returning whether it does. - // If it fails, output area is untouched - - switch (inPhysicalKey) - { - case KEY_UP: outTextID = TEXTSTRING_KEYS_UP; return Yes; - case KEY_DOWN: outTextID = TEXTSTRING_KEYS_DOWN; return Yes; - case KEY_LEFT: outTextID = TEXTSTRING_KEYS_LEFT; return Yes; - case KEY_RIGHT: outTextID = TEXTSTRING_KEYS_RIGHT; return Yes; - case KEY_CR: outTextID = TEXTSTRING_KEYS_RETURN; return Yes; - case KEY_TAB: outTextID = TEXTSTRING_KEYS_TAB; return Yes; - case KEY_INS: outTextID = TEXTSTRING_KEYS_INSERT; return Yes; - case KEY_DEL: outTextID = TEXTSTRING_KEYS_DELETE; return Yes; - case KEY_END: outTextID = TEXTSTRING_KEYS_END; return Yes; - case KEY_HOME: outTextID = TEXTSTRING_KEYS_HOME; return Yes; - case KEY_PAGEUP: outTextID = TEXTSTRING_KEYS_PGUP; return Yes; - case KEY_PAGEDOWN: outTextID = TEXTSTRING_KEYS_PGDOWN; return Yes; - case KEY_BACKSPACE: outTextID = TEXTSTRING_KEYS_BACKSP; return Yes; - case KEY_COMMA: outTextID = TEXTSTRING_KEYS_COMMA; return Yes; - case KEY_FSTOP: outTextID = TEXTSTRING_KEYS_PERIOD; return Yes; - case KEY_SPACE: outTextID = TEXTSTRING_KEYS_SPACE; return Yes; - case KEY_LMOUSE: outTextID = TEXTSTRING_KEYS_LMOUSE; return Yes; - case KEY_RMOUSE: outTextID = TEXTSTRING_KEYS_RMOUSE; return Yes; - case KEY_LEFTALT: outTextID = TEXTSTRING_KEYS_LALT; return Yes; - case KEY_RIGHTALT: outTextID = TEXTSTRING_KEYS_RALT; return Yes; - case KEY_LEFTCTRL: outTextID = TEXTSTRING_KEYS_LCTRL; return Yes; - case KEY_RIGHTCTRL: outTextID = TEXTSTRING_KEYS_RCTRL; return Yes; - case KEY_LEFTSHIFT: outTextID = TEXTSTRING_KEYS_LSHIFT; return Yes; - case KEY_RIGHTSHIFT: outTextID = TEXTSTRING_KEYS_RSHIFT; return Yes; - case KEY_CAPS: outTextID = TEXTSTRING_KEYS_CAPS; return Yes; - case KEY_NUMLOCK: outTextID = TEXTSTRING_KEYS_NUMLOCK; return Yes; - case KEY_SCROLLOK: outTextID = TEXTSTRING_KEYS_SCRLOCK; return Yes; - case KEY_NUMPAD0: outTextID = TEXTSTRING_KEYS_PAD0; return Yes; - case KEY_NUMPAD1: outTextID = TEXTSTRING_KEYS_PAD1; return Yes; - case KEY_NUMPAD2: outTextID = TEXTSTRING_KEYS_PAD2; return Yes; - case KEY_NUMPAD3: outTextID = TEXTSTRING_KEYS_PAD3; return Yes; - case KEY_NUMPAD4: outTextID = TEXTSTRING_KEYS_PAD4; return Yes; - case KEY_NUMPAD5: outTextID = TEXTSTRING_KEYS_PAD5; return Yes; - case KEY_NUMPAD6: outTextID = TEXTSTRING_KEYS_PAD6; return Yes; - case KEY_NUMPAD7: outTextID = TEXTSTRING_KEYS_PAD7; return Yes; - case KEY_NUMPAD8: outTextID = TEXTSTRING_KEYS_PAD8; return Yes; - case KEY_NUMPAD9: outTextID = TEXTSTRING_KEYS_PAD9; return Yes; - case KEY_NUMPADSUB: outTextID = TEXTSTRING_KEYS_PADSUB; return Yes; - case KEY_NUMPADADD: outTextID = TEXTSTRING_KEYS_PADADD; return Yes; - case KEY_NUMPADDEL: outTextID = TEXTSTRING_KEYS_PADDEL; return Yes; - default: return No; - } -} - -OurBool -RebMenus :: Item_KeyConfig_PageView :: GetEffectForRowOnPage -( - int inY, - int inPage, - enum KeyConfigItems& outEffect -) const - // returns truth if it can output a valid effect into the specified area -{ - GLOBALASSERT(inY>=0); - GLOBALASSERT(inY=0); - GLOBALASSERT(inPage= 0); - GLOBALASSERT( inPage < NumPages_Val ); - - if (inPage<(NumPages_Val-1)) - { - // If not the final page, it has all the rows: - return (NumEffectsPerPage_Val-1); - } - else - { - // The final page has only got the rows that remain after dealing - // with all the other pages: - int ReturnVal = - ( - (KEYCONFIG_NUMITEMS-1) - (NumEffectsPerPage_Val*inPage) - ); - - GLOBALASSERT( ReturnVal >=0 ); - GLOBALASSERT( ReturnVal < NumEffectsPerPage_Val ); - - return ReturnVal; - } -} - - -// static -RebMenus :: Item_KeyConfig_PageView* -RebMenus :: Item_KeyConfig_PageView :: pActive = NULL; - -// static -RebMenus :: Item_KeyConfig_PageView* -RebMenus :: Item_KeyConfig_PageView :: pSingleton = NULL; - - - - -unsigned char -player_input_configuration :: GetMethod( enum KeyConfigItems theEffect ) const -{ - switch (theEffect) - { - case KEYCONFIG_FORWARD: - return Forward; - case KEYCONFIG_BACKWARD: - return Backward; - case KEYCONFIG_TURN_LEFT: - return Left; - case KEYCONFIG_TURN_RIGHT: - return Right; - case KEYCONFIG_STRAFE: - return Strafe; - case KEYCONFIG_STRAFE_LEFT: - return StrafeLeft; - case KEYCONFIG_STRAFE_RIGHT: - return StrafeRight; - case KEYCONFIG_LOOK_UP: - return LookUp; - case KEYCONFIG_LOOK_DOWN: - return LookDown; - case KEYCONFIG_CENTRE_VIEW: - return CentreView; - case KEYCONFIG_WALK: - return Walk; - case KEYCONFIG_CROUCH: - return Crouch; - case KEYCONFIG_JUMP: - return Jump; - case KEYCONFIG_OPERATE: - return Operate; - case KEYCONFIG_VISION: - return ChangeVision; - case KEYCONFIG_NEXT_WEAPON: - return NextWeapon; - case KEYCONFIG_PREVIOUS_WEAPON: - return PreviousWeapon; - case KEYCONFIG_FIRE_PRIMARY: - return FirePrimaryWeapon; - case KEYCONFIG_FIRE_SECONDARY: - return FireSecondaryWeapon; - default: GLOBALASSERT(0); - return 0; - } -} - -void -player_input_configuration :: SetMethod -( - enum KeyConfigItems theEffect, - unsigned char newMethod -) -{ - switch (theEffect) - { - case KEYCONFIG_FORWARD: - Forward = newMethod; - break; - case KEYCONFIG_BACKWARD: - Backward = newMethod; - break; - case KEYCONFIG_TURN_LEFT: - Left = newMethod; - break; - case KEYCONFIG_TURN_RIGHT: - Right = newMethod; - break; - case KEYCONFIG_STRAFE: - Strafe = newMethod; - break; - case KEYCONFIG_STRAFE_LEFT: - StrafeLeft = newMethod; - break; - case KEYCONFIG_STRAFE_RIGHT: - StrafeRight = newMethod; - break; - case KEYCONFIG_LOOK_UP: - LookUp = newMethod; - break; - case KEYCONFIG_LOOK_DOWN: - LookDown = newMethod; - break; - case KEYCONFIG_CENTRE_VIEW: - CentreView = newMethod; - break; - case KEYCONFIG_WALK: - Walk = newMethod; - break; - case KEYCONFIG_CROUCH: - Crouch = newMethod; - break; - case KEYCONFIG_JUMP: - Jump = newMethod; - break; - case KEYCONFIG_OPERATE: - Operate = newMethod; - break; - case KEYCONFIG_VISION: - ChangeVision = newMethod; - break; - case KEYCONFIG_NEXT_WEAPON: - NextWeapon = newMethod; - break; - case KEYCONFIG_PREVIOUS_WEAPON: - PreviousWeapon = newMethod; - break; - case KEYCONFIG_FIRE_PRIMARY: - FirePrimaryWeapon = newMethod; - break; - case KEYCONFIG_FIRE_SECONDARY: - FireSecondaryWeapon = newMethod; - break; - default: GLOBALASSERT(0); - } -} - -#if 0 -// class Item_KeyConfig_Selector : public CompositeItem -// public: -RebMenus :: Item_KeyConfig_Selector :: Item_KeyConfig_Selector -( - OnOffAppearance theOnOffApp_New -) : CompositeItem - ( - theOnOffApp_New, // OnOffAppearance theOnOffApp_New, - D_Vert, // enum Direction theD, - Align_Centre // enum Alignment theAlignment_New - ) -{ - { - Command* pCommand = new Command_KeyConfig_PrvPage(); - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_PSXCOMPUTER_PREVIOUS), - pCommand - ); - pCommand -> R_Release(); - } - { - Command* pCommand = new Command_KeyConfig_NxtPage(); - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_PSXCOMPUTER_NEXT), - pCommand - ); - pCommand -> R_Release(); - } - // ...revise these text strings at some point -} -// private: -#endif - - -#endif - // UseRebMenus - -/* Internal function definitions ***********************************/ diff --git a/src/avp/avpitems.hpp b/src/avp/avpitems.hpp deleted file mode 100644 index d5ea4d0..0000000 --- a/src/avp/avpitems.hpp +++ /dev/null @@ -1,297 +0,0 @@ -/* - - avpitems.hpp - - AvP-specific menu items - -*/ - -#ifndef _avpitems -#define _avpitems 1 - - #if ( defined( __WATCOMC__ ) || defined( _MSC_VER ) ) - #pragma once - #endif - - #ifndef _rebmenus_hpp - #include "rebmenus.hpp" - #endif - - #if UseRebMenus - #ifndef _scstring - #include "scstring.hpp" - #endif - - #include "pcmenus.h" - - #ifndef pldnet_h_included - #include "stratdef.h" - #include "equipmnt.h" - // needed to include pldnet.h - - #include "pldnet.h" - #endif - #endif // RebMenus - - -#ifdef __cplusplus -/////////////////////////////////////////////////////////////////////////////// -// Project-specific item types: /////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Additions to the RebMenus namespace: AvP specific item types: -namespace RebMenus -{ - class Item_NetworkStatus : public Item - { - public: - Item_NetworkStatus - ( - OnOffAppearance theOnOffApp_New - ) : Item - ( - theOnOffApp_New - ) - { - } - ~Item_NetworkStatus() - { - } - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - void Diagnostic(OurBool bSelected) const; - - - // Methods relating to rendering: - void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - SizeInfo GetSizeInfo(void) const; - - static TextID GetTextIDForCharacterType - ( - NETGAME_CHARACTERTYPE characterType - ); - }; - - class Item_NetworkErrorView : public Item - { - public: - Item_NetworkErrorView(); - ~Item_NetworkErrorView(); - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - void Diagnostic(OurBool bSelected) const; - - - // Methods relating to rendering: - void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - SizeInfo GetSizeInfo(void) const; - - private: - static SCString* GetStringForCurrentNetworkError(void); - static TextID GetTextIDForCurrentNetworkError(void); - }; - - class Item_VideoModeSelector : public Item - { - public: - Item_VideoModeSelector - ( - OnOffAppearance theOnOffApp_New - ); - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - void Diagnostic(OurBool bSelected) const; - - void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - SizeInfo GetSizeInfo(void) const; - - void Dec(void); - void Inc(void); - - }; - - - class Item_KeyConfig_PageView : public Item - { - // DHM 16/3/98: I make a distinction between "methods" and "effects": - // a "method" is something you use to request an "effect" - // For example you might use the "method" of the space key to request - // the effect "jump". - - public: - Item_KeyConfig_PageView - ( - OnOffAppearance theOnOffApp_New, - int NumEffectsPerPage_New - ); - ~Item_KeyConfig_PageView(); - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - void Diagnostic(OurBool bSelected) const; - - - // Methods relating to rendering: - void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - SizeInfo GetSizeInfo(void) const; - - void SetMethod(unsigned char theMethod); - - static OurBool ExpectingKey(void) - { - // if this is set, then this class takes over input handling - return (pActive != NULL); - } - - static void Maintain(void); - - int GetPage(void) const - { - return CurrentPage_Val; - } - int GetNumPages(void) const - { - return NumPages_Val; - } - void NxtPage(void); - void PrvPage(void); - - // It's a singleton class: - static Item_KeyConfig_PageView* Get(void) - { - return pSingleton; - } - - static SCString* GetMethodString( unsigned char inPhysicalKey ); - - public: - void Selected_Hook - ( - enum NavigationOp theNavOp - ); - - - private: - static TextID GetEffectLabel( enum KeyConfigItems ); - // takes an effect (e.g. jump) and returns - // a text label to use - - static OurBool GetKeyLabel - ( - int inPhysicalKey, - TextID& outTextID - ); - // takes a physical method key and attempts to find a text - // string to use for it, returning whether it does. - // If it fails, output area is untouched - - OurBool GetEffectForRowOnPage - ( - int inY, - int inPage, - enum KeyConfigItems& outEffect - ) const; - // returns truth if it can output a valid effect into the specified area - - int GetFinalYForPage - ( - int inPage - ) const; - // Y on this page can range from 0 to this inclusive - - private: - // Selection: only meaningful if the item as a whole is selected - int SelectionX; - // range: [0,1] - - int SelectionY; - // range: [0,NumEffectsPerPage_Val) - - static Item_KeyConfig_PageView* pActive; - // iff this is non-NULL, then there's one of these expecting a key - // to change the ketboard setup; change input handling accordingly - - OurBool bDebounced; - - const int NumEffectsPerPage_Val; - const int NumPages_Val; - - int CurrentPage_Val; - // ranges from [0,NumPages_Val) - - static Item_KeyConfig_PageView* pSingleton; - - }; - - class Item_KeyConfig_Selector : public CompositeItem - { - public: - Item_KeyConfig_Selector - ( - OnOffAppearance theOnOffApp_New - ); - private: - - }; - - // Some simple command classes to embed specific function calls into buttons: - class Command_KeyConfig_PrvPage : public Command - { - public: - OurBool Execute(void) - { - Item_KeyConfig_PageView :: Get() -> PrvPage(); - - return Yes; - } - }; - class Command_KeyConfig_NxtPage : public Command - { - public: - OurBool Execute(void) - { - Item_KeyConfig_PageView :: Get() -> NxtPage(); - - return Yes; - } - }; - -}; - - - -/* End of the header ****************************************************/ -#endif // __cplusplus - - -#endif diff --git a/src/avp/avppages.cpp b/src/avp/avppages.cpp deleted file mode 100644 index dba174d..0000000 --- a/src/avp/avppages.cpp +++ /dev/null @@ -1,1820 +0,0 @@ -/******************************************************************* - * - * DESCRIPTION: avppages.cpp - * - * AUTHOR: David Malcolm - * - * HISTORY: Created 27/3/98 - * - *******************************************************************/ - -/* Includes ********************************************************/ -#include "3dc.h" - - #include "rebmenus.hpp" - - #if UseRebMenus - #include "avppages.hpp" - #include "avpitems.hpp" - - // Network code includes: - #include "dp_func.h" - - #include "stratdef.h" - #include "equipmnt.h" - // needed to include pldnet.h - - #include "pldnet.h" - - // Control config includes: - #include "usr_io.h" - - #endif // UseRebMenus - - #define UseLocalAssert Yes - #include "ourasert.h" - -/* Version settings ************************************************/ - -/* Constants *******************************************************/ - -/* Macros **********************************************************/ - -/* Imported function prototypes ************************************/ - -/* Imported data ***************************************************/ -#ifdef __cplusplus - extern "C" - { -#endif - extern int QuickStartMultiplayer; - #if 0 - - extern OurBool DaveDebugOn; - extern FDIEXTENSIONTAG FDIET_Dummy; - extern IFEXTENSIONTAG IFET_Dummy; - extern FDIQUAD FDIQuad_WholeScreen; - extern FDIPOS FDIPos_Origin; - extern FDIPOS FDIPos_ScreenCentre; - extern IFOBJECTLOCATION IFObjLoc_Origin; - extern UncompressedGlobalPlotAtomID UGPAID_StandardNull; - extern IFCOLOUR IFColour_Dummy; - extern IFVECTOR IFVec_Zero; - #endif - - extern enum TexFmt { D3TF_4BIT, D3TF_8BIT, D3TF_16BIT, D3TF_32BIT, D3TF_MAX } d3d_desired_tex_fmt; - -#ifdef __cplusplus - }; -#endif - - - -/* Exported globals ************************************************/ - -/* Internal type definitions ***************************************/ - -/* Internal function prototypes ************************************/ - -/* Internal globals ************************************************/ - -/* Exported function definitions ***********************************/ -#if UseRebMenus -/////////////////////////////////////////////////////////////////////////////// -// Projects-specific commands: access to the "menu loop": ///////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// class Command_QuitProgram : public Command -OurBool Command_QuitProgram :: Execute(void) -{ - #if OverrideOldMenus - RebMenus :: MenuLoop :: QuitProgram(); - #endif - return Yes; -} -// class Command_StartSoloGame : public Command -OurBool Command_StartSoloGame :: Execute(void) -{ - #if OverrideOldMenus - RebMenus :: MenuLoop :: StartSoloGame - ( - thePlayerType, - theStartingEnv - ); - #endif - return Yes; -} -// class Command_Multiplayer : public Command -OurBool Command_Multiplayer :: Execute(void) -{ - #if OverrideOldMenus - // Can only function outside the game: - if ( !RebMenus :: InGame :: Get()) - { - bTriggerMenuDialog = Yes; - return Yes; - } - else - { - // Merely jump to the multiplayer menu without running dialog: - RebMenus :: Page :: SelectPage(PageID_PlaceholderMultiplayer); - return Yes; - } - #else - return Yes; - #endif -} - -// Only takes effect if the flag's been set (and clears the flag) -// Triggers the multiplayer dialog boxes -#if OverrideOldMenus -// static -OurBool -Command_Multiplayer :: bTriggerMenuDialog = No; - -// static -void -Command_Multiplayer :: EndOfMenuLoopProcessing(void) -{ - // Handle post-processing in the multiplayer menu page - if - ( - ( AvP.Network != I_No_Network ) - && - (netGameData.myGameState == NGS_Joining) - ) - { - // Adapted from code in MULTMENU.C; see pp89-91 of DHM's AvP book - // (taken from RunMultiplayerStartUp() ) - - /* we are still in start-up after processing our user inputs */ - /* ... now do some checks */ - if(AvP.Network==I_Peer) - { - if(PlayerIdInPlayerList(AVPDPNetID)==NET_IDNOTINPLAYERLIST) - { - if(EmptySlotInPlayerList() == NET_NOEMPTYSLOTINPLAYERLIST) - { - /* we are not in the list, and there are no free slots: there is no room */ - TransmitPlayerLeavingNetMsg(); - netGameData.myGameState = NGS_Error_GameFull; - } - } - else - { - if(QuickStartMultiplayer || netGameData.playerData[PlayerIdInPlayerList(AVPDPNetID)].startFlag) - { - netGameData.myGameState = NGS_Playing; - } - } - - } - else - { - /* host checks for peer time-out, and game start */ - LOCALASSERT(AvP.Network==I_Host); - LOCALASSERT(PlayerIdInPlayerList(AVPDPNetID)!=NET_IDNOTINPLAYERLIST); - - if(QuickStartMultiplayer - || netGameData.playerData[PlayerIdInPlayerList(AVPDPNetID)].startFlag) - { - TransmitStartGameNetMsg(); - netGameData.myGameState = NGS_Playing; - } - } - } - - // If network game state has been changed, potentially exit the menus: - { - if ( (AvP.Network!=I_No_Network) && (netGameData.myGameState!=NGS_Joining) ) - { - // Copied/adapted from postprocessing in RunMultiplayerStartUp() - // (see p91 of DHM's AvP book#1) - - /* examine our NGS and decide what to do */ - switch(netGameData.myGameState) - { - case(NGS_Playing): - { - /* everything went ok */ - switch(netGameData.myCharacterType) - { - case(NGCT_Marine): - { - RebMenus :: MenuLoop :: StartNetworkGame - ( - I_Marine, - I_Dml1 - ); - break; - } - case(NGCT_Predator): - { - RebMenus :: MenuLoop :: StartNetworkGame - ( - I_Predator, - I_Dml1 - ); - break; - } - case(NGCT_Alien): - { - RebMenus :: MenuLoop :: StartNetworkGame - ( - I_Alien, - I_Dml1 - ); - break; - } - default: - { - LOCALASSERT(1==0); - break; - } - } - break; - } - case(NGS_Leaving): - case(NGS_EndGame): - { - EndAVPNetGame(); - RebMenus :: Page :: SelectPage( PageID_Initial ); - break; - } - case(NGS_Error_GameFull): - case(NGS_Error_GameStarted): - case(NGS_Error_HostLost): - { - EndAVPNetGame(); - RebMenus :: Page :: SelectPage( PageID_MultiplayerErrorScreen ); - break; - } - default: - { - LOCALASSERT(1==0); - EndAVPNetGame(); - RebMenus :: Page :: SelectPage( PageID_MultiplayerErrorScreen ); - break; - } - } - - } - } - - - // Possible requests to trigger the multiplayer dialog: - if ( bTriggerMenuDialog ) - { - bTriggerMenuDialog = No; - - // Adapted from code in MULTMENU.C; see pp89-91 of DHM's AvP book - AvP.Network=I_No_Network; - EndAVPNetGame(); - - InvokeDirectPlayDialog(); - - if(ProcessDirectPlayDialog()==0) - { - /* didn't connect */ - EndAVPNetGame(); - return; - } - - - /* we have successfully connected to a game...*/ - InitAVPNetGame(); - - // Jump to page: placeholder multiplayer settings - RebMenus :: Page :: SelectPage(PageID_PlaceholderMultiplayer); - } -} -#endif - // OverrideOldMenus - -// class Command_ExitCurrentGame : public Command -OurBool Command_ExitCurrentGame :: Execute(void) -{ - switch (AvP.Network) - { - default: GLOBALASSERT(0); - case I_No_Network: - break; - - case I_Host: - { - TransmitEndOfGameNetMsg(); - netGameData.myGameState = NGS_EndGame; - } - break; - - case I_Peer: - { - TransmitPlayerLeavingNetMsg(); - netGameData.myGameState = NGS_Leaving; - } - break; - } - - // go to start menu - AvP.MainLoopRunning = 0; - - RebMenus :: Page :: SelectPage_ClearingStack(PageID_Initial); - - return Yes; -} - -class Command_KeyConfig_RestoreDefaults : public Command -{ -public: - OurBool Execute(void) - { - PlayerInputPrimaryConfig = DefaultPlayerInputPrimaryConfig; - PlayerInputSecondaryConfig = DefaultPlayerInputSecondaryConfig; - return Yes; - } -}; -class Command_MouseConfig_RestoreDefaults : public Command -{ -public: - OurBool Execute(void) - { - ControlMethods = DefaultControlMethods; - return Yes; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// Export and selection variables for the menu pages: ///////////////////////// -/////////////////////////////////////////////////////////////////////////////// -namespace RebMenus -{ - // Types of export var for setting up selections that can only be changed - // outside the game loop (bounded and unbounded): - template class ExportVariable_NotInGame : public ExportVariable - { - protected: - ExportVariable_NotInGame - ( - ) : ExportVariable - ( - ) - { - } - - private: - // int Get(void) is left pure virtual - - virtual void OutOfGame_Set( T NewVal ) = 0; - - #if OverrideOldMenus - void Set - ( - T newVal - ) - { - if (RebMenus :: InGame :: Get() ) - { - // Silently reject attempts to set these within the game - return; - } - else - { - OutOfGame_Set( newVal ); - } - } - #else - void Set - ( - T // newVal - ) - { - // ignore; these menus are always in-game only - } - #endif - - private: - - }; - template class BoundedExportVariable_NotInGame : public BoundedExportVariable - { - protected: - BoundedExportVariable_NotInGame - ( - T minVal_New, - T maxVal_New - ) : BoundedExportVariable - ( - minVal_New, - maxVal_New - ) - { - } - - private: - // int Get(void) is left pure virtual - - virtual void OutOfGame_Set( T NewVal ) = 0; - - #if OverrideOldMenus - void Implement_Set - ( - T newVal - ) - { - if (RebMenus :: InGame :: Get() ) - { - // Silently reject attempts to set these within the game - return; - } - else - { - OutOfGame_Set( newVal ); - } - } - #else - void Implement_Set - ( - T // newVal - ) - { - // ignore; these menus are always in-game only - } - #endif - private: - - }; - - - /////////////////////////////////////////////////////////////////////////////// - // Export and selection variables for the network game pages: ///////////////// - /////////////////////////////////////////////////////////////////////////////// - - // A class for handling the "start network game" toggle: - class ExportVariable_StartNetworkGame : public ExportVariable - { - public: - ExportVariable_StartNetworkGame - ( - ) : ExportVariable() - { - } - - OurBool Get(void) const - { - // Better than casting? - if ( netGameData.myStartFlag ) - { - return Yes; - } - else - { - return No; - } - } - void Set(OurBool NewVal) - { - // Copied from logic in MULTMENU.C: - netGameData.myStartFlag = NewVal ? 1 : 0; - - if(AvP.Network==I_Host) - { - // Then we can use this to set the start flag in the entry for - // ourselves in the player list - int myIndex; - myIndex = PlayerIdInPlayerList(AVPDPNetID); - LOCALASSERT(myIndex!=NET_IDNOTINPLAYERLIST); - netGameData.playerData[myIndex].startFlag = 1; - } - } - }; - - class BoundedExportVariable_MultiplayerSpecies : public BoundedExportVariable - { - public: - BoundedExportVariable_MultiplayerSpecies - ( - ) : BoundedExportVariable - ( - NGCT_Marine, // T minVal_New, - NGCT_Alien // T maxVal_New - ) - { - } - - private: - int Get(void) const - { - return netGameData.myCharacterType; - } - void Implement_Set(int newVal) - { - netGameData.myCharacterType = netgame_charactertype(newVal); - - if(AvP.Network==I_Host) - { - int myIndex; - myIndex = PlayerIdInPlayerList(AVPDPNetID); - LOCALASSERT(myIndex!=NET_IDNOTINPLAYERLIST); - netGameData.playerData[myIndex].characterType = netGameData.myCharacterType; - } - } - - private: - }; - - class SelectionVariable_MultiplayerSpecies : public SelectionVariable - { - public: - SelectionVariable_MultiplayerSpecies - ( - ) : SelectionVariable - ( - new BoundedExportVariable_MultiplayerSpecies() - ) - { - } - - Appearance GetAppearance - ( - OurBool // bSelected - ) - { - return Appearance - ( - Item_NetworkStatus :: GetTextIDForCharacterType - ( - netGameData.myCharacterType - ) - ); - } - }; - - class BoundedExportVariable_MultiplayerGameMode : public BoundedExportVariable - { - public: - BoundedExportVariable_MultiplayerGameMode - ( - ) : BoundedExportVariable - ( - NGT_Individual, // T minVal_New, - NGT_Coop // T maxVal_New - ) - { - } - - private: - int Get(void) const - { - return netGameData.gameType; - } - void Implement_Set(int newVal) - { - if(AvP.Network==I_Host) - { - netGameData.gameType = netgame_type(newVal); - } - else - { - // ignore the attempt; it's not the host - } - } - private: - }; - - - class SelectionVariable_MultiplayerGameMode : public SelectionVariable - { - public: - SelectionVariable_MultiplayerGameMode - ( - ) : SelectionVariable - ( - new BoundedExportVariable_MultiplayerGameMode() - ) - { - } - - Appearance GetAppearance - ( - OurBool // bSelected - ) - { - return Appearance - ( - netGameData.gameType ? TEXTSTRING_MULTI_INDIVIDUAL : TEXTSTRING_MULTI_COOP - ); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // Export and selection variables for the video mode pages: /////////////////// - /////////////////////////////////////////////////////////////////////////////// - - // See PCMENUS.CPP - - class BoundedExportVariable_TextureBitDepth : public BoundedExportVariable_NotInGame - { - public: - BoundedExportVariable_TextureBitDepth - ( - ) : BoundedExportVariable_NotInGame - ( - 0, // T minVal_New, - 3 // T maxVal_New - ) - { - } - - private: - int Get(void) const - { - return d3d_desired_tex_fmt; - } - void OutOfGame_Set(int newVal) - { - d3d_desired_tex_fmt = (TexFmt)newVal; - } - private: - - }; - - class SelectionVariable_TextureBitDepth : public SelectionVariable - { - public: - SelectionVariable_TextureBitDepth - ( - ) : SelectionVariable - ( - new BoundedExportVariable_TextureBitDepth() - ) - { - } - - Appearance GetAppearance - ( - OurBool // bSelected - ) - { - return Appearance - ( - GetTextIDForTextureBitDepth() - ); - } - - TextID GetTextIDForTextureBitDepth(void) - { - switch(d3d_desired_tex_fmt) - { - case D3TF_4BIT: - return TEXTSTRING_PC_TEXTURES_4BIT; - break; - case D3TF_8BIT: - return TEXTSTRING_PC_TEXTURES_8BIT; - break; - case D3TF_16BIT: - return TEXTSTRING_PC_TEXTURES_16BIT; - break; - case D3TF_32BIT: - return TEXTSTRING_PC_TEXTURES_32BIT; - break; - default: - return TEXTSTRING_BLANK; - break; - - } - } - - private: - }; - - /////////////////////////////////////////////////////////////////////////////// - // Export and selection variables for the mouse options page: ///////////////// - /////////////////////////////////////////////////////////////////////////////// - class BoundedExportVariable_MouseSensitivity : public BoundedExportVariable - { - public: - BoundedExportVariable_MouseSensitivity - ( - OurBool bXAxis // else it's the y-axis - ) : bXAxis_Val(bXAxis), - BoundedExportVariable - ( - (bXAxis ? (DEFAULT_MOUSEX_SENSITIVITY-20) : (DEFAULT_MOUSEY_SENSITIVITY-40) ), // T minVal_New, - (bXAxis ? (DEFAULT_MOUSEX_SENSITIVITY+20) : (DEFAULT_MOUSEY_SENSITIVITY+40) ) // T maxVal_New - ) - { - } - - int Get(void) const - { - return - ( - (bXAxis_Val) - ? - ControlMethods.MouseXSensitivity - : - ControlMethods.MouseYSensitivity - ); - } - - private: - void Implement_Set(int NewVal) - { - if (bXAxis_Val) - { - ControlMethods.MouseXSensitivity = NewVal; - } - else - { - ControlMethods.MouseYSensitivity = NewVal; - } - } - - private: - const OurBool bXAxis_Val; - }; - - class ExportVariable_MouseAxisEffect_V : public ExportVariable - { - public: - ExportVariable_MouseAxisEffect_V - ( - ) : ExportVariable () - { - } - - OurBool Get(void) const - { - return ControlMethods.VAxisIsMovement; - } - void Set(OurBool NewVal) - { - ControlMethods.VAxisIsMovement = NewVal; - } - }; - class ExportVariable_MouseAxisEffect_H : public ExportVariable - { - public: - ExportVariable_MouseAxisEffect_H - ( - ) : ExportVariable () - { - } - - OurBool Get(void) const - { - return ControlMethods.HAxisIsTurning; - } - void Set(OurBool NewVal) - { - ControlMethods.HAxisIsTurning = NewVal; - } - }; - class ExportVariable_Mouse_FlipVertical : public ExportVariable - { - public: - ExportVariable_Mouse_FlipVertical - ( - ) : ExportVariable () - { - } - - OurBool Get(void) const - { - return ControlMethods.FlipVerticalAxis; - } - void Set(OurBool NewVal) - { - ControlMethods.FlipVerticalAxis = NewVal; - } - }; - class ExportVariable_Mouse_AutoCentre : public ExportVariable - { - public: - ExportVariable_Mouse_AutoCentre - ( - ) : ExportVariable () - { - } - - OurBool Get(void) const - { - return ControlMethods.AutoCentreOnMovement; - } - void Set(OurBool NewVal) - { - ControlMethods.AutoCentreOnMovement = NewVal; - } - }; - - -}; // namespace RebMenus - -/////////////////////////////////////////////////////////////////////////////// -// Additions to the RebMenus namespace: Derived classes for each of the menu pages: -/////////////////////////////////////////////////////////////////////////////// - -namespace RebMenus -{ - // Globals for sliders, toggles, and selections - // Note that all of these are unconnected to game effects; - // if something appears in this list, modifying it in the menus does nothing - OurBool bTest_3dAcceleration; - - int iTest_Brightness; - int iTest_SmokeParticles; - int iTest_BulletHoles; - int iTest_WaterComplexity; - int iTest_BloodParticles; - -// class Page_NoMenu : public Page - Page_NoMenu :: Page_NoMenu - ( - ) : Page - ( - Appearance(), - D_Vert, - Align_Centre, - PageID_NoMenu - ) - { - // empty - AddNewJumpItem - ( - OnOffAppearance(), - PageID_Initial - ); - } - -// class Page_Initial : public Page - Page_Initial :: Page_Initial - ( - ) : Page - ( - Appearance(), - D_Vert, - Align_Centre, - PageID_Initial - ) - { - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_MAINMENUS_NEWGAME), - PageID_ChooseCharacter - ); - - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_MAINMENUS_LOADGAME), - PageID_LoadGame - ); - - { - Command* pCommand = new Command_Multiplayer(); - - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_MAINMENUS_MULTIPLAYER), - pCommand - ); - - pCommand -> R_Release(); - } - - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_MAINMENUS_OPTIONS), - PageID_Options - ); - - #if 0 - AddUnimplementedItem - ( - OnOffAppearance(TEXTSTRING_MAINMENUS_DEMO) - ); - #endif - - { - Command* pCommand_Quit = new Command_QuitProgram(); - - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_MAINMENUS_EXIT), - pCommand_Quit - ); - - pCommand_Quit -> R_Release(); - } - - #if 0 - // Tests: - AddNewSelectionItem - ( - OnOffAppearance(), - D_Horiz - ); - - AddNewSliderItem - ( - OnOffAppearance(), - D_Horiz - ); - #endif - } - -// class Page_ChooseCharacter : public Page - Page_ChooseCharacter :: Page_ChooseCharacter - ( - ) : Page - ( - Appearance - ( - #if 0 - BitmapName("menugfx\\pg1.pg0") - #endif - ), - D_Vert, - Align_Centre, - PageID_ChooseCharacter - ) - { - #if 1 - AddNewJumpItem - ( - OnOffAppearance - ( - Appearance( BitmapName("Graphics\\NewMenus\\Alien.rim") ), - Appearance( BitmapName("Graphics\\NewMenus\\AlienDark.rim") ) - ), - PageID_AlienBriefing - ); - AddNewJumpItem - ( - OnOffAppearance - ( - Appearance( BitmapName("Graphics\\NewMenus\\Marine.rim") ), - Appearance( BitmapName("Graphics\\NewMenus\\MarineDark.rim") ) - - ), - PageID_MarineBriefing - ); - AddNewJumpItem - ( - OnOffAppearance - ( - Appearance( BitmapName("Graphics\\NewMenus\\Predator.rim") ), - Appearance( BitmapName("Graphics\\NewMenus\\PredatorDark.rim") ) - ), - PageID_PredatorBriefing - ); - #else - CompositeItem* pComposite = AddNewCompositeItem - ( - OnOffAppearance(), - D_Horiz, - Align_Centre - ); - - pComposite -> AddNewJumpItem - ( - OnOffAppearance - ( - Appearance( BitmapName("menugfx\\pg1A.pg0") ), - Appearance() - ), - PageID_AlienBriefing - ); - pComposite -> AddNewJumpItem - ( - OnOffAppearance - ( - Appearance( BitmapName("menugfx\\pg1M.pg0") ), - Appearance() - ), - PageID_MarineBriefing - ); - pComposite -> AddNewJumpItem - ( - OnOffAppearance - ( - Appearance( BitmapName("menugfx\\pg1P.pg0") ), - Appearance() - ), - PageID_PredatorBriefing - ); - #endif - - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - -// class Page_Options : public Page - Page_Options :: Page_Options - ( - ) : Page - ( - Appearance(TEXTSTRING_MAINMENUS_OPTIONS), - D_Vert, - Align_Centre, - PageID_Options - ) - { - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_OPTIONSMENU_VIDEO), - PageID_VideoOptions - ); - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_OPTIONSMENU_AUDIO), - PageID_AudioOptions - ); - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_OPTIONSMENU_INPUT), - PageID_InputOptions - ); - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - - #if 0 - TEXTSTRING_RETURNTOLASTMENU - "RETURN" - - TEXTSTRING_OPTIONSMENU_VIDEO - "VIDEO" - - TEXTSTRING_OPTIONSMENU_AUDIO - "AUDIO" - - TEXTSTRING_OPTIONSMENU_INPUT - "INPUT" - - #endif - #if 0 - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_PC_KEYCONFIG), - PageID_ConfigControls - ); - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOMAINMENU), - PageID_Initial - ); - #endif - - #if 0 - TEXTSTRING_PC_3DACCELERATION, - TEXTSTRING_PC_MICROSOFTDIRECT3D, - TEXTSTRING_PC_TEXTURES, - TEXTSTRING_PC_DISPLAY, - TEXTSTRING_PC_ZBUFFERING, - TEXTSTRING_PC_MIPMAPPING, - TEXTSTRING_PC_SHADING, - TEXTSTRING_PC_KEYCONFIG, - TEXTSTRING_PC_FLAT, - TEXTSTRING_PC_GOURAUD, - TEXTSTRING_PC_BILINEARFILTER, - TEXTSTRING_CANCEL, - TEXTSTRING_MORE, - TEXTSTRING_NO, - TEXTSTRING_YES, - TEXTSTRING_NOTAVAILABLE, - TEXTSTRING_RETURNTOMAINMENU, - #endif - - } - -// class Page_VideoOptions : public Page - Page_VideoOptions :: Page_VideoOptions - ( - ) : Page - ( - Appearance(TEXTSTRING_VIDEOOPTIONSMENU_TITLE), - D_Vert, - Align_Min, - PageID_VideoOptions - ) - { - AddNewSliderItem - ( - OnOffAppearance(TEXTSTRING_VIDEOOPTIONSMENU_BRIGHTNESS), - D_Horiz, - new SimpleBoundedExportVariable - ( - iTest_Brightness, - 0, - ONE_FIXED - ) - - ); - AddNewToggleItem - ( - OnOffAppearance(TEXTSTRING_PC_3DACCELERATION), - D_Horiz, - OnOffAppearance - ( - Appearance(TEXTSTRING_YES), - Appearance(TEXTSTRING_NO) - ), - new ExportVariable_3dAcceleration() - ); - AddNewItem_Special - ( - new Item_VideoModeSelector - ( - OnOffAppearance(TEXTSTRING_PC_DISPLAY) - ) - ); - #if 0 - /* - Disabled 1/4/98 by DHM since using it seems to crash - on loading the game with z-buffering off; I don't know if this is a - bug in the way I'm setting things, or it's that Z buffering "off" - is no longer supported somehow - (dies in first call to LoadDDGraphic, loading "blubrmr.pg0" for - marine HUD) - */ - AddNewToggleItem - ( - OnOffAppearance(TEXTSTRING_PC_ZBUFFERING), - D_Horiz, - OnOffAppearance - ( - Appearance(TEXTSTRING_YES), - Appearance(TEXTSTRING_NO) - ), - new ExportVariable_ZBuffering() - ); - #endif - AddNewSelectionItem - ( - OnOffAppearance(TEXTSTRING_PC_TEXTUREBITDEPTH), - D_Horiz, - new SelectionVariable_TextureBitDepth() - ); - - #if 0 - AddNewToggleItem - ( - OnOffAppearance(TEXTSTRING_PC_BILINEARFILTER), - D_Horiz, - OnOffAppearance - ( - Appearance(TEXTSTRING_YES), - Appearance(TEXTSTRING_NO) - ), - new ExportVariable_BilinearFiltering() - ); - AddUnimplementedItem - ( - OnOffAppearance(TEXTSTRING_PC_MIPMAPPING) - ); - AddUnimplementedItem - ( - OnOffAppearance(TEXTSTRING_PC_SHADING) - ); - #endif - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_VIDEOOPTIONSMENU_LEVELSOFDETAIL), - PageID_LevelsOfDetail - ); - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - -// class Page_AudioOptions : public Page - Page_AudioOptions :: Page_AudioOptions - ( - ) : Page - ( - Appearance(TEXTSTRING_AUDIOOPTIONSMENU_TITLE), - D_Vert, - Align_Min, - PageID_AudioOptions - ) - { - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - -// class Page_LevelsOfDetail : public Page - Page_LevelsOfDetail :: Page_LevelsOfDetail - ( - ) : Page - ( - Appearance(TEXTSTRING_VIDEOOPTIONSMENU_LEVELSOFDETAIL), - D_Vert, - Align_Min, - PageID_LevelsOfDetail - ) - { - AddNewSliderItem - ( - OnOffAppearance(TEXTSTRING_LEVELSOFDETAIL_SMOKEPARTICLES), - D_Horiz, - new SimpleBoundedExportVariable - ( - iTest_SmokeParticles, - 0, - ONE_FIXED - ) - ); - AddNewSliderItem - ( - OnOffAppearance(TEXTSTRING_LEVELSOFDETAIL_BULLETHOLES), - D_Horiz, - new SimpleBoundedExportVariable - ( - iTest_BulletHoles, - 0, - ONE_FIXED - ) - ); - AddNewSliderItem - ( - OnOffAppearance(TEXTSTRING_LEVELSOFDETAIL_WATERCOMPLEXITY), - D_Horiz, - new SimpleBoundedExportVariable - ( - iTest_WaterComplexity, - 0, - ONE_FIXED - ) - ); - AddNewSliderItem - ( - OnOffAppearance(TEXTSTRING_LEVELSOFDETAIL_BLOODPARTICLES), - D_Horiz, - new SimpleBoundedExportVariable - ( - iTest_BloodParticles, - 0, - ONE_FIXED - ) - ); - - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - -// class Page_MarineBriefing : public Page - Page_MarineBriefing :: Page_MarineBriefing - ( - ) : Page - ( - Appearance(), - D_Vert, - Align_Centre, - PageID_MarineBriefing - ) - { - { - Command* pCommand_StartSoloGame = new Command_StartSoloGame - ( - I_Marine, - I_Entrance - ); - - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_MAINMENUS_STARTGAME), - pCommand_StartSoloGame - ); - - pCommand_StartSoloGame -> R_Release(); - } - - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - -// class Page_PredatorBriefing : public Page - Page_PredatorBriefing :: Page_PredatorBriefing - ( - ) : Page - ( - Appearance(), - D_Vert, - Align_Centre, - PageID_PredatorBriefing - ) - { - { - Command* pCommand_StartSoloGame = new Command_StartSoloGame - ( - I_Predator, - I_Cmc4 - ); - - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_MAINMENUS_STARTGAME), - pCommand_StartSoloGame - ); - - pCommand_StartSoloGame -> R_Release(); - } - - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - -// class Page_AlienBriefing : public Page - Page_AlienBriefing :: Page_AlienBriefing - ( - ) : Page - ( - Appearance(), - D_Vert, - Align_Centre, - PageID_AlienBriefing - ) - { - { - Command* pCommand_StartSoloGame = new Command_StartSoloGame - ( - I_Alien, - I_Medlab - ); - - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_MAINMENUS_STARTGAME), - pCommand_StartSoloGame - ); - - pCommand_StartSoloGame -> R_Release(); - } - - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - -// class Page_LoadGame : public Page - Page_LoadGame :: Page_LoadGame - ( - ) : Page - ( - Appearance(), - D_Vert, - Align_Centre, - PageID_LoadGame - ) - { - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - -// class Page_InputOptions : public Page - Page_InputOptions :: Page_InputOptions - ( - ) : Page - ( - Appearance(TEXTSTRING_PCKEY_TITLE), - D_Vert, - Align_Centre, - PageID_InputOptions - ) - { - #if 0 - AddUnimplementedItem - ( - OnOffAppearance(TEXTSTRING_CONTROLCONFIGURATION_ALIEN) - ); - AddUnimplementedItem - ( - OnOffAppearance(TEXTSTRING_CONTROLCONFIGURATION_MARINE) - ); - AddUnimplementedItem - ( - OnOffAppearance(TEXTSTRING_CONTROLCONFIGURATION_PREDATOR) - ); - AddUnimplementedItem - ( - OnOffAppearance(TEXTSTRING_CONTROLCONFIGURATION_SHARED) - ); - AddUnimplementedItem - ( - OnOffAppearance(TEXTSTRING_SHARECONTROLCONFIGURATION) - ); - #endif - - AddNewItem_Special - ( - new Item_KeyConfig_PageView - ( - OnOffAppearance(), - 7 // int NumEffectsPerPage - ) - ); - - #if 1 - { - Command* pCommand = new Command_KeyConfig_PrvPage(); - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_PSXCOMPUTER_PREVIOUS), - pCommand - ); - pCommand -> R_Release(); - } - { - Command* pCommand = new Command_KeyConfig_NxtPage(); - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_PSXCOMPUTER_NEXT), - pCommand - ); - pCommand -> R_Release(); - } - #else - AddNewItem_Special - ( - new Item_KeyConfig_Selector - ( - OnOffAppearance() - ) - ); - #endif - - { - Command* pCommand = new Command_KeyConfig_RestoreDefaults(); - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_RESTORE_DEFAULTS), - pCommand - ); - pCommand -> R_Release(); - } - - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_MOUSE_TITLE), - PageID_MouseConfig - ); - - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - - -// class Page_ConfigMouse : public Page - Page_ConfigMouse :: Page_ConfigMouse - ( - ) : Page - ( - Appearance(TEXTSTRING_MOUSE_TITLE), - D_Vert, - Align_Min, - PageID_MouseConfig - ) - { - AddNewSliderItem - ( - OnOffAppearance(TEXTSTRING_MOUSE_XSENSITIVITY), - D_Horiz, - new BoundedExportVariable_MouseSensitivity - ( - Yes // OurBool bXAxis - ) - ); - AddNewSliderItem - ( - OnOffAppearance(TEXTSTRING_MOUSE_YSENSITIVITY), - D_Horiz, - new BoundedExportVariable_MouseSensitivity - ( - No // OurBool bXAxis - ) - ); - - AddNewToggleItem - ( - OnOffAppearance(TEXTSTRING_MOUSE_VERTICAL_AXIS), - - D_Horiz, - - OnOffAppearance - ( - Appearance(TEXTSTRING_MOUSE_MOVEMENT), - Appearance(TEXTSTRING_MOUSE_LOOKING) - ), - - new ExportVariable_MouseAxisEffect_V() - ); - AddNewToggleItem - ( - OnOffAppearance(TEXTSTRING_MOUSE_HORIZONTAL_AXIS), - - D_Horiz, - - OnOffAppearance - ( - Appearance(TEXTSTRING_MOUSE_TURNING), - Appearance(TEXTSTRING_MOUSE_SIDESTEPPING) - ), - - new ExportVariable_MouseAxisEffect_H() - ); - - AddNewToggleItem - ( - OnOffAppearance(TEXTSTRING_MOUSE_FLIP_VERTICAL), - - D_Horiz, - - OnOffAppearance - ( - Appearance(TEXTSTRING_YES), - Appearance(TEXTSTRING_NO) - ), - - new ExportVariable_Mouse_FlipVertical() - ); - AddNewToggleItem - ( - OnOffAppearance(TEXTSTRING_MOUSE_AUTO_CENTRE), - - D_Horiz, - - OnOffAppearance - ( - Appearance(TEXTSTRING_YES), - Appearance(TEXTSTRING_NO) - ), - - new ExportVariable_Mouse_AutoCentre() - ); - - { - Command* pCommand = new Command_MouseConfig_RestoreDefaults(); - AddNewCommandItem - ( - OnOffAppearance(TEXTSTRING_RESTORE_DEFAULTS), - pCommand - ); - pCommand -> R_Release(); - } - - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - -// class Page_PlaceholderMultiplayer : public Page - Page_PlaceholderMultiplayer :: Page_PlaceholderMultiplayer - ( - ) : Page - ( - Appearance(TEXTSTRING_MAINMENUS_MULTIPLAYER), - D_Vert, - Align_Min, - PageID_PlaceholderMultiplayer - ) - { - AddNewItem_Special - ( - new Item_NetworkStatus - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - // sort this out ! - ) - ); - AddNewSelectionItem - ( - OnOffAppearance(TEXTSTRING_MULTI_CHARACTER), - D_Horiz, - new SelectionVariable_MultiplayerSpecies() - ); - AddNewSelectionItem - ( - OnOffAppearance(TEXTSTRING_MULTI_GAMEMODE), - D_Horiz, - new SelectionVariable_MultiplayerGameMode() - ); - -#if 0 -TEXTSTRING_MULTI_GAMEMODE, -TEXTSTRING_MULTI_INDIVIDUAL, -TEXTSTRING_MULTI_COOP, -#endif - - AddNewToggleItem - ( - OnOffAppearance(TEXTSTRING_MULTI_START), // OnOffAppearance theOnOffApp_Label, - D_Horiz, // enum Direction initDir, - OnOffAppearance - ( - Appearance(TEXTSTRING_MULTI_OK), - Appearance(TEXTSTRING_BLANK) - ), // OnOffAppearance theOnOffApp_Choice, - new ExportVariable_StartNetworkGame() // ExportVariable* pExpVar - ); - AddNewCancelItem - ( - OnOffAppearance(TEXTSTRING_RETURNTOLASTMENU) - ); - } - -// class Page_MultiplayerErrorScreen : public Page - Page_MultiplayerErrorScreen :: Page_MultiplayerErrorScreen - ( - ) : Page - ( - Appearance(TEXTSTRING_MAINMENUS_MULTIPLAYER), - D_Vert, - Align_Centre, - PageID_MultiplayerErrorScreen - ) - { - AddNewItem_Special - ( - new Item_NetworkErrorView() - ); - AddNewJumpItem - ( - OnOffAppearance(TEXTSTRING_MULTI_CANCEL), - PageID_Initial - ); - } - - -}; // end of namespace RebMenus - - -void -RebMenus :: Page_VideoOptions :: Hook_LeavingPage(void) -{ - SaveVideoModeSettings(); - // this function also copies the currently selected mode for the - // currently selected DriverMode into a selected video mode global -} - -void -RebMenus :: Page_InputOptions :: Hook_LeavingPage(void) -{ - SaveKeyConfiguration(); -} - -void -RebMenus :: Page_PlaceholderMultiplayer :: Hook_EnteringPage(void) -{ - // Set START button to a default "off" value: - netGameData.myStartFlag = 0; - - // Leave everything else as it was (e.g. requested species, game mode, etc) -} - -void -RebMenus :: Page_PlaceholderMultiplayer :: Hook_LeavingPage(void) -{ - if (AvP.Network!=I_No_Network) - { - if ( netGameData . myGameState == NGS_Joining ) - { - if(AvP.Network==I_Host) - { - TransmitEndOfGameNetMsg(); - netGameData.myGameState=NGS_EndGame; - } - else - { - TransmitPlayerLeavingNetMsg(); - netGameData.myGameState=NGS_Leaving; - } - } - } -} - -#endif // UseRebMenus - -/* Internal function definitions ***********************************/ -#if 0 -void MouseOptionsMenu(void) -{ - int selection = 0, numSensitivities; - int exit = -1, debounce = 0; - - while (MouseXSensitivities[selection] != -1) - { - if (MouseXSensitivities[selection] == ControlMethods.MouseXSensitivity) mouseXsensitivity = selection; - selection++; - } - - selection = 0; - while (MouseYSensitivities[selection] != -1) - { - if (MouseYSensitivities[selection] == ControlMethods.MouseYSensitivity) mouseYsensitivity = selection; - selection++; - } - numSensitivities = selection; - - selection = 0; - - while (exit == -1) - { - // JCWH 18/02/98: allow ALT+TAB - CheckForWindowsMessages(); - - DrawMouseOptionsScreen(selection); - - /* Deal with moving the selected item */ - ReadUserInput(); - - if (IDemandGoForward() && debounce) - { - debounce = 0; - selection--; - if (selection < 0) selection = MOUSECONFIG_NUMITEMS - 1; - } - else if (IDemandGoBackward() && debounce) - { - debounce = 0; - selection++; - if (selection >= MOUSECONFIG_NUMITEMS) selection = 0; - } - else if (IDemandTurnRight() && debounce) - { - debounce = 0; - /* Execute appropriate action */ - - if (selection == MOUSECONFIG_VAXIS) ControlMethods.VAxisIsMovement = 1 - ControlMethods.VAxisIsMovement; - else if (selection == MOUSECONFIG_HAXIS) ControlMethods.HAxisIsTurning = 1 - ControlMethods.HAxisIsTurning; - else if (selection == MOUSECONFIG_FLIPVERTICAL) ControlMethods.FlipVerticalAxis = 1 - ControlMethods.FlipVerticalAxis; - else if (selection == MOUSECONFIG_AUTOCENTRE) ControlMethods.AutoCentreOnMovement = 1 - ControlMethods.AutoCentreOnMovement; - else if (selection == MOUSECONFIG_XSENSITIVITY) - { - mouseXsensitivity++; - if (mouseXsensitivity >= numSensitivities) mouseXsensitivity = numSensitivities - 1; - } - else if (selection == MOUSECONFIG_YSENSITIVITY) - { - mouseYsensitivity++; - if (mouseYsensitivity >= numSensitivities) mouseYsensitivity = numSensitivities - 1; - } - } - else if (IDemandTurnLeft() && debounce) - { - debounce = 0; - /* ditto */ - - if (selection == MOUSECONFIG_VAXIS) ControlMethods.VAxisIsMovement = 1 - ControlMethods.VAxisIsMovement; - else if (selection == MOUSECONFIG_HAXIS) ControlMethods.HAxisIsTurning = 1 - ControlMethods.HAxisIsTurning; - else if (selection == MOUSECONFIG_FLIPVERTICAL) ControlMethods.FlipVerticalAxis = 1 - ControlMethods.FlipVerticalAxis; - else if (selection == MOUSECONFIG_AUTOCENTRE) ControlMethods.AutoCentreOnMovement = 1 - ControlMethods.AutoCentreOnMovement; - else if (selection == MOUSECONFIG_XSENSITIVITY) - { - mouseXsensitivity--; - if (mouseXsensitivity < 0) mouseXsensitivity = 0; - } - else if (selection == MOUSECONFIG_YSENSITIVITY) - { - mouseYsensitivity--; - if (mouseYsensitivity < 0) mouseYsensitivity = 0; - } - } - else if (IDemandSelect() && debounce) - { - debounce = 0; - - if (selection == MOUSECONFIG_NUMITEMS - 1) - { - /* Exit item */ - exit = 1; - } - } - - if ((!IDemandGoForward()) && (!IDemandGoBackward()) && - (!IDemandTurnLeft()) && (!IDemandTurnRight()) && - (!IDemandSelect()) ) debounce = 1; - } - - ControlMethods.MouseXSensitivity = MouseXSensitivities[mouseXsensitivity]; - ControlMethods.MouseYSensitivity = MouseYSensitivities[mouseYsensitivity]; - -} -#endif \ No newline at end of file diff --git a/src/avp/avppages.hpp b/src/avp/avppages.hpp deleted file mode 100644 index 6a6a76f..0000000 --- a/src/avp/avppages.hpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - - avppages.hpp - -*/ - -#ifndef _avppages -#define _avppages 1 - - #if ( defined( __WATCOMC__ ) || defined( _MSC_VER ) ) - #pragma once - #endif - - #ifndef _rebmenus_hpp - #include "rebmenus.hpp" - #endif - -#if UseRebMenus -class Command_QuitProgram : public Command -{ -public: - Command_QuitProgram() : Command() - { - } - OurBool Execute(void); -}; - -class Command_StartSoloGame : public Command -{ -public: - Command_StartSoloGame - ( - I_PLAYER_TYPE inPlayerType, - I_AVP_ENVIRONMENTS inStartingEnv - ) : Command(), - thePlayerType(inPlayerType), - theStartingEnv(inStartingEnv) - { - } - OurBool Execute(void); -private: - const I_PLAYER_TYPE thePlayerType; - const I_AVP_ENVIRONMENTS theStartingEnv; -}; - -class Command_Multiplayer : public Command -{ -public: - Command_Multiplayer() : Command() - { - } - OurBool Execute(void); - - // Only takes effect if the flag's been set (and clears the flag) - // Triggers the multiplayer dialog boxes - static void EndOfMenuLoopProcessing(void); - -private: - static OurBool bTriggerMenuDialog; -}; - -class Command_ExitCurrentGame : public Command -{ -public: - Command_ExitCurrentGame() : Command() - { - } - - OurBool Execute(void); -}; - -namespace RebMenus -{ - class Page_NoMenu : public Page - { - public: - Page_NoMenu(); - }; - class Page_Initial : public Page - { - public: - Page_Initial(); - }; - class Page_ChooseCharacter : public Page - { - public: - Page_ChooseCharacter(); - }; - class Page_Options : public Page - { - public: - Page_Options(); - }; - class Page_VideoOptions : public Page - { - public: - Page_VideoOptions(); - private: - void Hook_LeavingPage(void); - }; - class Page_AudioOptions : public Page - { - public: - Page_AudioOptions(); - }; - class Page_LevelsOfDetail : public Page - { - public: - Page_LevelsOfDetail(); - }; - class Page_MarineBriefing : public Page - { - public: - Page_MarineBriefing(); - }; - class Page_PredatorBriefing : public Page - { - public: - Page_PredatorBriefing(); - }; - class Page_AlienBriefing : public Page - { - public: - Page_AlienBriefing(); - }; - class Page_LoadGame : public Page - { - public: - Page_LoadGame(); - }; - class Page_InputOptions : public Page - { - public: - Page_InputOptions(); - private: - void Hook_LeavingPage(void); - }; - class Page_ConfigMouse : public Page - { - public: - Page_ConfigMouse(); - }; - class Page_PlaceholderMultiplayer : public Page - { - public: - Page_PlaceholderMultiplayer(); - private: - void Hook_EnteringPage(void); - void Hook_LeavingPage(void); - }; - class Page_MultiplayerErrorScreen : public Page - { - public: - Page_MultiplayerErrorScreen(); - }; -}; // namespace RebMenus -#endif // UseRebMenus - - -/* End of the header ****************************************************/ - - - -#endif diff --git a/src/avp/database.c b/src/avp/database.c deleted file mode 100644 index 8e51667..0000000 --- a/src/avp/database.c +++ /dev/null @@ -1,602 +0,0 @@ -#include "3dc.h" -#include "module.h" - -#include "stratdef.h" -#include "gamedef.h" - -#include "equipmnt.h" -#include "saveload.h" -#include "font.h" -#include "database.h" - -#include "svldplat.h" - -#define UseLocalAssert Yes -#include "ourasert.h" -// extern old movement functions - -extern int IDemandGoForward(); -extern int IDemandSelect(); -extern int IDemandGoBackward(); -extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; - -extern void LoadDatabaseMessage(void); -extern void UnloadDatabaseMessage(void); -extern void WriteDatabaseMessage(void); - - -unsigned char *GetTextForMenuOption(enum DB_MENUOPTION_ID optionID); -#if 0 - -struct MenuOptionDescriptor MenuOptionData[MAX_NO_OF_DB_MENUOPTIONS] = -{ - {145,40,FJ_CENTRED}, /* DB_MENUOPTION_RESUME*/ - {145,60,FJ_CENTRED}, /* DB_MENUOPTION_OPTIONS*/ - {145,80,FJ_CENTRED}, /*DB_MENUOPTION_MISSION*/ - {145,100,FJ_CENTRED},/* DB_MENUOPTION_LOAD, */ - {145,120,FJ_CENTRED},/* DB_MENUOPTION_SAVE, */ - {145,140,FJ_CENTRED},/* DB_MENUOPTION_QUIT, */ - {145,80,FJ_CENTRED}, /*DB_MENUOPTION_YESQUIT*/ - {145,100,FJ_CENTRED},/*DB_MENUOPTION_NO*/ - {237,150,FJ_CENTRED},/* DB_MENUOPTION_GOBACK, */ - {125,90,FJ_CENTRED},/* DB_MENUOPTION_ACCESSDENIED */ - {30,30,FJ_LEFT_JUST},/*SLOT0*/ - {30,45,FJ_LEFT_JUST},/*SLOT1*/ - {30,60,FJ_LEFT_JUST},/*SLOT2*/ - {30,75,FJ_LEFT_JUST},/*SLOT3*/ - {30,90,FJ_LEFT_JUST},/*SLOT4*/ - {30,105,FJ_LEFT_JUST},/*SLOT5*/ - {30,120,FJ_LEFT_JUST},/*SLOT6*/ - {30,135,FJ_LEFT_JUST},/*SLOT7*/ -}; -#else -struct MenuOptionDescriptor MenuOptionData[MAX_NO_OF_DB_MENUOPTIONS] = -{ - {0,(ONE_FIXED*4)/32,FJ_CENTRED}, /* DB_MENUOPTION_RESUME*/ - {0,(ONE_FIXED*7)/32,FJ_CENTRED}, /* DB_MENUOPTION_OPTIONS*/ - {0,(ONE_FIXED*10)/32,FJ_CENTRED}, /* DB_MENUOPTION_MISSION*/ - {0,(ONE_FIXED*13)/32,FJ_CENTRED}, /* DB_MENUOPTION_LOAD, */ - {0,(ONE_FIXED*16)/32,FJ_CENTRED}, /* DB_MENUOPTION_SAVE, */ - {0,(ONE_FIXED*19)/32,FJ_CENTRED}, /* DB_MENUOPTION_QUIT, */ - {0,(ONE_FIXED*10)/32,FJ_CENTRED}, /* DB_MENUOPTION_YESQUIT*/ - {0,(ONE_FIXED*13)/32,FJ_CENTRED}, /* DB_MENUOPTION_NO*/ - {0,(ONE_FIXED*16)/32,FJ_CENTRED}, /* DB_MENUOPTION_STARTMENU*/ - {0,(ONE_FIXED*29)/32,FJ_CENTRED}, /* DB_MENUOPTION_GOBACK, */ - {0,(ONE_FIXED*16)/32,FJ_CENTRED}, /* DB_MENUOPTION_ACCESSDENIED */ - {(ONE_FIXED*1)/32,(ONE_FIXED*4)/32,FJ_LEFT_JUST}, /*SLOT0*/ - {(ONE_FIXED*1)/32,(ONE_FIXED*7)/32,FJ_LEFT_JUST}, /*SLOT1*/ - {(ONE_FIXED*1)/32,(ONE_FIXED*10)/32,FJ_LEFT_JUST}, /*SLOT2*/ - {(ONE_FIXED*1)/32,(ONE_FIXED*13)/32,FJ_LEFT_JUST}, /*SLOT3*/ - {(ONE_FIXED*1)/32,(ONE_FIXED*16)/32,FJ_LEFT_JUST}, /*SLOT4*/ - {(ONE_FIXED*1)/32,(ONE_FIXED*19)/32,FJ_LEFT_JUST}, /*SLOT5*/ - {(ONE_FIXED*1)/32,(ONE_FIXED*22)/32,FJ_LEFT_JUST}, /*SLOT6*/ - {(ONE_FIXED*1)/32,(ONE_FIXED*25)/32,FJ_LEFT_JUST}, /*SLOT7*/ -}; -#endif - - -/* KJL 13:09:25 03/17/97 - to be rewritten after alpha */ - -unsigned char *TestMenuOptionText[] = -{ -"RESUME", -"OPTIONS", -"MISSION", -"LOAD", -"SAVE", -"QUIT", -"QUIT TO WINDOWS", -"RESUME", -"QUIT TO START MENU", -"BACK", -"ACCESS DENIED", -"1:", -"2:", -"3:", -"4:", -"5:", -"6:", -"7:", -"8:", -}; - - - -static int NumberOfCurrentDbOptions; -static enum DB_MENUOPTION_ID CurrentDbOptions[MAX_NO_OF_DB_MENUOPTIONS]; -static struct DatabaseInput DatabaseInput={0,0,0}; - -static enum DB_STATE_ID CurrentState; -static int DBStateHasChanged; - -void SetupDatabaseState(enum DB_STATE_ID stateID); -void ClearMenuOptions(void); -void AddMenuOption(enum DB_MENUOPTION_ID optionID); -void ActUponChosenOption(enum DB_MENUOPTION_ID optionID); -enum DB_MENUOPTION_ID DisplayCurrentDatabaseState(enum DB_STATE_ID stateID); -void LoadGraphicsForDatabaseState(enum DB_STATE_ID stateID); -void UnloadGraphicsForDatabaseState(enum DB_STATE_ID stateID); -void DrawSpecialGraphicsForState(enum DB_STATE_ID stateID); - -/* fns that should be platform specific but aren't yet */ -void GetDatabaseInput(void); -void DrawDatabaseMenuOption(enum DB_MENUOPTION_ID optionID, int highlighted); -void DrawDatabaseTextString(unsigned char *textPtr, int x, int y, FONT_JUST justification, int highlighted); -unsigned char *GetTextForMenuOption(enum DB_MENUOPTION_ID optionID); - -void AccessDatabase(int databaseID) -{ - CurrentState = DB_STATE_MAINMENU; - - PlatformSpecificEnteringDatabase(); - - /* database main loop */ - while(CurrentState != DB_STATE_RESUME) - { - enum DB_MENUOPTION_ID chosenOption; - - /* load gfx and setup menu options for current state */ - SetupDatabaseState(CurrentState); - - /* display state and let user select option */ - chosenOption = DisplayCurrentDatabaseState(CurrentState); - - /* kill gfx for current state */ - UnloadGraphicsForDatabaseState(CurrentState); - - /* act upon chosen option, which usually changes state */ - ActUponChosenOption(chosenOption); - } - - PlatformSpecificExitingDatabase(); -} - -void SetupDatabaseState(enum DB_STATE_ID stateID) -{ - LoadGraphicsForDatabaseState(stateID); - - ClearMenuOptions(); - - switch (stateID) - { - case DB_STATE_MAINMENU: - { - AddMenuOption(DB_MENUOPTION_RESUME); - AddMenuOption(DB_MENUOPTION_OPTIONS); - AddMenuOption(DB_MENUOPTION_MISSION); - AddMenuOption(DB_MENUOPTION_LOAD); - AddMenuOption(DB_MENUOPTION_SAVE); - AddMenuOption(DB_MENUOPTION_QUIT); - break; - } - case DB_STATE_OPTIONS: - { - AddMenuOption(DB_MENUOPTION_GOBACK); - break; - } - case DB_STATE_QUIT: - { - AddMenuOption(DB_MENUOPTION_MAINMENU); - AddMenuOption(DB_MENUOPTION_YESQUIT); - AddMenuOption(DB_MENUOPTION_NO); - break; - } - case DB_STATE_MISSION: - { - AddMenuOption(DB_MENUOPTION_GOBACK); - break; - } - case DB_STATE_LOAD: - { - AddMenuOption(DB_MENUOPTION_SAVESLOT0); - AddMenuOption(DB_MENUOPTION_SAVESLOT1); - AddMenuOption(DB_MENUOPTION_SAVESLOT2); - AddMenuOption(DB_MENUOPTION_SAVESLOT3); - AddMenuOption(DB_MENUOPTION_SAVESLOT4); - AddMenuOption(DB_MENUOPTION_SAVESLOT5); - AddMenuOption(DB_MENUOPTION_SAVESLOT6); - AddMenuOption(DB_MENUOPTION_SAVESLOT7); - AddMenuOption(DB_MENUOPTION_GOBACK); - - break; - } - case DB_STATE_SAVE: - { - AddMenuOption(DB_MENUOPTION_SAVESLOT0); - AddMenuOption(DB_MENUOPTION_SAVESLOT1); - AddMenuOption(DB_MENUOPTION_SAVESLOT2); - AddMenuOption(DB_MENUOPTION_SAVESLOT3); - AddMenuOption(DB_MENUOPTION_SAVESLOT4); - AddMenuOption(DB_MENUOPTION_SAVESLOT5); - AddMenuOption(DB_MENUOPTION_SAVESLOT6); - AddMenuOption(DB_MENUOPTION_SAVESLOT7); - AddMenuOption(DB_MENUOPTION_GOBACK); - - break; - } - case DB_STATE_ACCESSDENIED: - { - AddMenuOption(DB_MENUOPTION_ACCESSDENIED); - break; - } - - - default: - { - /* not a valid state, assert */ - LOCALASSERT(0); - break; - } - } -} - - -void ClearMenuOptions(void) -{ - NumberOfCurrentDbOptions=0; -} - - -void AddMenuOption(enum DB_MENUOPTION_ID optionID) -{ - CurrentDbOptions[NumberOfCurrentDbOptions] = optionID; - NumberOfCurrentDbOptions++; -} - - -void ActUponChosenOption(enum DB_MENUOPTION_ID optionID) -{ - switch (optionID) - { - case DB_MENUOPTION_RESUME: - { - CurrentState = DB_STATE_RESUME; - DBStateHasChanged = 1; - break; - } - case DB_MENUOPTION_OPTIONS: - { - CurrentState = DB_STATE_ACCESSDENIED; - DBStateHasChanged = 1; - break; - } - case DB_MENUOPTION_MISSION: - { - CurrentState = DB_STATE_MISSION; - DBStateHasChanged = 1; - break; - } - case DB_MENUOPTION_LOAD: - { - CurrentState = DB_STATE_LOAD; -// LoadGameFromFile(); - break; - } - case DB_MENUOPTION_SAVE: - { - CurrentState = DB_STATE_SAVE; -// SaveGameToFile(); - break; - } - case DB_MENUOPTION_NO: - case DB_MENUOPTION_GOBACK: - case DB_MENUOPTION_ACCESSDENIED: - { - /* return to main menu */ - CurrentState = DB_STATE_MAINMENU; - DBStateHasChanged = 1; - break; - } - case DB_MENUOPTION_SAVESLOT0: - case DB_MENUOPTION_SAVESLOT1: - case DB_MENUOPTION_SAVESLOT2: - case DB_MENUOPTION_SAVESLOT3: - case DB_MENUOPTION_SAVESLOT4: - case DB_MENUOPTION_SAVESLOT5: - case DB_MENUOPTION_SAVESLOT6: - case DB_MENUOPTION_SAVESLOT7: - { - if(DB_STATE_LOAD == CurrentState) - { - LoadSaveSlot(optionID - DB_MENUOPTION_SAVESLOT0); - } - - if(DB_STATE_SAVE == CurrentState) - { - SaveSaveSlot(optionID - DB_MENUOPTION_SAVESLOT0); - } - - CurrentState = DB_STATE_RESUME; - break; - } - case DB_MENUOPTION_QUIT: - { - CurrentState = DB_STATE_QUIT; - DBStateHasChanged = 1; - break; - } - case DB_MENUOPTION_YESQUIT: - { - ExitSystem(); - exit(0); - } - case DB_MENUOPTION_MAINMENU: - { - AvP.MainLoopRunning = 0; - CurrentState = DB_STATE_RESUME; - break; - } - default: - { - /* invalid option */ - LOCALASSERT(0); - break; - } - } -} - - -static int selectedOption; - -enum DB_MENUOPTION_ID DisplayCurrentDatabaseState(enum DB_STATE_ID stateID) -{ - int selectionNotMade = 1; - - selectedOption = 0; - - LOCALASSERT(NumberOfCurrentDbOptions != 0); - - do - { - // JCWH 18/02/98: allow ALT+TAB - CheckForWindowsMessages(); - - /* draw background */ - DrawDatabaseBackground(); - - /* draw weapons, maps etc. as required */ - DrawSpecialGraphicsForState(stateID); - - /* draw all menu options */ - { - int o; - for (o=0; o 0) - { - *(game_name + i) = 0; - } - - i = NUM_SAVE_SLOTS; - - - while(i-- >0) - { - FONT_DESC packet; - int posx, posy; - AVP_FONTS font_num = DATABASE_FONT_DARK; - - - j = GAME_NAME_LENGTH; - - while(j-- > 0) - { - *(game_name + j) = 0; - } - - - ReadSaveSlotGameName(i, game_name); - - posx = ((MenuOptionData[i + DB_MENUOPTION_SAVESLOT0].X*ScreenDescriptorBlock.SDB_Width) >> 16) + 20; - posy = ((MenuOptionData[i + DB_MENUOPTION_SAVESLOT0].Y*ScreenDescriptorBlock.SDB_Height) >> 16); - - if(selectedOption == i) - { - font_num = DATABASE_FONT_LITE; - } - - - packet.fontnum = font_num; - packet.string = game_name; - packet.destx = posx; - packet.desty = posy; - packet.just = FJ_LEFT_JUST; - packet.width = ScreenDescriptorBlock.SDB_Width; - - BLTString(packet); - - } - } - -} - -/* platform specific fns */ - - - -static int debounced = 0; -void GetDatabaseInput(void) -{ - ReadUserInput(); - - DatabaseInput.RequestSelectItem = 0; - DatabaseInput.RequestPreviousItem = 0; - DatabaseInput.RequestNextItem = 0; - - if (IDemandSelect()) - { - if (debounced) - { - DatabaseInput.RequestSelectItem =1; - debounced = 0; - } - } - else if (IDemandGoBackward()) - { - if (debounced) - { - DatabaseInput.RequestNextItem =1; - debounced = 0; - } - } - else if (IDemandGoForward()) - { - if (debounced) - { - DatabaseInput.RequestPreviousItem =1; - debounced = 0; - } - } - else - { - debounced=1; - } - -} - -void DrawDatabaseMenuOption(enum DB_MENUOPTION_ID optionID, int highlighted) -{ - unsigned char *textPtr = GetTextForMenuOption(optionID); - - DrawDatabaseTextString - ( - textPtr, - MenuOptionData[optionID].X, - MenuOptionData[optionID].Y, - MenuOptionData[optionID].justification, - highlighted - ); -} - - -void DrawDatabaseTextString -( - unsigned char *textPtr, - int x, - int y, - FONT_JUST justification, - int highlighted) -{ - FONT_DESC packet; - if (highlighted) packet.fontnum = DATABASE_FONT_LITE; - else packet.fontnum = DATABASE_FONT_DARK; - - packet.string = textPtr; - packet.destx = (x*ScreenDescriptorBlock.SDB_Width) >>16; - packet.desty = (y*ScreenDescriptorBlock.SDB_Height) >>16; - packet.just = justification; - packet.width = ScreenDescriptorBlock.SDB_Width; - - BLTString(packet); -} - - - - - - - - - - -unsigned char *GetTextForMenuOption(enum DB_MENUOPTION_ID optionID) -{ - return TestMenuOptionText[optionID]; -} - - -int DatabaseStateChange() -{ - if(DBStateHasChanged) - { - DBStateHasChanged = 0; - - return 1; - } - - return 0; -} \ No newline at end of file diff --git a/src/avp/database.h b/src/avp/database.h deleted file mode 100644 index 81f82b6..0000000 --- a/src/avp/database.h +++ /dev/null @@ -1,72 +0,0 @@ - -#define NUM_SAVE_SLOTS 10 - -enum DB_STATE_ID -{ - DB_STATE_MAINMENU, - DB_STATE_QUIT, - DB_STATE_OPTIONS, - DB_STATE_MISSION, - DB_STATE_LOAD, - DB_STATE_SAVE, - DB_STATE_RESUME, - DB_STATE_ACCESSDENIED, - - MAX_NO_OF_DB_STATES -}; - -enum DB_MENUOPTION_ID -{ - DB_MENUOPTION_RESUME, - DB_MENUOPTION_OPTIONS, - DB_MENUOPTION_MISSION, - DB_MENUOPTION_LOAD, - DB_MENUOPTION_SAVE, - DB_MENUOPTION_QUIT, - DB_MENUOPTION_YESQUIT, - DB_MENUOPTION_NO, - DB_MENUOPTION_MAINMENU, - DB_MENUOPTION_GOBACK, - DB_MENUOPTION_ACCESSDENIED, - DB_MENUOPTION_SAVESLOT0, - DB_MENUOPTION_SAVESLOT1, - DB_MENUOPTION_SAVESLOT2, - DB_MENUOPTION_SAVESLOT3, - DB_MENUOPTION_SAVESLOT4, - DB_MENUOPTION_SAVESLOT5, - DB_MENUOPTION_SAVESLOT6, - DB_MENUOPTION_SAVESLOT7, - - MAX_NO_OF_DB_MENUOPTIONS -}; - - -struct DatabaseInput -{ - unsigned char RequestSelectItem :1; - unsigned char RequestPreviousItem :1; - unsigned char RequestNextItem :1; -}; - -struct MenuOptionDescriptor -{ - /* top-left coords */ - int X; - int Y; - FONT_JUST justification; -}; - - - - -extern void AccessDatabase(int databaseID); - -/* KJL 15:43:16 04/11/97 - platform specific */ -extern void PlatformSpecificEnteringDatabase(void); -extern void PlatformSpecificExitingDatabase(void); - -extern void DrawDatabaseBackground(void); - -extern void UpdateDatabaseScreen(void); - -extern int DatabaseStateChange(); diff --git a/src/avp/menudefs.h b/src/avp/menudefs.h deleted file mode 100644 index 77c8155..0000000 --- a/src/avp/menudefs.h +++ /dev/null @@ -1,258 +0,0 @@ -#ifndef _included_menudefs_h_ -#define _included_menudefs_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/***** Menudefs.h - CDF 22/10/96 *****/ - -/* Welcome to the menus system. Here are - some globals that seemed useful. */ - -extern int GlobalLanguage; -extern int PlayerCharacter; -extern int LoadGame; - -extern int CurrentMenuStatus[]; - -/* PlayerCharacter is what character you are, - according to the AVP_PLAYER_TYPES enum. - GlobalLanguage is what language the game - should be in, as per the LANGUAGE_MENU_ITEMS - enum below. :-). - CurrentMenuStatus I'll come to in a minute. - - There are also some enums at the bottom of - this file, but I'll come to them in a minute. - -*/ - -/*-------------------------------------------*/ - -/* Your mission, should you decide to accept - it, is to implement the following functions:*/ - -extern void ChooseLanguageMenu(void); - -extern int StartUpMenus(void); - -/* Well, not those two. They call the menu - system. Place them in main.c as you see fit.*/ - -extern void PlatformSpecificEnteringMenus(); -extern void PlatformSpecificExitingMenus(); - -#if PSX -extern int PsxOptionsMenu(int state); -#endif - -/* Those functions I need, so they're here. - Non-playstation coders, feel free to leave - them empty. They should at least be callable - multiple times without messing up. */ - -extern void LoadMenuGraphics(int menu_id); -extern void UnLoadMenuGraphics(int menu_id); - -/* Should load all the graphics for a menu: - menu_id refers to the START_MENU_STATES - enum at the foot of this file. I also - use it to set a (platform specific) - global pointer, Current_Menu, used by...*/ - -extern void DrawEntireMenuScreen(void); - -/* This should sweep the CurrentMenuStatus[] - array. Each entry corresponds to an item - on that menu screen according to the appropriate - enum, and can (at time of writing) be - either 0 (unlit), 1 (lit) or -1 (terminator): - e.g. CurrentMenuStatus[MARINE_ITEM]=whatever. */ - -extern void PlayAVI(char *filename); - -extern int LoadGameMenu(void); - -/* Not implemented... yet. */ - -/*-------------------------------------------*/ - -/* The following are enums for first all the - menus, and then for the items on each menu in - turn. The order of the enums control the order - in which the items are stepped through by button - presses. In a couple of cases one menu screen - has two functions, e.g. select character. In - this case some of the connectivity is coded in - (yuk). Also the SELECT_CHARACTER_LIGHT item is - not really a menu item... it's a light, but it - can still be On or Off. */ - -/***** Master Menus Enum *****/ - -typedef enum { - CHOOSE_GAMESTART, - CHOOSE_CHARACTER, - CHOOSE_OPTIONS, - MARINE_BRIEFING, - PREDATOR_BRIEFING, - ALIEN_BRIEFING, - LOAD_GAME, -#if PSX - JOYPAD_CONFIG, -#endif - END -} START_MENU_STATES; - - -/***** Game Start Menu *****/ - -typedef enum { - - NEW_GAME_ITEM =0, - LOAD_GAME_ITEM, - OPTIONS_ITEM, -#if PSX || Saturn -// DEMO_ITEM, -#else - DEMO_ITEM, - MULTIPLAYER_ITEM, - QUIT_ITEM, -#endif - MAX_GAMESTART_MENU_ITEMS - -} GAMESTART_MENU_ITEMS; - -/***** Choose Character Menu *****/ - -typedef enum { - - ALIEN_ITEM = 0, - MARINE_ITEM, - PREDATOR_ITEM, - EXIT_ITEM, - MAX_CHARACTER_MENU_ITEMS - -} CHARACTER_MENU_ITEMS; - -/***** Briefing Menus *****/ - -typedef enum { - ENTER_GAME_ALIEN=0, - EXIT_ITEM_ALIEN, - MAX_ALIEN_MISSION_PROFILE_ITEMS -} ALIEN_MISSION_PROFILE_ITEMS; - -typedef enum { - ENTER_GAME_PREDATOR=0, - EXIT_ITEM_PREDATOR, - MAX_PREDATOR_MISSION_PROFILE_ITEMS -} PREDATOR_MISSION_PROFILE_ITEMS; - -typedef enum { - ENTER_GAME_MARINE=0, - EXIT_ITEM_MARINE, - MALE_MARINE_FACE, - FEMALE_MARINE_FACE, - MAX_MARINE_MISSION_PROFILE_ITEMS -} MARINE_MISSION_PROFILE_ITEMS; - -/***** Choose Language Menu *****/ - -typedef enum { - ENGLISH_ITEM=0, - FRANCAIS_ITEM, - ESPANOL_ITEM, - DEUTSH_ITEM, - ITALIANO_ITEM, - SVENSKA_ITEM, - MAX_LANGUAGE_MENU_ITEMS -} LANGUAGE_MENU_ITEMS; - - -typedef enum { - SLOT0_ITEM=0, - SLOT1_ITEM, - SLOT2_ITEM, - SLOT3_ITEM, - SLOT4_ITEM, - SLOT5_ITEM, - SLOT6_ITEM, - SLOT7_ITEM, - MAX_LOAD_MENU_ITEMS -} LOAD_MENU_ITEMS; - - -#if PSX -typedef enum { - - MUSIC_ITEM = 0, - SOUND_ITEM, - DIFFICULTY_ITEM, - CONTROLS_ITEM, - EXIT_ITEM_OPTIONS, - EASY_ITEM, - MEDIUM_ITEM, - HARD_ITEM, - IMPOSSIBLE_ITEM, - MAX_OPTIONS_MENU_ITEMS - -} OPTIONS_MENU_ITEMS; - -typedef enum { - - OPTIONS_PAUSE_LIGHT = 0, - PAUSED_MUSIC_ITEM, - PAUSED_SOUND_ITEM, - PAUSED_EXIT_ITEM_OPTIONS, - MAX_PAUSED_OPTIONS_MENU_ITEMS - -} PAUSED_OPTIONS_MENU_ITEMS; - -typedef enum { - - PAUSE_LIGHT = 0, - PAUSED_RESUME_ITEM, - PAUSED_OPTIONS_ITEM, - PAUSED_EXIT_ITEM, - MAX_PAUSED_MENU_OPTIONS - -} PAUSED_MENU_OPTIONS; - -typedef enum { - - ALIEN_PAUSE_LIGHT = 0, - ALIEN_PAUSED_RESUME_ITEM, - ALIEN_PAUSED_OBJECTIVE_ITEM, - ALIEN_PAUSED_OPTIONS_ITEM, - ALIEN_PAUSED_LOAD_ITEM, - ALIEN_PAUSED_SAVE_ITEM_ENABLED, - ALIEN_PAUSED_SAVE_ITEM_DISABLED, - ALIEN_PAUSED_EXIT_ITEM, - MAX_ALIEN_PAUSED_MENU_OPTIONS - -} ALIEN_PAUSED_MENU_OPTIONS; - -#endif - -/* Well, that's it. Yes, I know that - much of menus.c was done with cut'n'paste, - but there were differences, honest. I - considered having just one universal - menu function but thought is wasn't - worth the hassle. - Besides, I suspect that the Load Game - menu may have to be entirely platform - specific anyway... - - If any of your code doesn't work, the - Secretary will deny all knowledge of your - actions. This file will self destruct in - five seconds. */ - -#ifdef __cplusplus -} -#endif - -#endif /* ! _included_menudefs_h_ */ diff --git a/src/avp/menus.c b/src/avp/menus.c deleted file mode 100644 index 5dae5a8..0000000 --- a/src/avp/menus.c +++ /dev/null @@ -1,816 +0,0 @@ -/***** Menus.c *****/ - -#include "3dc.h" -#include "inline.h" -#include "module.h" - -#include "stratdef.h" -#include "gamedef.h" - -#include "menudefs.h" -#include "bh_types.h" -#include "equipmnt.h" -#include "weapons.h" -#include "inventry.h" -#include "saveload.h" - -#define UseLocalAssert Yes -#include "ourasert.h" - -#if SupportWindows95 -#include "dp_func.h" -#include "multmenu.h" -#endif - -#include "psnd.h" - -#include "rebmenus.hpp" - -int menustate; - -#define CANCEL -1 - -int LoadGame; - -// this tells us if the item is selected for each list -int CurrentMenuStatus[128]; - -extern int IDemandSelect(void); -extern int IDemandCancel(void); - -extern AVP_GAME_DESC AvP; -extern int executeDemo; -extern int NormalFrameTime; - -/*-------------------------------------------*/ - -static int ChooseGamestartMenu(void); -static void ChooseDemoLevel(void); - -int StartUpMenus(void) -{ -#if OverrideOldMenus - /* - New version 18/3/98 by DHM: - - Passes most of the work control to a new function - (so that I can avoid having to touch this code) - */ - AvP.GameMode = I_GM_Menus; - executeDemo = 0; - - AvP.ElapsedSeconds = 0; - AvP.ElapsedMinutes = 0; - AvP.ElapsedHours = 0; - - { - int RebMenusResult = REBMENUS_DoTheMenus(); - - AvP.GameMode = I_GM_Playing; - - return RebMenusResult; - } - - -#else - int playGameOnExitFromMenus=1; - int func_output; - - AvP.GameMode = I_GM_Menus; - executeDemo = 0; - - PlatformSpecificEnteringMenus(); - - // if we are here, then we must have been killed, exited or - // be starting a new game, hence we can: - - // initialise - FormatSaveBuffer(); - AvP.ElapsedSeconds = 0; - AvP.ElapsedMinutes = 0; - AvP.ElapsedHours = 0; - - menustate=CHOOSE_GAMESTART; - - /* special test to see if we've been lobbied... */ - #if SupportWindows95 - if(CheckForAVPLobbyLaunch()) - { - /* aha, we've been lobbied: go directly to multiplayer menus. */ - - if(RunMultiplayerStartUp(1)) - { - playGameOnExitFromMenus = 1; - menustate = END; - } - else - { - playGameOnExitFromMenus = 0; - menustate = END; - } - } - #endif - - /***** Anything linear and pre-character choice in here. *****/ - while (menustate!=END) - { - switch (menustate) - { - case CHOOSE_GAMESTART: - { - LoadGame=0; - - func_output=ChooseGamestartMenu(); - - /* Jump to LoadGame, Options or ChooseCharacter. * - * Sorry, you only get to choose language once. */ - - switch (func_output) - { - case NEW_GAME_ITEM: - menustate=CHOOSE_CHARACTER; - break; - case OPTIONS_ITEM: - menustate=CHOOSE_OPTIONS; - break; - case LOAD_GAME_ITEM: - if (LoadGameMenu()) - { - LoadGame=1; - menustate=END; - } - break; - #if SupportWindows95 - case MULTIPLAYER_ITEM: - { - /* we keep the multiplayer stuff away from the PSX and Saturn */ - if(RunMultiplayerStartUp(0)) - { - playGameOnExitFromMenus = 1; - menustate = END; - } - else - { - menustate = CHOOSE_GAMESTART; - } - break; - } - - case DEMO_ITEM: - { - menustate = END; - playGameOnExitFromMenus = 1; - executeDemo = 1; - - ChooseDemoLevel(); - AvP.CurrentEnv = AvP.StartingEnv; - - break; - } - - case QUIT_ITEM: - { - menustate = END; - playGameOnExitFromMenus = 0; - break; - } - #endif - - default: - /* Too bad. */ - break; - } - - break; - } - case CHOOSE_OPTIONS: - { - func_output=OptionsMenu(); - menustate=CHOOSE_GAMESTART; - - break; - } - case CHOOSE_CHARACTER: - { - func_output=ChooseCharacterMenu(); - switch (func_output) - { - case ALIEN_ITEM: - AvP. PlayerType = I_Alien; - menustate=ALIEN_BRIEFING; - break; - case MARINE_ITEM: - AvP. PlayerType = I_Marine; - menustate=MARINE_BRIEFING; - break; - case PREDATOR_ITEM: - AvP. PlayerType = I_Predator; - menustate=PREDATOR_BRIEFING; - break; - case EXIT_ITEM: - menustate=CHOOSE_GAMESTART; - break; - } - break; - } - case ALIEN_BRIEFING: - { - func_output=AlienBriefingMenu(); - switch (func_output) - { - case EXIT_ITEM_ALIEN: - menustate=CHOOSE_CHARACTER; - break; - default: - AvP.StartingEnv = I_Medlab; - AvP.CurrentEnv = AvP.StartingEnv; - menustate=END; - break; - } - break; - } - case PREDATOR_BRIEFING: - { - func_output=PredatorBriefingMenu(); - switch (func_output) - { - case EXIT_ITEM_PREDATOR: - menustate=CHOOSE_CHARACTER; - break; - default: - AvP.StartingEnv = I_Cmc4; - AvP.CurrentEnv = AvP.StartingEnv; - menustate=END; - break; - } - break; - } - case MARINE_BRIEFING: - { - func_output=MarineBriefingMenu(); - switch (func_output) - { - case EXIT_ITEM_MARINE: - menustate=CHOOSE_CHARACTER; - break; - default: - #if PSX_DEMO - AvP.StartingEnv = I_Gen1; - #else - AvP.StartingEnv = I_Entrance; - #endif - AvP.CurrentEnv = AvP.StartingEnv; - menustate=END; - break; - } - break; - } - default: - /* Eh? Better crash here. */ - GLOBALASSERT(1==2); - break; - } - - } - PlatformSpecificExitingMenus(); - - AvP.GameMode = I_GM_Playing; - - - return playGameOnExitFromMenus; -#endif -} - - - -/*-------------------------------------------*/ - - -/* Modify this to include different levels for the demo AI */ -static int DemoLevels[] = -{ - I_Gen1, - I_Gen2, - I_Gen3, - I_Cmc2, - I_Cmc4, - I_Cmc6, - I_Mps2, - I_Mps4, - I_Entrance, - - -1 // Must be included -}; - -static void ChooseDemoLevel(void) -{ - int random; - int numDemoLevels = 0; - - while (DemoLevels[numDemoLevels] != -1) - { - numDemoLevels++; - } - - random = FastRandom() % numDemoLevels; - - AvP.StartingEnv = DemoLevels[random]; -} - - -int ChooseGamestartMenu(void) -{ - int a,current_item=NEW_GAME_ITEM; - int selection = -1,debounce = 0; - int demoTimer = 0; - - FrameCounterHandler(); - - // initialise this screen - for (a=0; a ONE_FIXED * 30) - { - selection = DEMO_ITEM; - } - #endif - - #endif - - } - - UnLoadMenuGraphics(CHOOSE_GAMESTART); - return(selection); -} - - -int ChooseCharacterMenu(void) -{ - int a,current_item = MARINE_ITEM; - int selection = -1, debounce = 0; - - // initialise - for (a=0; a= MAX_CHARACTER_MENU_ITEMS) - { - current_item = ALIEN_ITEM; - } - - #if PSX_DEMO - if (current_item==ALIEN_ITEM) current_item++; - #endif - CurrentMenuStatus[current_item]=1; - - MenuChangeSound(); - } - else if (IDemandTurnLeft() && debounce) - { - debounce=0; - CurrentMenuStatus[current_item]=0; - current_item--; - #if PSX_DEMO - if (current_item==PREDATOR_ITEM) current_item--; - if (current_item==ALIEN_ITEM) current_item--; - #endif - if (current_item < 0) - { - current_item = MAX_CHARACTER_MENU_ITEMS - 1; - } - CurrentMenuStatus[current_item]=1; - - MenuChangeSound(); - } - else if (IDemandSelect() && debounce) - { - debounce=0; - selection=current_item; - - MenuSelectSound(); - } - else if ((IDemandTurnLeft()==0) && (IDemandTurnRight()==0) && (IDemandSelect()==0)) - { - debounce=1; - } - DrawEntireMenuScreen(); - SoundSys_Management(); - - } - - UnLoadMenuGraphics(CHOOSE_CHARACTER); - return(selection); -} - - -int AlienBriefingMenu(void) -{ - int a,current_item,selection,debounce; - - LoadMenuGraphics(ALIEN_BRIEFING); - - for (a=0; aMvt_InputRequests.Flags.Rqst_PauseGame) - { - REBMENUS_ProcessPauseRequest(); - } - #else if(AvP.Network==I_No_Network) { #if 1 @@ -520,8 +510,7 @@ void MaintainPlayer(void) // go to start menu AvP.MainLoopRunning = 0; } - #endif - #endif + //Update the player's invulnerabilty timer if(playerStatusPtr->invulnerabilityTimer>0) { diff --git a/src/avp/projmenu.cpp b/src/avp/projmenu.cpp deleted file mode 100644 index fff3232..0000000 --- a/src/avp/projmenu.cpp +++ /dev/null @@ -1,678 +0,0 @@ -/******************************************************************* - * - * DESCRIPTION: projmenu.cpp - * - * Project-specific menu code - * - * AUTHOR: David Malcolm - * - * HISTORY: Created 23/3/98 - * - *******************************************************************/ - -/* Includes ********************************************************/ -#include "3dc.h" - - #include "rebmenus.hpp" - - #if UseRebMenus - #include "rebitems.hpp" - - #include "menudefs.h" - #include "psnd.h" - - #include "tallfont.hpp" - #include "strtab.hpp" - - #include "module.h" - // to include "gamedef.h" - - #include "gamedef.h" - - // Network code includes: - #include "dp_func.h" - - #include "stratdef.h" - #include "equipmnt.h" - // needed to include pldnet.h - - #include "pldnet.h" - - #include "avppages.hpp" - #include "avpitems.hpp" - - #include "db.h" - - #include "intro.hpp" - - #define UseLocalAssert Yes - #include "ourasert.h" - - #else // UseRebMenus - - #include "menugfx.h" - // defn of the MENU_GRAPHIC struct since we export one of - // these for the intros in any case - - #endif // UseRebMenus - -/* Version settings ************************************************/ - -/* Constants *******************************************************/ - -/* Macros **********************************************************/ - -/* Imported function prototypes ************************************/ - -/* Imported data ***************************************************/ -#ifdef __cplusplus - extern "C" - { -#endif - extern unsigned char KeyboardInput[]; - #include "smacker.h" -#ifdef __cplusplus - }; -#endif - - - -/* Exported globals ************************************************/ -// 30/3/98 DHM: -// This bitmap used to be wrapped with OverrideOldMenus and UseRebMenus but is now -// also used by the intro code: -MENUGRAPHIC Starfield_Backdrop = -{ - #if 1 - "Graphics\\NewMenus\\StarField.rim", -1, NULL, NULL, 0, 0, 640, 480, - #else - "Graphics\\NewMenus\\TestBack.rim", -1, NULL, NULL, 0, 0, 640, 480, - #endif -}; - -/* Internal type definitions ***************************************/ -#if UseRebMenus -// Additional implementation-specific code for the RebMenus namespace: Input handling -namespace RebMenus -{ - class InputHandler - { - public: - static void Maintain(void); - - static OurBool bPressedKey - ( - unsigned char& outKey - ); - // return val= was a key pressed; if so, output area is written to - - private: - static OurBool bLastFrame[NUM_NAVIGATION_OPS]; - static int KeyForNavOp[NUM_NAVIGATION_OPS]; - }; -}; // end of namespace RebMenus - -// Additional project-specific menu state: -namespace RebMenus -{ - namespace ProjectSpecific - { - class Networking - { - public: - #if 0 - static void MenuLoopMaintenance(void) - #endif - private: - }; - }; -}; -#endif - // UseRebMenus - -/* Internal function prototypes ************************************/ - -/* Internal globals ************************************************/ - -/* Function definitions ***********************************/ -#if UseRebMenus -// namespace RebMenus -#if OverrideOldMenus -// class MenuLoop -// static -void -RebMenus :: MenuLoop :: StartSoloGame -( - I_PLAYER_TYPE inPlayerType, - I_AVP_ENVIRONMENTS inStartingEnv -) -{ - AvP . PlayerType = inPlayerType; - AvP . CurrentEnv = AvP.StartingEnv = inStartingEnv; - AvP . Network = I_No_Network; - - SetExit - ( - ExitReason_StartGame - ); - - Page :: SelectPage(PageID_NoMenu); -} - -// static -void -RebMenus :: MenuLoop :: StartNetworkGame -( - I_PLAYER_TYPE inPlayerType, - I_AVP_ENVIRONMENTS inStartingEnv -) -{ - AvP . PlayerType = inPlayerType; - AvP . CurrentEnv = AvP.StartingEnv = inStartingEnv; - - SetExit - ( - ExitReason_StartGame - ); -} -#endif - // OverrideOldMenus - -// namespace ProjectSpecific -void -RebMenus :: ProjectSpecific :: Init(void) -{ - // Create the menu page singletons: - new Page_NoMenu(); - new Page_Initial(); - new Page_ChooseCharacter(); - new Page_Options(); - new Page_VideoOptions(); - new Page_AudioOptions(); - - new Page_LevelsOfDetail(); - new Page_MarineBriefing(); - new Page_PredatorBriefing(); - new Page_AlienBriefing(); - new Page_LoadGame(); - new Page_InputOptions(); - new Page_ConfigMouse(); - - new Page_PlaceholderMultiplayer(); - new Page_MultiplayerErrorScreen(); -} - -void -RebMenus :: ProjectSpecific :: UnInit(void) -{ -} - -void -RebMenus :: ProjectSpecific :: Maintain(void) -{ - InputHandler :: Maintain(); -} - - -// Additional implementation-specific code for the RebMenus namespace: -// class InputHandler -// public: -// static -void -RebMenus :: InputHandler :: Maintain(void) -{ - if ( Item_KeyConfig_PageView :: ExpectingKey() ) - { - // Then the key configuration system intercepts the input; the player - // is redefining a key: - Item_KeyConfig_PageView :: Maintain(); - } - else - { - // Otherwise, proceed normally: - #if 0 - if ( KeyboardInput[ KEY_1 ] ) - #endif - { - for - ( - int i=0; - i < NUM_NAVIGATION_OPS; - i++ - ) - { - enum NavigationOp theNavOp = static_cast(i); - - OurBool bThisFrame = KeyboardInput - [ - KeyForNavOp[theNavOp] - ]; - - if (bThisFrame) - { - textprint("undebounced NavOp:%i\n",theNavOp); - } - - // Call the key-handlers for "key down" transitions: - if - ( - bThisFrame - && - ( !bLastFrame[ theNavOp ] ) - ) - { - // Recompute here (in case page changes mid-computation) - Page* pPage = Page :: GetSelected(); - GLOBALASSERT( pPage ); - - pPage -> Navigate( theNavOp ); - } - - bLastFrame[ theNavOp ] = bThisFrame; - } - } - } -} - -// static -void -RebMenus :: Item_KeyConfig_PageView :: Maintain(void) -{ - GLOBALASSERT( pActive ); - unsigned char theKey; - - if ( InputHandler :: bPressedKey( theKey ) ) - { - if (pActive -> bDebounced ) - { - pActive -> bDebounced = No; - pActive -> SetMethod(theKey); - } - } - else - { - pActive -> bDebounced = Yes; - } -} - - -// static -OurBool -RebMenus :: InputHandler :: bPressedKey -( - unsigned char& outKey -) -{ - // return val= was a key pressed; if so, output area is written to - - #if ( MAX_NUMBER_OF_INPUT_KEYS >= 255 ) - #error Range problem in this routine; it will need rewriting - #endif - - for (unsigned char key = 0 ; key <= MAX_NUMBER_OF_INPUT_KEYS ; key++) - { - if (!(key == KEY_ESCAPE) && - !(key >= KEY_F1 && key <= KEY_F12) && - !(key >= KEY_0 && key <= KEY_9) ) - { - if ( KeyboardInput[key] ) - { - outKey = key; - return Yes; - } - } - } - - return No; -} - - - - -// private: -// static -OurBool -RebMenus :: InputHandler :: bLastFrame[NUM_NAVIGATION_OPS]; - -// static -int -RebMenus :: InputHandler :: KeyForNavOp[NUM_NAVIGATION_OPS] = -{ - KEY_UP, - KEY_DOWN, - KEY_LEFT, - KEY_RIGHT, - KEY_HOME, - KEY_END, - KEY_CR, - // NavOp_Trigger - - #if 1 - KEY_ESCAPE - #else - KEY_R - #endif - // NavOp_Cancel - // for the moment - -}; - -// end of namespace RebMenus - -void -RebMenus :: PrecacheGraphics(void) -{ - #if OverrideOldMenus - // Grab all the bitmaps we'll ever need now, before the music starts - // so as to avoid sound glitches: - - // Graphics used by menus in general: - { - // Sliders: - { - Bitmap :: Precache("Graphics\\NewMenus\\SliderBar.rim"); - Bitmap :: Precache("Graphics\\NewMenus\\SliderBarDark.rim"); - Bitmap :: Precache("Graphics\\NewMenus\\Slider.rim"); - Bitmap :: Precache("Graphics\\NewMenus\\SliderDark.rim"); - } - } - - // Graphics used by specific menu pages: - { - // Start solo game: - { - Bitmap :: Precache("Graphics\\NewMenus\\Alien.rim"); - Bitmap :: Precache("Graphics\\NewMenus\\AlienDark.rim"); - Bitmap :: Precache("Graphics\\NewMenus\\MarineDark.rim"); - Bitmap :: Precache("Graphics\\NewMenus\\Predator.rim"); - Bitmap :: Precache("Graphics\\NewMenus\\PredatorDark.rim"); - } - } - #endif -} - -#if OverrideOldMenus -int REBMENUS_DoTheMenus(void) -{ - // This code created from the routines in PCMENUS.CPP: - RebMenus :: InGame :: Set_OutsideTheGame(); - - ResetFrameCounter(); - - PlatformSpecificEnteringMenus(); - - // Ensure r2rect for screen size is properly setup: - { - R2BASE_ScreenModeChange_Cleanup(); - } - - // Experiment to get WAV file play working: - { - #if 0 - BOOL bSuccess = PlaySound - ( - "NewMenus\\Intro.wav", // LPCSTR pszSound, - NULL, // HMODULE hmod, - ( - SND_ASYNC - | SND_FILENAME - ) // DWORD fdwSound - ); - - db_logf1(("PlaySound() returned %i",bSuccess)); - #endif - } - - #if SupportTextprintBeforeGame - // Load debugging font: - { - #if 0 - InitialiseImageHeaders(); - // some kind of init needed ??? - #else - InitialiseTextures(); - #endif - } - #endif - - // Load the starfield backdrop graphic - // Ultimately will want to replace with e.g. an FMV sequence init call - { - LoadMenuGraphic(&Starfield_Backdrop); - } - - // Load the fonts: - { - #if 1 - IndexedFont_Kerned_Column :: Create - ( - IntroFont_Light, // FontIndex I_Font_New, - "Graphics\\NewMenus\\IntroFont.rim", - 21, // int HeightPerChar_New, - 5, // int SpaceWidth_New, - 32 // ASCIICodeForInitialCharacter - ); - - IndexedFont_Kerned_Column :: Create - ( - IntroFont_Dark, // FontIndex I_Font_New, - "Graphics\\NewMenus\\IntroFontDark.rim", - 21, // int HeightPerChar_New, - 5, // int SpaceWidth_New, - 32 // ASCIICodeForInitialCharacter - ); - #else - IndexedFont_Proportional_Column :: Create - ( - IntroFont_Light, // FontIndex I_Font_New, - "Graphics\\NewMenus\\IntroFont.rim", - 21, // int HeightPerChar_New, - 5, // int SpaceWidth_New, - 32 // ASCIICodeForInitialCharacter - ); - - IndexedFont_Proportional_Column :: Create - ( - IntroFont_Dark, // FontIndex I_Font_New, - "Graphics\\NewMenus\\IntroFontDark.rim", - 21, // int HeightPerChar_New, - 5, // int SpaceWidth_New, - 32 // ASCIICodeForInitialCharacter - ); - #endif - } - - // 30/3/98 DHM: Avoid menu sound glitches by doing all the loading now: - { - RebMenus :: PrecacheGraphics(); - } - - - /* KJL 15:00:30 28/03/98 - hook to play the intro sequence - - This call checks to see if this is the first time into the - menus, and plays the intro accordingly - - */ - PlayIntroSequence(); - - - RebMenus :: MenuLoop :: Start(); - - while ( RebMenus :: MenuLoop :: bStillGoing() ) - { - #if 0 - // Allow ALT+TAB - { - CheckForWindowsMessages(); - } - #endif - - // Network messaging; replaces code from RunMultiPlayerStartUp() - // see pp89-91 of DHMS's AvP book - { - if - ( - ( AvP.Network != I_No_Network ) - && - ( netGameData . myGameState == NGS_Joining ) - ) - { - NetCollectMessages(); - } - - if - ( - ( AvP.Network != I_No_Network ) - && - ( netGameData . myGameState == NGS_Joining ) - ) - { - /* we are still in start-up after collecting our messages */ - if(AvP.Network==I_Host) - { - AddNetMsg_GameDescription(); - } - else - { - AddNetMsg_PlayerDescription(); - } - - NetSendMessages(); - } - - } - - - // Do stuff to replace DrawEntireMenuScreen() - { - // DrawMenuBackdrop(); ultimately called BLTMenuToScreen() - // Could replace with a call to render a new flat backdrop - // eg Al's pretty starfield. - // Ultimately might play an FMV sequence - { - // For now: - { - BLTMenuToScreen - ( - &Starfield_Backdrop - ); - } - } - - /* play music */ - PlayMenuMusic(); - - // Add stuff relating to current menu state: - { - RebMenus :: Render(); - } - - // For now, manually flush textprint buffer: - { - #if SupportTextprintBeforeGame - FlushTextprintBuffer(); - #endif - } - - // Flip buffers etc: - { - FlipBuffers(); - } - } - - - // Keep input handling code up-to-date: - { - ReadUserInput(); - } - - // Process user input and update bExit accordingly - { - RebMenus :: Maintain(); - } - - // Update sound system: - { - SoundSys_Management(); - } - - // Handle timing: - { - FrameCounterHandler(); - } - - // Handle possible requests to run the multiplayer dialog - { - Command_Multiplayer :: EndOfMenuLoopProcessing(); - } - - } // end of while loop - - - // Set some globals: - { - #if 0 - AvP . PlayerType = I_Marine; - AvP . CurrentEnv = AvP.StartingEnv; - AvP . Network = I_No_Network; - #endif - // the above are now set in the MenuLoop::StartGame() method - - } - - IndexedFont :: UnloadFont( IntroFont_Dark ); - IndexedFont :: UnloadFont( IntroFont_Light ); - - // Unload any graphics loaded for menu items: - { - RebMenus :: Bitmap :: EmptyCache(); - } - - // Unload the starfeild backdrop; replace with FMV unloading calls - { - ReleaseMenuGraphic - ( - &Starfield_Backdrop - ); - } - - /* play music */ - EndMenuMusic(); - - PlatformSpecificExitingMenus(); - - RebMenus :: InGame :: Set_InTheGame(); - - return RebMenus :: MenuLoop :: MenuRoutineReturnVal(); - -} -#endif - // OverrideOldMenus - -// Pause hook, used by PLAYER.C: -void REBMENUS_ProcessPauseRequest(void) -{ - textprint("REBMENUS_ProcessPauseRequest()\n"); - - Command* pCommand = new Command_ExitCurrentGame(); - pCommand -> Execute(); - - pCommand -> R_Release(); -} -#endif - // UseRebMenus - -void REBMENUS_ProjectSpecific_EndOfMainLoopHook(void) -{ - #if UseRebMenus - RebMenus :: Bitmap :: EmptyCache(); - #endif - - // Set menu page to initial one; ultimately might want to set - // a briefing screen for next level at this point etc. - #if UseRebMenus - RebMenus :: Page :: SelectPage_ClearingStack( PageID_Initial ); - #endif -} - diff --git a/src/avp/projmenu.hpp b/src/avp/projmenu.hpp deleted file mode 100644 index 6ddae44..0000000 --- a/src/avp/projmenu.hpp +++ /dev/null @@ -1,273 +0,0 @@ -/* - - projmenu.hpp - - New menu system for AvP. - - This file created 23/3/98 by DHM, by extracting project specific bits - out of other headers. - - I've attempted to impose a split between project-specific and project-independent - portions of the code. This is perhaps a little academic given that the code is (so - far) just used by AvP. Still, Devil's Own have requested I try to lock off the - project-specific bits. I hope I've done a good job. - - Some of the content of this file is required by REBMENUS.HPP; see comment - at the top of that header file. Other content is specific to getting the - code to work both in the game and outside, given that the code has to work - ASAP within an extensive framework of existing code. - -*/ - -#ifndef _projmenu_hpp -#define _projmenu_hpp 1 - - #if ( defined( __WATCOMC__ ) || defined( _MSC_VER ) ) - #pragma once - #endif - - #if UseRebMenus - - #ifndef _projfont - #include "projfont.h" - #endif - - #ifndef GAMEDEF_INCLUDED - #ifndef MODULE_INCLUDED - #include "module.h" - // needed to include gamedef.h - #endif - - #include "gamedef.h" - #endif - - #endif - -/* Version settings *****************************************************/ - -/* Constants ***********************************************************/ - -/* Macros ***************************************************************/ - -/* Type definitions *****************************************************/ -#if UseRebMenus - enum PageID - { - PageID_NoMenu, - - PageID_Initial, - - - PageID_ChooseCharacter, - PageID_MarineBriefing, - PageID_PredatorBriefing, - PageID_AlienBriefing, - - PageID_LoadGame, - - PageID_Options, - PageID_VideoOptions, - PageID_AudioOptions, - PageID_InputOptions, - - PageID_LevelsOfDetail, - - PageID_MouseConfig, - - PageID_PlaceholderMultiplayer, - PageID_MultiplayerErrorScreen, - - NUM_PAGE_IDS - }; - - // Grab Avp's string table enum, and typedef "TextID" to it: - #ifndef _langenum_h_ - #include "langenum.h" - #endif - - typedef enum TEXTSTRING_ID TextID; - - #ifdef __cplusplus - // Extend the RebMenus namespace with stuff to handle an out-of-the-game - // menu loop for AvP, plus some project-supplied hooks needed for the menu code - namespace RebMenus - { - namespace ProjectSpecific - { - void Init(void); - void UnInit(void); - void Maintain(void); - }; - - #if OverrideOldMenus - // Additions to the RebMenus namespace: handling a loop outside the main game - class MenuLoop - { - // This class handles the exit condition from the out-of-game menu loop - // Functions are provided to request exit next time round the loop, giving - // a reason why the loop is to terminate - public: - - enum ExitReason - { - ExitReason_None, - ExitReason_QuitProgram, - ExitReason_StartGame - }; - - static void Start(void) - { - theExitReason_Val = ExitReason_None; - } - - static OurBool bStillGoing(void) - { - return ( ExitReason_None == theExitReason_Val ); - } - - static int MenuRoutineReturnVal(void) - { - // value to be returned by the dedicated menu loop to WinMain() - if ( theExitReason_Val == ExitReason_QuitProgram ) - { - // Then the while( themenus ) loop should receive a false value - // which will kill the main loop - return No; - } - else - { - // Then the while( themenus ) loop should receive a true value - // which will pass control into the innards of the main loop - return Yes; - } - } - - static void QuitProgram(void) - { - SetExit - ( - ExitReason_QuitProgram - ); - } - - static void StartSoloGame - ( - I_PLAYER_TYPE inPlayerType, - I_AVP_ENVIRONMENTS inStartingEnv - ); - - static void StartNetworkGame - ( - I_PLAYER_TYPE inPlayerType, - I_AVP_ENVIRONMENTS inStartingEnv - ); - - - private: - static void SetExit - ( - enum ExitReason theExitReason_New - ) - { - theExitReason_Val = theExitReason_New; - } - - private: - static enum ExitReason theExitReason_Val; - }; - - // A class to handle knowledge for the menus of whether - // they are being run outisde the game in their own loop, - // or within the main game loop: - class InGame - { - public: - static void Set_InTheGame(void) - { - bInTheGame_Val = Yes; - } - static void Set_OutsideTheGame(void) - { - bInTheGame_Val = No; - } - - static OurBool Get(void) - { - return bInTheGame_Val; - } - - private: - static OurBool bInTheGame_Val; - }; - #endif - // OverrideOldMenus - - // A class required by the project-independent menu code - // to tell label rendering which fonts to use, and when: - class Fonts - { - private: - static const FontIndex LabelFont_InGame; - static const FontIndex LabelFont_OutOfGame_Selected; - static const FontIndex LabelFont_OutOfGame_Unselected; - - public: - static FontIndex GetIndex - ( - #if OverrideOldMenus - OurBool bSelected - #else - OurBool - #endif - ) - { - #if OverrideOldMenus - if (InGame::Get()) - { - return LabelFont_InGame; - } - else - { - if (bSelected) - { - return LabelFont_OutOfGame_Selected; - } - else - { - return LabelFont_OutOfGame_Unselected; - } - } - #else - return LabelFont_InGame; - #endif - } - }; - - const int Label_FixP_Alpha = ONE_FIXED; - const int ColumnSpacing = 15; - - void PrecacheGraphics(void); - - }; - #endif -#endif // UseRebMenus -/* Exported globals *****************************************************/ - -/* Function prototypes **************************************************/ -#ifdef __cplusplus - extern "C" { -#endif - // Function call hook for AvP: - extern int REBMENUS_DoTheMenus(void); - - // Pause hook, used by PLAYER.C: - extern void REBMENUS_ProcessPauseRequest(void); -#ifdef __cplusplus - }; -#endif - - - -/* End of the header ****************************************************/ - -#endif diff --git a/src/avp/support/consbind.cpp b/src/avp/support/consbind.cpp index f0438da..6477673 100644 --- a/src/avp/support/consbind.cpp +++ b/src/avp/support/consbind.cpp @@ -21,7 +21,6 @@ #include "consbind.hpp" #if KeyBindingUses_KEY_ID - #include "avpitems.hpp" #include "iofocus.h" #include "scstring.hpp" #include "strtab.hpp" @@ -63,6 +62,7 @@ /* Exported globals ************************************************/ /* Internal type definitions ***************************************/ +typedef enum TEXTSTRING_ID TextID; /* Internal function prototypes ************************************/ diff --git a/src/avp/support/rebitems.cpp b/src/avp/support/rebitems.cpp deleted file mode 100644 index 0027a9a..0000000 --- a/src/avp/support/rebitems.cpp +++ /dev/null @@ -1,870 +0,0 @@ -/******************************************************************* - * - * DESCRIPTION: rebitems.cpp - * - * AUTHOR: David Malcolm - * - * HISTORY: Created 9/3/98 - * - *******************************************************************/ - -/* Includes ********************************************************/ -#include "3dc.h" - - #include "rebitems.hpp" - - #if UseRebMenus - #include "strtab.hpp" - #include "indexfnt.hpp" - - #include "module.h" - // to include stratdef.h - - #include "stratdef.h" - // to include usr_io.h - - #include "usr_io.h" - - #include "db.h" - - #define UseLocalAssert Yes - #include "ourasert.h" - - #endif - -/* Version settings ************************************************/ - -/* Constants *******************************************************/ - -/* Macros **********************************************************/ - -/* Imported function prototypes ************************************/ - -/* Imported data ***************************************************/ -#ifdef __cplusplus - extern "C" - { -#endif - #if 0 - extern OurBool DaveDebugOn; - extern FDIEXTENSIONTAG FDIET_Dummy; - extern IFEXTENSIONTAG IFET_Dummy; - extern FDIQUAD FDIQuad_WholeScreen; - extern FDIPOS FDIPos_Origin; - extern FDIPOS FDIPos_ScreenCentre; - extern IFOBJECTLOCATION IFObjLoc_Origin; - extern UncompressedGlobalPlotAtomID UGPAID_StandardNull; - extern IFCOLOUR IFColour_Dummy; - extern IFVECTOR IFVec_Zero; - #endif -#ifdef __cplusplus - }; -#endif - - - -/* Exported globals ************************************************/ -#if UseRebMenus -// static -const FontIndex RebMenus :: Fonts :: LabelFont_InGame = DATABASE_MESSAGE_FONT; -// static -const FontIndex RebMenus :: Fonts :: LabelFont_OutOfGame_Selected = IntroFont_Light; -const FontIndex RebMenus :: Fonts :: LabelFont_OutOfGame_Unselected = IntroFont_Dark; -#endif - -/* Internal type definitions ***************************************/ - -/* Internal function prototypes ************************************/ - -/* Internal globals ************************************************/ - -/* Exported function definitions ***********************************/ -#if UseRebMenus -// Derived classes for the item types: -//class Item_Unimplemented : public Item -// public: -// Process various keypresses: -OurBool -RebMenus :: Item_Unimplemented :: Navigate( enum NavigationOp aNavOp ) -{ - // return = was message processed - switch ( aNavOp ) - { - case NavOp_Trigger: - textprint("this is an unimplemented item\n"); - return Yes; - - case NavOp_Up: - case NavOp_Down: - case NavOp_Left: - case NavOp_Right: - case NavOp_Home: - case NavOp_End: - case NavOp_Cancel: - // No way of processing - return No; - - default: - GLOBALASSERT(0); - } - return No; -} - -void -RebMenus :: Item_Unimplemented :: Diagnostic(OurBool bSelected) const -{ - textprint("Unimplemented:"); - - DiagnosticAppearance(bSelected); -} - -// Methods relating to rendering: -void -RebMenus :: Item_Unimplemented :: Render -( - const RenderContext& theContext, - OurBool bSelected -) const -{ - RenderAppearance - ( - theContext, - bSelected - ); -} - -RebMenus :: SizeInfo -RebMenus :: Item_Unimplemented :: GetSizeInfo(void) const -{ - return AppearanceSizeInfo(); -} -// public: -// Process various keypresses: -OurBool -RebMenus :: Item_Command :: Navigate( enum NavigationOp aNavOp ) -{ - // return = was message processed - switch ( aNavOp ) - { - case NavOp_Trigger: - return pCommand_Val -> Execute(); - - case NavOp_Up: - case NavOp_Down: - case NavOp_Left: - case NavOp_Right: - case NavOp_Home: - case NavOp_End: - case NavOp_Cancel: - // No way of processing - return No; - - default: - GLOBALASSERT(0); - } - return No; -} - -void -RebMenus :: Item_Command :: Diagnostic(OurBool bSelected) const -{ - textprint("Item_Command:"); - - DiagnosticAppearance(bSelected); -} -// contains a command; can contain a "goto menu page" command - -// Methods relating to rendering: -void -RebMenus :: Item_Command :: Render -( - const RenderContext& theContext, - OurBool bSelected -) const -{ - RenderAppearance - ( - theContext, - bSelected - ); -} - -RebMenus :: SizeInfo -RebMenus :: Item_Command :: GetSizeInfo(void) const -{ - return AppearanceSizeInfo(); -} - - -// class Item_Selection : public Item -// public: -#if 1 -// Process various keypresses: -OurBool -RebMenus :: Item_Selection :: Navigate( enum NavigationOp aNavOp ) -{ - // return = was message processed - switch ( aNavOp ) - { - case NavOp_Up: - if ( theDir == D_Vert ) - { - Dec(); - return Yes; - } - else - { - return No; - } - - case NavOp_Down: - if ( theDir == D_Vert ) - { - Inc(); - return Yes; - } - else - { - return No; - } - - case NavOp_Left: - if ( theDir == D_Horiz ) - { - Dec(); - return Yes; - } - else - { - return No; - } - - case NavOp_Right: - if ( theDir == D_Horiz ) - { - Inc(); - return Yes; - } - else - { - return No; - } - case NavOp_Home: - Min(); - return Yes; - - case NavOp_End: - Max(); - return Yes; - - case NavOp_Trigger: - Inc(); - return Yes; - - case NavOp_Cancel: - // No way of processing - return No; - - default: - GLOBALASSERT(0); - } - return No; -} -#endif - -void -RebMenus :: Item_Selection :: Diagnostic(OurBool bSelected) const -{ - textprint("Item_Selection: "); - - #if 1 - DiagnosticAppearance(bSelected); - #endif - -} - -void -RebMenus :: Item_Selection :: Min(void) -{ - textprint("Min\n"); - - pSelectionVar_Val -> Set - ( - pSelectionVar_Val -> GetMin() - ); -} - -void -RebMenus :: Item_Selection :: Max(void) -{ - textprint("Max\n"); - - pSelectionVar_Val -> Set - ( - pSelectionVar_Val -> GetMax() - ); -} - -void -RebMenus :: Item_Selection :: Inc(void) -{ - textprint("Inc\n"); - - pSelectionVar_Val -> Set - ( - pSelectionVar_Val -> GetNxt() - ); - -} - -void -RebMenus :: Item_Selection :: Dec(void) -{ - textprint("Dec\n"); - - pSelectionVar_Val -> Set - ( - pSelectionVar_Val -> GetPrv() - ); -} - -// Methods relating to rendering: -void -RebMenus :: Item_Selection :: Render -( - const RenderContext& theContext, - OurBool bSelected -) const -{ - RenderAppearance - ( - theContext, - bSelected - ); - - RenderContext valueContext = theContext . NextColumn(); - - pSelectionVar_Val -> GetAppearance( bSelected ) . Render - ( - valueContext, - bSelected - ); -} - -RebMenus :: SizeInfo -RebMenus :: Item_Selection :: GetSizeInfo(void) const -{ - return AppearanceSizeInfo(); -} - - -// class Item_Slider : public Item -// public: -// Process various keypresses: -OurBool -RebMenus :: Item_Slider :: Navigate( enum NavigationOp aNavOp ) -{ - // return = was message processed - switch ( aNavOp ) - { - case NavOp_Up: - if ( theDir == D_Vert ) - { - Inc(); - return Yes; - } - else - { - return No; - } - - case NavOp_Down: - if ( theDir == D_Vert ) - { - Dec(); - return Yes; - } - else - { - return No; - } - - case NavOp_Left: - if ( theDir == D_Horiz ) - { - Dec(); - return Yes; - } - else - { - return No; - } - - case NavOp_Right: - if ( theDir == D_Horiz ) - { - Inc(); - return Yes; - } - else - { - return No; - } - case NavOp_Home: - SetToMax(); - return Yes; - - case NavOp_End: - SetToMin(); - return Yes; - - case NavOp_Trigger: - Inc(); - return Yes; - - case NavOp_Cancel: - // No way of processing - return No; - - default: - GLOBALASSERT(0); - } - return No; -} - -void -RebMenus :: Item_Slider :: Diagnostic(OurBool bSelected) const -{ - textprint("Item_Slider:"); - - #if 1 - DiagnosticAppearance(bSelected); - #endif -} - -// Handy ways to process discrete movements of the slider -void -RebMenus :: Item_Slider :: SetToMin(void) -{ - textprint("SetToMin\n"); - - pBoundedExpVar_Val -> Set - ( - pBoundedExpVar_Val -> GetMin() - ); -} - -void -RebMenus :: Item_Slider :: SetToMax(void) -{ - textprint("SetToMax\n"); - - pBoundedExpVar_Val -> Set - ( - pBoundedExpVar_Val -> GetMax() - ); -} - -void -RebMenus :: Item_Slider :: Inc(void) -{ - textprint("Inc\n"); - - // The Set() method silently rejects attempt to set outside range - // For this reason, if close to the bounding value, - // set direct to bounding value - - int NewVal = pBoundedExpVar_Val -> Get() + GetFraction(); - - int Bound = pBoundedExpVar_Val -> GetMax(); - - pBoundedExpVar_Val -> Set - ( - (NewVal < Bound) ? NewVal : Bound - ); -} - -void -RebMenus :: Item_Slider :: Dec(void) -{ - textprint("Dec\n"); - - // Analogous to the Inc() method above - - int NewVal = pBoundedExpVar_Val -> Get() - GetFraction(); - - int Bound = pBoundedExpVar_Val -> GetMin(); - - pBoundedExpVar_Val -> Set - ( - (NewVal > Bound) ? NewVal : Bound - ); -} - -// Methods relating to rendering: -void -RebMenus :: Item_Slider :: Render -( - const RenderContext& theContext, - OurBool bSelected -) const -{ - RenderAppearance - ( - theContext, - bSelected - ); - - RenderContext sliderContext = theContext . NextColumn(); - - float floatPos = - ( - float( GetVal() - GetMin() ) - / - float( GetRange() ) - ); - - RenderSlider - ( - sliderContext, - bSelected, - floatPos - ); - - #if 0 - textprintXY - ( - sliderContext . Pos() . x, - sliderContext . Pos() . y, - " [%i,%i] range(%i) val(%i)", - GetMin(), - GetMax(), - GetRange(), - GetVal() - - ); - #endif -} - -RebMenus :: SizeInfo -RebMenus :: Item_Slider :: GetSizeInfo(void) const -{ - return AppearanceSizeInfo() . AddColumn - ( - SizeInfo - ( - Bitmap :: GetSize("Graphics\\NewMenus\\SliderBar.rim"), - 0 - ) - ); -} - -// private: -// static -void -RebMenus :: Item_Slider :: RenderSlider -( - const RenderContext& theContext, - OurBool bSelected, - float floatAmount -) -{ - #if 1 - Bitmap :: Blit_Transparent - ( - ( - bSelected - ? - "Graphics\\NewMenus\\SliderBar.rim" // const char* const pCh_Name, - : - "Graphics\\NewMenus\\SliderBarDark.rim" // const char* const pCh_Name, - ), - theContext . ClipRect(), - theContext . Pos() - ); - Bitmap :: Blit_Transparent - ( - ( - bSelected - ? - "Graphics\\NewMenus\\Slider.rim" // const char* const pCh_Name, - : - "Graphics\\NewMenus\\SliderDark.rim" // const char* const pCh_Name, - ), - theContext . ClipRect(), - r2pos - ( - ( - theContext . Pos() . x + 3 + - ( - int(200.0f * floatAmount) - ) - ), - ( - theContext . Pos() . y + 4 - ) - ) - ); - #else - textprintXY - ( - theContext . Pos() . x, - theContext . Pos() . y, - "[---------------]" - ); - - const int TotalWidth = (16*CharWidth); - int Offset = - ( - int(float(TotalWidth) * floatAmount) - ); - - textprintXY - ( - theContext . Pos() . x + Offset, - theContext . Pos() . y, - "|" - ); - #endif -} - - -// class Item_Toggle : public Item -// public: -// Process various keypresses: -OurBool -RebMenus :: Item_Toggle :: Navigate( enum NavigationOp aNavOp ) -{ - // return = was message processed - switch ( aNavOp ) - { - case NavOp_Up: - case NavOp_Down: - if ( theDir == D_Vert ) - { - Toggle(); - return Yes; - } - else - { - return No; - } - case NavOp_Left: - case NavOp_Right: - if ( theDir == D_Horiz ) - { - Toggle(); - return Yes; - } - else - { - return No; - } - case NavOp_Trigger: - Toggle(); - return Yes; - - case NavOp_Home: - TurnOn(); - return Yes; - - case NavOp_End: - TurnOff(); - return Yes; - - case NavOp_Cancel: - // No way of processing - return No; - - default: - GLOBALASSERT(0); - } - return No; -} - -void -RebMenus :: Item_Toggle :: Diagnostic(OurBool bSelected) const -{ - textprint("Item_Toggle:"); - - DiagnosticAppearance(bSelected); - - theOnOffApp_Val . GetAppearance - ( - pExpVar_Val -> Get() - ) . Diagnostic(); -} - -void -RebMenus :: Item_Toggle :: Toggle(void) -{ - OurBool bCurrent = pExpVar_Val -> Get(); - pExpVar_Val -> Set - ( - !bCurrent - ); -} - -void -RebMenus :: Item_Toggle :: TurnOn(void) -{ - pExpVar_Val -> Set(Yes); -} - -void -RebMenus :: Item_Toggle :: TurnOff(void) -{ - pExpVar_Val -> Set(No); -} - -// Methods relating to rendering: -void -RebMenus :: Item_Toggle :: Render -( - const RenderContext& theContext, - OurBool bSelected -) const -{ - RenderAppearance - ( - theContext, - bSelected - ); - - - RenderContext valueContext = theContext . NextColumn(); - - theOnOffApp_Val .GetAppearance - ( - pExpVar_Val -> Get() - ) . Render - ( - valueContext, - bSelected - ); -} - -RebMenus :: SizeInfo -RebMenus :: Item_Toggle :: GetSizeInfo(void) const -{ - return AppearanceSizeInfo() . AddColumn - ( - theOnOffApp_Val . GetSizeInfo() - ); -} - -#if 0 -// class Item_Table : public Item -// public: -RebMenus :: Item_Table :: Item_Table -( - OnOffAppearance theOnOffApp_New -) : Item(theOnOffApp_New), - NumX(0), - NumY(0), - SelectedX(0), - SelectedY(0) -{ -} - -// Process various keypresses: -OurBool -RebMenus :: Item_Table :: Navigate( enum NavigationOp aNavOp ) -{ - // return = was message processed - return No; -} - -void -RebMenus :: Item_Table :: Diagnostic(OurBool bSelected) const -{ -} - -Item* -RebMenus :: Item_Table :: GetSelected(void) const -{ - // will return NULL iff there are no items in the composition - if (NumX == 0) - { - GLOBALASSERT(NumY==0); - return NULL; - } - - GLOBALASSERT( NumY > 0 ); - - GLOBALASSERT( NumX < MAX_X ); - GLOBALASSERT( NumY < MAX_Y ); - - GLOBALASSERT( SelectedX >= 0 ); - GLOBALASSERT( SelectedY >= 0 ); - - GLOBALASSERT( SelectedX < NumX ); - GLOBALASSERT( SelectedY < NumY ); - - Item* pItem = pItem_A[SelectedX][SelectedY]; - - GLOBALASSERT( pItem ); - - return pItem; -} - -// private: -void -RebMenus :: Item_Table :: AddRow -( - Item** ppItem_ToAdd -) -{ - // takes a NULL-terminated list of Item*s - - GLOBALASSERT(NumY < (MAX_Y-1) ); - // can't get any bigger - - int Pos_I = 0; - - while ( *ppItem_ToAdd ) - { - GLOBALASSERT( Pos_I < MAX_X ); - - pItem_A - [ - Pos_I++ - ] - [ - NumY - ] - = - ( - *(ppItem_ToAdd++) - ); - } - - if (NumX < Pos_I) - { - } - - NumY++; - -} - -void -RebMenus :: Item_Table :: AddColumn -( - Item** ppItem_ToAdd -) -{ - // takes a NULL-terminated list of Item*s -} - -#if 0 -// List of selectables: -enum {MAX_X = 10}; -enum {MAX_Y = 20}; -#endif - -#endif - -#endif - // UseRebMenus - -/* Internal function definitions ***********************************/ diff --git a/src/avp/support/rebitems.hpp b/src/avp/support/rebitems.hpp deleted file mode 100644 index 37ec9b2..0000000 --- a/src/avp/support/rebitems.hpp +++ /dev/null @@ -1,358 +0,0 @@ -/* - - rebitems.hpp - - Derived classes for the item types; all except CompositeItem go in this - file. -*/ - -#ifndef _rebitems_hpp -#define _rebitems_hpp 1 - - #if ( defined( __WATCOMC__ ) || defined( _MSC_VER ) ) - #pragma once - #endif - - #ifndef _rebmenus_hpp - #include "rebmenus.hpp" - #endif - - #if UseRebMenus - #ifndef _included_pcmenus_h_ - #include "pcmenus.h" - // for enum KeyConfigItems - #endif - - #ifndef _scstring - #include "scstring.hpp" - #endif - #endif - -/* Version settings *****************************************************/ - -/* Constants ***********************************************************/ - -/* Macros ***************************************************************/ - -/* Type definitions *****************************************************/ -#if UseRebMenus -// Derived classes for the item types: -namespace RebMenus -{ - class Item_Unimplemented : public Item - { - public: - Item_Unimplemented - ( - OnOffAppearance theOnOffApp - ) : Item - ( - theOnOffApp - ) - { - } - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - void Diagnostic(OurBool bSelected) const; - - // Methods relating to rendering: - void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - SizeInfo GetSizeInfo(void) const; - - }; - - class Item_Command : public Item - { - public: - Item_Command - ( - OnOffAppearance theOnOffApp, - Command* pCommand - ) : Item - ( - theOnOffApp - ), - pCommand_Val(pCommand) - { - pCommand_Val -> R_AddRef(); - } - - ~Item_Command() - { - pCommand_Val -> R_Release(); - } - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - void Diagnostic(OurBool bSelected) const; - - // Methods relating to rendering: - void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - SizeInfo GetSizeInfo(void) const; - - private: - Command *const pCommand_Val; - }; - // contains a command; can contain a "goto menu page" command - - class Item_Selection : public Item - { - public: - Item_Selection - ( - OnOffAppearance theOnOffApp, - enum Direction initDir, - SelectionVariable* pSelectionVar - ) : Item - ( - theOnOffApp - ), - theDir(initDir), - pSelectionVar_Val(pSelectionVar) - { - } - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - void Diagnostic(OurBool bSelected) const; - - void Min(void); - void Max(void); - void Inc(void); - void Dec(void); - - // Methods relating to rendering: - void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - SizeInfo GetSizeInfo(void) const; - - private: - // Direction: - const enum Direction theDir; - SelectionVariable* const pSelectionVar_Val; - - }; - - class Item_Slider : public Item - { - public: - Item_Slider - ( - OnOffAppearance theOnOffApp, - enum Direction initDir, - BoundedExportVariable* pBoundedExpVar - // takes responsibility for deallocating this - ) : Item - ( - theOnOffApp - ), - theDir(initDir), - pBoundedExpVar_Val(pBoundedExpVar) - { - } - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - void Diagnostic(OurBool bSelected) const; - - // Handy ways to process discrete movements of the slider - void SetToMin(void); - void SetToMax(void); - void Inc(void); - void Dec(void); - - // Handy ways to values of the slider: - int GetMin(void) const - { - return pBoundedExpVar_Val -> GetMin(); - } - int GetMax(void) const - { - return pBoundedExpVar_Val -> GetMax(); - } - int GetRange(void) const - { - return ( GetMax() - GetMin() ); - } - int GetVal(void) const - { - return pBoundedExpVar_Val -> Get(); - } - - // Methods relating to rendering: - void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - SizeInfo GetSizeInfo(void) const; - - private: - static void RenderSlider - ( - const RenderContext& theContext, - OurBool bSelected, - float floatPos - ); - - int GetFraction(void) const - { - // returns a fractional amout good for a small increment/decrement - - int Amt = (GetRange() / 32); - - return ( (Amt>1) ? Amt : 1); - // ensure amount is at least 1 - } - - private: - // Direction: - const enum Direction theDir; - BoundedExportVariable* const pBoundedExpVar_Val; - - }; - - class Item_Toggle : public Item - { - public: - Item_Toggle - ( - OnOffAppearance theOnOffApp_Label, - - enum Direction initDir, - OnOffAppearance theOnOffApp_Choice, - ExportVariable* pExpVar - // takes responsibility for deallocating this - ) : Item - ( - theOnOffApp_Label - ), - theDir(initDir), - theOnOffApp_Val(theOnOffApp_Choice), - pExpVar_Val(pExpVar) - { - } - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - void Diagnostic(OurBool bSelected) const; - - void Toggle(void); - void TurnOn(void); - void TurnOff(void); - - // Methods relating to rendering: - void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - SizeInfo GetSizeInfo(void) const; - - private: - // Direction: - const enum Direction theDir; - - OnOffAppearance theOnOffApp_Val; - - ExportVariable* pExpVar_Val; - }; - - #if 0 - // A 2d analogue of the composite item: - class Item_Table : public Item - { - public: - Item_Table - ( - OnOffAppearance theOnOffApp_New - ); - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - void Diagnostic(OurBool bSelected) const; - - Item* GetSelected(void) const; - // will return NULL iff there are no items in the composition - - private: - #if 1 - void AddControlConfigRow(); - #else - void AddRow - ( - Item** ppItem_ToAdd - ); - // takes a NULL-terminated list of Item*s - - void AddColumn - ( - Item** ppItem_ToAdd - ); - // takes a NULL-terminated list of Item*s - #endif - - // List of selectables: - enum {MAX_X = 10}; - enum {MAX_Y = 20}; - - int NumX; - int NumY; - Item* pItem_A[ MAX_X ][ MAX_Y ]; - - int SelectedX; - int SelectedY; - - }; - #endif - - - #if 0 - // Decorator contains another item, and passes on calls to it ?? - class Item_Decorator_VScroll : public Item - { - public: - private: - }; - #endif - -}; -#endif // UseRebMenus - -/* Exported globals *****************************************************/ - -/* Function prototypes **************************************************/ - - - -/* End of the header ****************************************************/ -#endif diff --git a/src/avp/support/rebmenus.cpp b/src/avp/support/rebmenus.cpp deleted file mode 100644 index 4581a82..0000000 --- a/src/avp/support/rebmenus.cpp +++ /dev/null @@ -1,1722 +0,0 @@ -/******************************************************************* - * - * DESCRIPTION: rebmenus.cpp - * - * AUTHOR: David Malcolm - * - * HISTORY: Created 9/3/98 - * - *******************************************************************/ - -/* Includes ********************************************************/ -#include "3dc.h" - - #include "rebmenus.hpp" - - #if UseRebMenus - #include "rebitems.hpp" - #include "strtab.hpp" - #include "indexfnt.hpp" - - #include "awTexLd.h" - #include "alt_tab.h" - - #define UseLocalAssert Yes - #include "ourasert.h" - #endif // UseRebMenus - -/* Version settings ************************************************/ - -/* Constants *******************************************************/ - -/* Macros **********************************************************/ - -/* Imported function prototypes ************************************/ - -/* Imported data ***************************************************/ -#if UseRebMenus - #ifdef __cplusplus - extern "C" - { - #endif - - extern LPDIRECTDRAWSURFACE lpDDSBack; - - #ifdef __cplusplus - }; - #endif -#endif // UseRebMenus - - -/* Exported globals ************************************************/ -#if UseRebMenus -#if OverrideOldMenus -// private: -// static -OurBool RebMenus :: InGame :: bInTheGame_Val = No; - -// static - -// enum RebMenus :: MenuLoop :: ExitReason -// enum ExitReason -RebMenus :: MenuLoop :: ExitReason -RebMenus :: MenuLoop :: theExitReason_Val = ExitReason_None; -#endif - // OverrideOldMenus -#endif - // UseRebMenus - -/* Internal type definitions ***************************************/ - -/* Internal function prototypes ************************************/ - -/* Internal globals ************************************************/ - -/* Exported function definitions ***********************************/ -#if UseRebMenus -// namespace RebMenus -// class Command_JumpToPage : public Command -// public: -OurBool -RebMenus :: Command_JumpToPage :: Execute(void) -{ - Page :: SelectPage(thePage_Val); - - return Yes; -} - - -// class Command_ReturnFromPage : public Command -// public: -OurBool -RebMenus :: Command_ReturnFromPage :: Execute(void) -{ - Page :: TryToReturn(); - - return Yes; -} - -RebMenus :: SizeInfo -RebMenus :: SizeInfo :: Overlay -( - SizeInfo other -) -{ - int minW_Max = - ( - (minR2Size_Val . w > other . minR2Size_Val . w) - ? - minR2Size_Val . w - : - other . minR2Size_Val . w - ); - int minH_Max = - ( - (minR2Size_Val . h > other . minR2Size_Val . h) - ? - minR2Size_Val . h - : - other . minR2Size_Val . h - ); - int maxColumn_minW = - ( - (Column0_minW_Val > other . Column0_minW_Val) - ? - Column0_minW_Val - : - other . Column0_minW_Val - ); - return SizeInfo - ( - r2size - ( - minW_Max, - minH_Max - ), - maxColumn_minW - ); -} - -RebMenus :: SizeInfo -RebMenus :: SizeInfo :: AddColumn -( - SizeInfo nextColumn -) -{ - r2size R2Size_New = minR2Size_Val; - r2size R2Size_NextColumn = nextColumn . minR2Size_Val; - - R2Size_New . HCompose - ( - R2Size_NextColumn - ); - - return SizeInfo - ( - R2Size_New, - minR2Size_Val . w - ); -} - -RebMenus :: SizeInfo -RebMenus :: SizeInfo :: AddRow -( - SizeInfo nextRow -) -{ - r2size R2Size_New = minR2Size_Val; - - int maxColumn_minW = - ( - (Column0_minW_Val > nextRow . Column0_minW_Val) - ? - Column0_minW_Val - : - nextRow . Column0_minW_Val - ); - - R2Size_New . VCompose(nextRow . minR2Size_Val); - - return SizeInfo - ( - R2Size_New, - maxColumn_minW - ); -} - -#if 1 -void -RebMenus :: SizeInfo :: Compose -( - const SizeInfo& other, - enum Direction theD, - enum Alignment // theAl -) -{ - if ( theD == D_Vert ) - { - minR2Size_Val . VCompose - ( - other . minR2Size_Val - ); - } - else - { - minR2Size_Val . HCompose - ( - other . minR2Size_Val - ); - } - - Column0_minW_Val = - ( - (Column0_minW_Val > other . Column0_minW_Val) - ? - Column0_minW_Val - : - other . Column0_minW_Val - ); -} - - -#endif - - - -// class Appearance -// public: -void -RebMenus :: Appearance :: Diagnostic(void) const -{ - if ( bHasBitmap ) - { - textprint("bitmap:\"%s\"; ",BMapN_Val . Get()); - } - else - { - textprint("plain; "); - } - - if ( bHasTextLabel ) - { - SCString& theLabel = StringTable :: GetSCString - ( - ID_Label_Val - ); - - textprint - ( - "label=\"%s\"\n", - theLabel . pProjCh() - ); - - theLabel . R_Release(); - } - else - { - textprint("unlabelled\n"); - } -} - -// Methods relating to rendering: -void -RebMenus :: Appearance :: Render -( - const RenderContext& theContext, - OurBool bSelected -) const -{ - if - ( - bSelected - ) - { - textprintXY - ( - theContext . Pos() . x-20, - theContext . Pos() . y, - "*" - ); - } - - if ( bHasTextLabel ) - { - SCString& theLabel = StringTable :: GetSCString - ( - ID_Label_Val - ); - - #if 1 - IndexedFont* pFont = IndexedFont :: GetFont - ( - Fonts :: GetIndex - ( - bSelected - ) - ); - // can return NULL if no font loaded in that slot - GLOBALASSERT( pFont ); - - r2pos R2Pos_Cursor = theContext . Pos(); - - pFont -> RenderString_Clipped - ( - R2Pos_Cursor, - theContext . ClipRect(), - Label_FixP_Alpha, - theLabel - ); - #else - textprintXY - ( - theContext . Pos() . x, - theContext . Pos() . y, - theLabel . pProjCh() - ); - #endif - - theLabel . R_Release(); - - } - - if ( bHasBitmap ) - { - #if 1 - textprintXY - ( - theContext . Pos() . x, - theContext . Pos() . y, - "bitmap:\"%s\"; ", - BMapN_Val . Get() - ); - #endif - - Bitmap :: Blit_Transparent - ( - BMapN_Val . Get(), // const char* const pCh_Name, - theContext . ClipRect(), // r2rect R2Rect_Clip, - theContext . Pos() // r2pos dstR2Pos - ); - } -} - -RebMenus :: SizeInfo -RebMenus :: Appearance :: GetSizeInfo(void) const -{ - r2size runningR2Size; - int runningColumn0; - - if ( bHasTextLabel ) - { - SCString& theLabel = StringTable :: GetSCString - ( - ID_Label_Val - ); - - r2size R2Size_Label = theLabel . CalcSize - ( - Fonts :: GetIndex - ( - Yes - // for the moment - ) - ); - - theLabel . R_Release(); - - runningR2Size = R2Size_Label; - runningColumn0 = R2Size_Label . w + ColumnSpacing; - } - else - { - runningR2Size = r2size(0,0); - runningColumn0 = 0; - } - - SizeInfo theSizeInfo - ( - runningR2Size, - runningColumn0 - ); - - if ( bHasBitmap ) - { - theSizeInfo = theSizeInfo . Overlay - ( - SizeInfo - ( - Bitmap :: GetSize - ( - BMapN_Val . Get() - ), - 0 - ) - ); - } - - return theSizeInfo; -} - -RebMenus :: SizeInfo -RebMenus :: OnOffAppearance :: GetSizeInfo(void) const -{ - SizeInfo SizeInfo_On = App_On_Val . GetSizeInfo(); - SizeInfo SizeInfo_Off = App_Off_Val . GetSizeInfo(); - - return SizeInfo_On . Overlay(SizeInfo_Off); -} - - -void -RebMenus :: Item :: DiagnosticAppearance(OurBool bSelected) const -{ - theOnOffApp_Val . GetAppearance(bSelected) . Diagnostic(); -} - - - -// Combined factory/"add to list" methods: -RebMenus :: Item_Unimplemented* -RebMenus :: CompositeItem :: AddUnimplementedItem -( - OnOffAppearance theOnOffApp -) -{ - Item_Unimplemented* pItem = new Item_Unimplemented - ( - theOnOffApp - ); - - AddToList - ( - pItem - ); - - return pItem; -} - -RebMenus :: Item_Command* -RebMenus :: CompositeItem :: AddNewCommandItem -( - OnOffAppearance theOnOffApp, - Command* pCommand -) -{ - GLOBALASSERT( pCommand ); - - Item_Command* pItem = new Item_Command - ( - theOnOffApp, - pCommand - ); - - AddToList - ( - pItem - ); - - return pItem; -} - -RebMenus :: Item_Command* -RebMenus :: CompositeItem :: AddNewJumpItem -( - OnOffAppearance theOnOffApp, - enum PageID theDst -) -{ - Command_JumpToPage* pCommand = new Command_JumpToPage - ( - theDst - ); - - Item_Command* pItem = new Item_Command - ( - theOnOffApp, - pCommand - ); - - pCommand -> R_Release(); - - AddToList - ( - pItem - ); - - return pItem; -} - -RebMenus :: Item_Selection* -RebMenus :: CompositeItem :: AddNewSelectionItem -( - OnOffAppearance theOnOffApp, - enum Direction initDir, - SelectionVariable* pSelectionVar -) -{ - Item_Selection* pItem = new Item_Selection - ( - theOnOffApp, - initDir, - pSelectionVar - ); - - AddToList - ( - pItem - ); - - return pItem; -} - -RebMenus :: Item_Slider* -RebMenus :: CompositeItem :: AddNewSliderItem -( - OnOffAppearance theOnOffApp, - enum Direction initDir, - BoundedExportVariable* pBoundedExpVar -) -{ - Item_Slider* pItem = new Item_Slider - ( - theOnOffApp, - initDir, - pBoundedExpVar - ); - - AddToList - ( - pItem - ); - - return pItem; -} - -RebMenus :: Item_Toggle* -RebMenus :: CompositeItem :: AddNewToggleItem -( - OnOffAppearance theOnOffApp_Label, - enum Direction initDir, - OnOffAppearance theOnOffApp_Choice, - ExportVariable* pExpVar -) -{ - Item_Toggle* pItem = new Item_Toggle - ( - theOnOffApp_Label, - initDir, - theOnOffApp_Choice, - pExpVar - ); - - AddToList - ( - pItem - ); - - return pItem; -} - -RebMenus :: CompositeItem* -RebMenus :: CompositeItem :: AddNewCompositeItem -( - OnOffAppearance theOnOffApp, - enum Direction theD, - enum Alignment theAlignment_New -) -{ - CompositeItem* pItem = new CompositeItem - ( - theOnOffApp, - theD, - theAlignment_New - ); - - AddToList - ( - pItem - ); - - return pItem; -} - -RebMenus :: Item* -RebMenus :: CompositeItem :: AddNewCancelItem -( - OnOffAppearance theOnOffApp -) -{ - Command_ReturnFromPage* pCommand = new Command_ReturnFromPage(); - - Item* pItem = new Item_Command - ( - theOnOffApp, - pCommand - ); - - pCommand -> R_Release(); - - AddToList - ( - pItem - ); - - return pItem; -} - -void -RebMenus :: CompositeItem :: AddNewItem_Special(Item* pItem) -{ - GLOBALASSERT(pItem); - - AddToList(pItem); -} - - -// Process various keypresses: -OurBool -RebMenus :: CompositeItem :: Navigate( enum NavigationOp aNavOp ) -{ - // return = was message processed - - if ( NumItems >0 ) - { - // Pass to selected child for processing: - if - ( - !( GetSelected() -> Navigate( aNavOp ) ) - ) - { - // then selected child couldn't process it, this composite should have a go: - switch ( aNavOp ) - { - case NavOp_Up: - { - if ( theDir == D_Vert ) - { - if ( SelectedItem > 0) - { - SelectedItem--; - GetSelected() -> Selected_Hook - ( - aNavOp - ); - return Yes; - } - else - { - if ( Wraparound :: bEnabled() ) - { - SelectedItem = NumItems-1; - GetSelected() -> Selected_Hook - ( - aNavOp - ); - return Yes; - } - else - { - return No; - } - } - } - else - { - return No; - } - } - case NavOp_Down: - { - if ( theDir == D_Vert ) - { - if ( SelectedItem < (NumItems-1)) - { - SelectedItem++; - GetSelected() -> Selected_Hook - ( - aNavOp - ); - return Yes; - } - else - { - if ( Wraparound :: bEnabled() ) - { - SelectedItem = 0; - GetSelected() -> Selected_Hook - ( - aNavOp - ); - return Yes; - } - else - { - return No; - } - } - } - else - { - return No; - } - } - - case NavOp_Left: - { - if ( theDir == D_Horiz ) - { - if ( SelectedItem > 0) - { - SelectedItem--; - GetSelected() -> Selected_Hook - ( - aNavOp - ); - return Yes; - } - else - { - if ( Wraparound :: bEnabled() ) - { - SelectedItem = NumItems-1; - GetSelected() -> Selected_Hook - ( - aNavOp - ); - return Yes; - } - else - { - return No; - } - } - } - else - { - return No; - } - } - case NavOp_Right: - { - if ( theDir == D_Horiz ) - { - if ( SelectedItem < (NumItems-1)) - { - SelectedItem++; - GetSelected() -> Selected_Hook - ( - aNavOp - ); - return Yes; - } - else - { - if ( Wraparound :: bEnabled() ) - { - SelectedItem = 0; - GetSelected() -> Selected_Hook - ( - aNavOp - ); - return Yes; - } - else - { - return No; - } - } - } - else - { - return No; - } - } - - case NavOp_Home: - { - SelectedItem=0; - GetSelected() -> Selected_Hook - ( - aNavOp - ); - return Yes; - } - - case NavOp_End: - { - SelectedItem=(NumItems-1); - GetSelected() -> Selected_Hook - ( - aNavOp - ); - return Yes; - } - - case NavOp_Trigger: - { - return No; - } - - case NavOp_Cancel: - { - Page :: TryToReturn(); - return Yes; - } - - default: - GLOBALASSERT(0); - } - } - } - // else: no items to navigate - - if ( aNavOp == NavOp_Cancel ) - { - // don't need any items for this to work - Page :: TryToReturn(); - return Yes; - } - - - return No; - -} - -void -RebMenus :: CompositeItem :: Diagnostic(OurBool bSelected) const -{ - { - textprint("CompositeItem ::Diagnostic()... "); - - DiagnosticAppearance(bSelected); - } - - textprint("NumItems=%i\n",NumItems); - - for (int i=0;i" - : - " " - ); - - pItem_A[i]->Diagnostic(i==SelectedItem); - // or should the "selected" nature also depend on whether the - // parent is selected? - } -} - -RebMenus :: Item* -RebMenus :: CompositeItem :: GetSelected(void) const -{ - // will return NULL iff there are no items in the composition - if (NumItems>0) - { - return pItem_A[SelectedItem]; - } - else - { - return NULL; - } -} - -// Methods relating to rendering: -void -RebMenus :: CompositeItem :: Render -( - const RenderContext& theContext, - OurBool bSelected -) const -{ - r2size R2Size_Composite = GetSizeInfo() . GetMin(); - int nonIterationAxisSize_Composite = - ( - theDir == D_Vert - ? - R2Size_Composite . w - : - R2Size_Composite . h - ); - - // Always render appearance (the title) centred - { - SizeInfo titleSizeInfo = AppearanceSizeInfo(); - - r2pos titlePos = theContext . Pos(); - - if ( theDir == D_Vert ) - { - titlePos . x += ( R2Size_Composite . w - titleSizeInfo . GetMin() . w)/2; - } - else - { - titlePos . y += ( R2Size_Composite . h - titleSizeInfo . GetMin() . h)/2; - } - - RenderContext titleContext = RenderContext - ( - theContext . ClipRect(), // r2rect R2Rect_Clip_New, - titlePos, // r2pos R2Pos_At_New, - // top-left hotspot - 0 // int Column0_W_New - // width of 1st column - ); - - RenderAppearance - ( - titleContext, - bSelected - ); - } - - - // Iterate through items, calling Render(): - r2pos R2Pos_I - ( - theContext . Pos() - ); - - // Adjust position for any title: - { - SizeInfo titleSizeInfo = AppearanceSizeInfo(); - - if ( theDir == D_Horiz ) - { - R2Pos_I . x += titleSizeInfo . GetMin() . w + ItemSpacing(); - } - else - { - R2Pos_I . y += titleSizeInfo . GetMin() . h + ItemSpacing(); - } - } - - #if 0 - SizeInfo thisSizeInfo = GetSizeInfo(); - - R2Pos_I . x -= (thisSizeInfo . GetMin() . w/2); - R2Pos_I . y -= (thisSizeInfo . GetMin() . h/2); - #endif - - for (int i=0;i GetSizeInfo() . GetMin(); - - int nonIterationAxisSize_I = - ( - theDir == D_Vert - ? - R2Size_I . w - : - R2Size_I . h - ); - - switch ( theAlignment_Val ) - { - case Align_Min: - { - // means "left-aligned" for V-composition, "top-aligned" for H-Composition - // so leave untouched - } - break; - - case Align_Centre: - { - // means "centred about X" for V-composition, "centred about Y" for H-Composition - // so centre the nonIterationAxis - nonIterationAxisPos_I += ( nonIterationAxisSize_Composite - nonIterationAxisSize_I)/2; - // could be negative; this equation ought to still be valid - } - break; - - case Align_Max: - { - // increase the nonIterationAxis to maximal value that will fit - nonIterationAxisPos_I += ( nonIterationAxisSize_Composite - nonIterationAxisSize_I); - // could be negative; this equation ought to still be valid - } - break; - - default: - GLOBALASSERT(0); - break; - } - - r2pos R2Pos_ToUse = - ( - theDir == D_Vert - ? - r2pos( nonIterationAxisPos_I, theIterationAxisPos_I ) - : - r2pos( theIterationAxisPos_I, nonIterationAxisPos_I ) - ); - - RenderContext yourContext - ( - theContext.ClipRect(), // r2rect R2Rect_Clip_New, - R2Pos_ToUse, // r2pos R2Pos_At_New - theContext.Column0_W() - ); - - pItem_A[i] -> Render - ( - yourContext, - ( - bSelected && (SelectedItem == i) - ) - ); - - if ( theDir == D_Horiz ) - { - R2Pos_I . x += R2Size_I . w + ItemSpacing(); - } - else - { - R2Pos_I . y += R2Size_I . h + ItemSpacing(); - } - } -} - -RebMenus :: SizeInfo -RebMenus :: CompositeItem :: GetSizeInfo(void) const -{ - SizeInfo SizeInfo_ToReturn - ( - #if 1 - r2size(0,0), - 0 - #else - AppearanceSizeInfo() . GetMin(), - AppearanceSizeInfo() . GetColumn0_minW() - #endif - ); - - for (int i=0;i GetSizeInfo(); - - #if 1 - SizeInfo_ToReturn . Compose - ( - itemSizeInfo, - theDir, - theAlignment_Val - ); - - #else - - r2size ItemSize_Min = itemSizeInfo . GetMin(); - - if ( theDir == D_Horiz ) - { - AppSize_Min . HCompose - ( - ItemSize_Min - ); - - if (i!=0) - { - AppSize_Min . w += ItemSpacing(); - } - } - else - { - AppSize_Min . VCompose - ( - ItemSize_Min - ); - - if ( max_Column0_minW < itemSizeInfo . GetColumn0_minW() ) - { - max_Column0_minW = itemSizeInfo . GetColumn0_minW(); - } - - if (i!=0) - { - AppSize_Min . h += ItemSpacing(); - } - } - #endif - } - - #if 1 - return SizeInfo_ToReturn; - #else - return SizeInfo - ( - AppSize_Min, - max_Column0_minW - ); - #endif -} - - -// private: -void -RebMenus :: CompositeItem :: AddToList -( - Item* pItem_ToAdd -) -{ - GLOBALASSERT(NumItems < MAX_ITEMS_PER_LIST ); - - pItem_A[ NumItems++ ] = pItem_ToAdd; - - - if (NumItems == 1) - { - // then this was the first item added: - SelectedItem = 0; - } -} - -// static -int RebMenus :: CompositeItem :: ItemSpacing(void) -{ - return 2; -} - - -void -RebMenus :: Page :: MiniStack :: Push(enum PageID in) -{ - if (NumItems < NUM_PAGES_MEMORY) - { - theA[ NumItems++ ] = in; - } - else - { - // one falls off the bottom; shuffle everything up - GLOBALASSERT( NumItems == NUM_PAGES_MEMORY ); - - for (int i=0;i<(NUM_PAGES_MEMORY-1);i++) - { - theA[i] = theA[i+1]; - } - - // ...and set the end element: - theA[NUM_PAGES_MEMORY-1] = in; - } -} - -OurBool -RebMenus :: Page :: MiniStack :: Pop(enum PageID& out) -{ - // return value: was there anything? - if ( NumItems > 0) - { - out = theA[--NumItems]; - return Yes; - } - else - { - return No; - } -} - -void -RebMenus :: Page :: MiniStack :: Diagnostic(void) -{ - textprint("page stack: num pages = %i\n",NumItems); - - for (int i=0;i=0); - GLOBALASSERT(inID=0); - GLOBALASSERT(inID Hook_LeavingPage(); - - // Set the all-important variable: - SelectedPageID = inID; - - // Call hook for entering the new page: - GetSelected() -> Hook_EnteringPage(); -} - - -// private: -// static -RebMenus :: Page* RebMenus :: Page :: pPage[ NUM_PAGE_IDS ]; -// static -enum PageID RebMenus :: Page :: SelectedPageID = PageID_Initial; -// static -RebMenus :: Page :: MiniStack -RebMenus :: Page :: thePageStack; - - -// class Wraparound -// static -const OurBool RebMenus :: Wraparound :: bEnabled_Val = Yes; - -// Globals within RebMenus: -void RebMenus :: Init(void) -{ - ProjectSpecific :: Init(); -} - -void RebMenus :: UnInit(void) -{ - ProjectSpecific :: UnInit(); - - // Destroy all menu pages: - { - - } -} - -void RebMenus :: Maintain(void) -{ - textprint("RebMenus::Maintain()\n"); - - ProjectSpecific :: Maintain(); - - #if 1 - { - Page* pPage = Page :: GetSelected(); - GLOBALASSERT( pPage ); - - pPage -> Diagnostic(Yes); - } - #endif -} - -// static -void -RebMenus :: Render(void) -{ - textprint("RebMenus :: Render()\n"); - - Page* pPage = Page :: GetSelected(); - GLOBALASSERT( pPage ); - - SizeInfo theSizeInfo = pPage -> GetSizeInfo(); - - pPage -> Render - ( - RenderContext - ( - r2rect::PhysicalScreen(), // r2rect R2Rect_Clip_New, - - r2rect::PhysicalScreen() . CentredWithSize_TL - ( - theSizeInfo . GetMin() - ), // r2pos R2Pos_At_New - - theSizeInfo . GetColumn0_minW() // int Column0_W_New - ), - Yes //OurBool bSelected - ); -} - - -// namespace Bitmap -namespace RebMenus -{ - namespace Bitmap - { - class Implementation - { - private: - class CacheEntry - { - public: - CacheEntry - ( - const char* const pCh_Name_New - ); - ~CacheEntry(); - - static void Empty(void) - { - while (List_pCacheEntry . size() > 0) - { - delete List_pCacheEntry . first_entry(); - } - } - - void Blit_Transparent - ( - r2rect R2Rect_Clip, - r2pos dstR2Pos - ); - - r2size GetSize(void) const - { - return R2Size; - } - - static CacheEntry* Get(const char* const pCh_Name); - - private: - const char* const pCh_Name_Val; - LPDIRECTDRAWSURFACE pSurface; - AW_BACKUPTEXTUREHANDLE hBackup; - r2size R2Size; - - static List List_pCacheEntry; - // maintains a set of all of these - // really ought to do this as a hash table (potentially using Jake's - // template), but no need for the moment - }; - private: - - - - public: - static void Precache(const char* const pCh_Name) - { - new CacheEntry(pCh_Name); - } - - static void UnCache(const char* const pCh_Name) - { - CacheEntry* pEntry = CacheEntry :: Get(pCh_Name); - - if (!pEntry) { return; } - - delete pEntry; - } - - static void EmptyCache(void) - { - CacheEntry :: Empty(); - } - - static void Blit_Transparent - ( - const char* const pCh_Name, - r2rect R2Rect_Clip, - r2pos dstR2Pos - ) - { - CacheEntry* pEntry = CacheEntry :: Get(pCh_Name); - - if (!pEntry) - { - pEntry = new CacheEntry(pCh_Name); - } - - GLOBALASSERT( pEntry ); - - pEntry -> Blit_Transparent - ( - R2Rect_Clip, - dstR2Pos - ); - } - static r2size GetSize(const char* const pCh_Name) - { - CacheEntry* pEntry = CacheEntry :: Get(pCh_Name); - - if (!pEntry) - { - pEntry = new CacheEntry(pCh_Name); - } - - GLOBALASSERT( pEntry ); - - return pEntry -> GetSize(); - } - - }; - }; -}; - -RebMenus :: Bitmap :: Implementation :: CacheEntry :: CacheEntry -( - const char* const pCh_Name_New -) : pCh_Name_Val(pCh_Name_New) -{ - unsigned nWidth,nHeight; - - pSurface = AwCreateSurface - ( - "sfXYB", - pCh_Name_Val, - ( - 0 - ), // flags - &nWidth, - &nHeight, - &hBackup - ); - ATIncludeSurface(pSurface,hBackup); - - - R2Size . w = nWidth; - R2Size . h = nHeight; - - List_pCacheEntry . add_entry(this); -} - -RebMenus :: Bitmap :: Implementation :: CacheEntry :: ~CacheEntry() -{ - List_pCacheEntry . delete_entry(this); - - GLOBALASSERT(pSurface); - ATRemoveSurface(pSurface); - ReleaseDDSurface(pSurface); - pSurface = NULL; - - if (hBackup) - { - AwDestroyBackupTexture(hBackup); - } - - hBackup = NULL; - -} - -void -RebMenus :: Bitmap :: Implementation :: CacheEntry :: Blit_Transparent -( - r2rect R2Rect_Clip, - r2pos dstR2Pos -) -{ - if - ( - r2rect - ( - dstR2Pos, - GetSize() - ) . bFitsIn( R2Rect_Clip ) - ) - { - RECT destRect; - - destRect.left = dstR2Pos . x; - destRect.top = dstR2Pos . y; - - destRect.right = dstR2Pos . x + R2Size . w; - destRect.bottom = dstR2Pos . y + R2Size . h; - - - RECT srcRect; - - srcRect.left =0; - srcRect.top =0; - srcRect.right = R2Size . w; - srcRect.bottom = R2Size . h; - - #if 1 - DDBLTFX tempDDBltFx; - - memset(&tempDDBltFx,0,sizeof(DDBLTFX)); - - tempDDBltFx . dwSize = sizeof(DDBLTFX); - tempDDBltFx . ddckSrcColorkey . dwColorSpaceLowValue = 0; - tempDDBltFx . ddckSrcColorkey . dwColorSpaceHighValue = 0; - #endif - - HRESULT ddrval = lpDDSBack->Blt - ( - &destRect, - pSurface, - #if 1 - NULL, - #else - &srcRect, - #endif - ( - DDBLT_WAIT - #if 0 - | DDBLT_KEYSRC - #else - | DDBLT_KEYSRCOVERRIDE - #endif - ), - &tempDDBltFx // LPDDBLTFX lpDDBltFx - ); - - #if 0 - if(ddrval != DD_OK) - { - ReleaseDirect3D(); - exit(0x666009); - } - #endif - } - // else reject as I can't be bothered to write clipping code -} - -// static -RebMenus :: Bitmap :: Implementation :: CacheEntry* -RebMenus :: Bitmap :: Implementation :: CacheEntry :: Get(const char* const pCh_Name) -{ - GLOBALASSERT( pCh_Name ); - - // A simple linear search for now: - for - ( - LIFoi(&List_pCacheEntry); - !oi . done(); - oi . next() - ) - { - if - ( - strcmp - ( - pCh_Name, - oi() -> pCh_Name_Val - ) == 0 - ) - { - return oi(); - } - } - return NULL; -} - -// static -List -RebMenus :: Bitmap :: Implementation :: CacheEntry :: List_pCacheEntry; - - -void -RebMenus :: Bitmap :: Precache(const char* const pCh_Name) -{ - GLOBALASSERT( pCh_Name ); - - Implementation :: Precache(pCh_Name); -} - -void -RebMenus :: Bitmap :: UnCache(const char* const pCh_Name) -{ - GLOBALASSERT( pCh_Name ); - Implementation :: UnCache(pCh_Name); -} - -void -RebMenus :: Bitmap :: EmptyCache(void) -{ - Implementation :: EmptyCache(); -} -void -RebMenus :: Bitmap :: Blit_Transparent -( - const char* const pCh_Name, - r2rect R2Rect_Clip, - r2pos dstR2Pos -) -{ - GLOBALASSERT( pCh_Name ); - Implementation :: Blit_Transparent - ( - pCh_Name, - R2Rect_Clip, - dstR2Pos - ); -} - -r2size -RebMenus :: Bitmap :: GetSize(const char* const pCh_Name) -{ - GLOBALASSERT( pCh_Name ); - - return Implementation :: GetSize(pCh_Name); -} - -#endif - // UseRebMenus - - - - - -/* Internal function definitions ***********************************/ diff --git a/src/avp/support/rebmenus.hpp b/src/avp/support/rebmenus.hpp deleted file mode 100644 index d969d35..0000000 --- a/src/avp/support/rebmenus.hpp +++ /dev/null @@ -1,981 +0,0 @@ -/* - - rebmenus.hpp - -*/ - -#ifndef _rebmenus_hpp -#define _rebmenus_hpp 1 - - #if ( defined( __WATCOMC__ ) || defined( _MSC_VER ) ) - #pragma once - #endif - -/* Version settings *****************************************************/ - #define UseRebMenus Yes - // If this is set, then the new menus are compiled in, and take - // effect in-game - // If this is set to no, then the new menus don't compile in - - #define OverrideOldMenus Yes - // If this is set, then the new menus also override the out-of-game - // menus. Don't set this without setting UseRebMenus - - #define SupportTextprintBeforeGame No - // however, this causes a problem in the second call - // to InitialiseTextures(), but only outside the debugger, - // so it's a real pain to debug - -/* Includes *************************************************************/ -#if UseRebMenus - #ifdef __cplusplus - #ifndef _ourbool - #include "ourbool.h" - #endif - - #if 0 - #ifndef _scstring - #include "scstring.hpp" - #endif - #endif - - #ifndef _command - #include "command.hpp" - #endif - - #ifndef _r2base - #include "r2base.h" - #endif - - #if 0 - // Expects an enum "FontIndex" for the font to be defined in PROJFONT.H - #ifndef _projfont - #include "projfont.h" - #endif - #endif - - #ifndef _expvar_hpp - #include "expvar.hpp" - #endif - - #ifndef _projmenu_hpp - #include "projmenu.hpp" - // Include project specific header. - /* - It is assumed that this project specific header will define - the following: - - - an "enum PageID" enumeration of the various pages in the menus; - they must range in value from 0 inclusive to NUM_PAGE_IDS exclusive - (currently gaps are allowed in the range, but an array of pointers - gets defined so don't be excessive) - - - a TextID typedef giving an enumeration of text string IDs from - the language localisation table - - - functions: - void Init(void) - void UnInit(void) - void Maintain(void) - within scope ProjectSpecific (either namespace or public static in a class) - inside namespace RebMenus. They can be empty, but typically - you should construct your menu pages within them. - - - a scope (class or namespace) Fonts containing - ( static ) - FontIndex RebMenus :: Fonts :: GetIndex(OurBool bSelected) - to tell the text code which font to use for labels - */ - - #endif - #endif - /* __cplusplus */ -#endif - // UseRebMenus - - - -/* Constants ***********************************************************/ - -/* Macros ***************************************************************/ - -/* Type definitions *****************************************************/ -#if UseRebMenus -#ifdef __cplusplus - #define DUMMY_TEXTID ((TextID)0) - -namespace RebMenus -{ - #if 0 - // perhaps has some kind of message passing hook: - class Message - { - }; - // derived classes for keydown messages, mouse messages, etc - // But how is it interrogated? - // (you have two class hierarchies, with a single process fn) - // - // What class have I forgotten? - - // need a class with somd kind of hook for either processing - // a messages, or passing it down the chain of responsibility - // (a boolean return type to say whether it's been processed?) - - class MessageProcessor - { - - }; - - class Selectable : MessageProcessor //????? - { - }; - #endif - enum Direction - { - D_Horiz, - D_Vert - }; - - enum Alignment - { - Align_Min, - // means "left-aligned" for V-composition, "top-aligned" for H-Composition - - Align_Centre, - // means "centred about X" for V-composition, "centred about Y" for H-Composition - - Align_Max - // means "right-aligned" for V-composition, "bottom-aligned" for H-Composition - - }; - - enum NavigationOp - { - NavOp_Up = 0, - NavOp_Down, - NavOp_Left, - NavOp_Right, - NavOp_Home, - NavOp_End, - NavOp_Trigger, - NavOp_Cancel, - - NUM_NAVIGATION_OPS - }; - - // Name of a bitmap, for referring to bitmaps in an appearance: - class BitmapName - { - public: - BitmapName - ( - char* pCh_New - ) : pCh_Val(pCh_New) - { - } - BitmapName() : pCh_Val(NULL) - { - } - const char* const Get(void) const - { - return pCh_Val; - } - - private: - const char* const pCh_Val; - }; - - // Name of an FMV sequence, for referring to FMV sequences in an appearance: - class FMVName - { - public: - FMVName - ( - char* pCh_New - ) : pCh_Val(pCh_New) - { - } - FMVName() : pCh_Val(NULL) - { - } - const char* const Get(void) const - { - return pCh_Val; - } - - private: - const char* const pCh_Val; - }; - - namespace Bitmap - { - void Precache(const char* const pCh_Name); - void UnCache(const char* const pCh_Name); - void EmptyCache(void); - - void Blit_Transparent - ( - const char* const pCh_Name, - r2rect R2Rect_Clip, - r2pos dstR2Pos - ); - - r2size GetSize(const char* const pCh_Name); - }; - - // Menu-specific commands: - class Command_JumpToPage : public Command - { - public: - Command_JumpToPage - ( - enum PageID thePage - ) : Command(), - thePage_Val(thePage) - { - } - OurBool Execute(void); - - private: - const enum PageID thePage_Val; - }; - - class Command_ReturnFromPage : public Command - { - public: - OurBool Execute(void); - }; - - // Class for describing size requirements of things in the menus - // Currently only support a "minimum size" idea - class SizeInfo - { - public: - SizeInfo - ( - r2size minR2Size, - int Column0_minW - ) : minR2Size_Val(minR2Size), - Column0_minW_Val(Column0_minW) - { - } - r2size GetMin(void) const - { - return minR2Size_Val; - } - int GetColumn0_minW(void) const - { - return Column0_minW_Val; - } - - SizeInfo Overlay - ( - SizeInfo other - ); - - SizeInfo AddColumn - ( - SizeInfo nextColumn - ); - - SizeInfo AddRow - ( - SizeInfo nextRow - ); - - void Compose - ( - const SizeInfo& other, - enum Direction theD, - enum Alignment theAl - ); - private: - r2size minR2Size_Val; - int Column0_minW_Val; - - }; - - - class RenderContext - { - public: - RenderContext - ( - r2rect R2Rect_Clip_New, - r2pos R2Pos_At_New, - // top-left hotspot - int Column0_W_New - // width of 1st column - ) : R2Rect_Clip_Val(R2Rect_Clip_New), - R2Pos_At_Val(R2Pos_At_New), - Column0_W_Val(Column0_W_New) - { - } - r2rect ClipRect(void) const {return R2Rect_Clip_Val;} - r2pos Pos(void) const {return R2Pos_At_Val;} - int Column0_W(void) const {return Column0_W_Val;} - r2pos Pos_Column1(void) const - { - return r2pos - ( - R2Pos_At_Val . x + Column0_W_Val, - R2Pos_At_Val . y - ); - } - - RenderContext NextColumn(void) const - { - return RenderContext - ( - R2Rect_Clip_Val, - Pos_Column1(), - 0 - ); - } - - private: - r2rect R2Rect_Clip_Val; - r2pos R2Pos_At_Val; - int Column0_W_Val; - }; - - // 9/3/98 DHM: A "policy" pattern for what an item sould look like: - // ("Design Patterns" would call it a "strategy", but since that word - // is already overused in 3DC et al I prefer the alternate name "policy") - class Appearance - { - public: - // Use just a text label: - Appearance - ( - TextID ID_Label - ) : bHasTextLabel(Yes), - ID_Label_Val(ID_Label), - bHasBitmap(No), - bHasFMV(No) - { - } - - // Use just a bitmap: - Appearance - ( - BitmapName inBMapName - ) : bHasTextLabel(No), - ID_Label_Val(DUMMY_TEXTID), - bHasBitmap(Yes), - BMapN_Val(inBMapName), - bHasFMV(No) - { - } - - // Don't have any appearance at all = invisible - Appearance - ( - ) : bHasTextLabel(No), - ID_Label_Val(DUMMY_TEXTID), - bHasBitmap(No), - bHasFMV(No) - { - } - - // Other possible appearances might be: - // - bitmaps, - // - fmv sequences, - // - combos of the above - // etc - - void Diagnostic(void) const; - - // Methods relating to rendering: - void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - SizeInfo GetSizeInfo(void) const; - - private: - const OurBool bHasTextLabel; - const TextID ID_Label_Val; - - const OurBool bHasBitmap; - const BitmapName BMapN_Val; - - const OurBool bHasFMV; - const FMVName FMVN_Val; - }; - - // An appearance with two states: - class OnOffAppearance - { - public: - // Constructors - OnOffAppearance - ( - Appearance App_On, - Appearance App_Off - ) : App_On_Val(App_On), - App_Off_Val(App_Off) - { - // most general constructor: independent appearances, one for - // "on", the other for "off" - } - - OnOffAppearance - ( - Appearance App_Shared - ) : App_On_Val(App_Shared), - App_Off_Val(App_Shared) - { - // easy way to give something the same appearance both on and off - } - - OnOffAppearance - ( - TextID ID_Label - ) : App_On_Val(Appearance(ID_Label)), - App_Off_Val(Appearance(ID_Label)) - { - // easy way of setting up a text label - } - - OnOffAppearance - ( - ) : App_On_Val(Appearance()), - App_Off_Val(Appearance()) - { - // easy way to set up something as invisible both on and off - } - - - Appearance GetAppearance(OurBool bOn) const - { - return - ( - bOn - ? - App_On_Val - : - App_Off_Val - ); - } - - SizeInfo GetSizeInfo(void) const; - - private: - Appearance App_On_Val; - Appearance App_Off_Val; - }; - - class SelectionVariable - { - protected: - SelectionVariable - ( - BoundedExportVariable* pBoundedExpVar - // takes responsibility for deleting this - ) : pBoundedExpVar_Val(pBoundedExpVar) - { - } - - public: - virtual ~SelectionVariable() - { - delete pBoundedExpVar_Val; - } - - virtual Appearance GetAppearance(OurBool bSelected) = 0; - - // Chain-of-responsibility onto the bounded export var: - int Get(void) const - { - return pBoundedExpVar_Val -> Get(); - } - - int GetMin(void) const - { - return pBoundedExpVar_Val -> GetMin(); - } - int GetMax(void) const - { - return pBoundedExpVar_Val -> GetMax(); - } - int GetNxt(void) const - { - int CurrentVal = pBoundedExpVar_Val -> Get(); - if ( CurrentVal < pBoundedExpVar_Val -> GetMax() ) - { - return ++CurrentVal; - } - else - { - return pBoundedExpVar_Val -> GetMin(); - } - } - int GetPrv(void) const - { - int CurrentVal = pBoundedExpVar_Val -> Get(); - if ( CurrentVal > pBoundedExpVar_Val -> GetMin() ) - { - return --CurrentVal; - } - else - { - return pBoundedExpVar_Val -> GetMax(); - } - } - void Set(int NewVal) - { - pBoundedExpVar_Val -> Set(NewVal); - } - - private: - BoundedExportVariable* pBoundedExpVar_Val; - }; - - - - // Class for a list of discrete selections with appearances and values: - template class Selection - { - class Selectable - { - public: - Selectable - ( - Appearance theApp, - T theValue - ) : App_Val(theApp), - T_Val(theValue) - { - } - Appearance GetAppearance(void) const - { - return App_Val; - } - T GetValue(void) const - { - return T_Val; - } - private: - const Appearance App_Val; - const T T_Val; - }; - - class SelectionList - { - public: - SelectionList - ( - ) : NumInList(0) - { - } - - void AddSelection - ( - Selectable Sel_ToAdd - ) - { - if ( NumInList < MAX_IN_LIST ) - { - theSel_A[NumInList++] = Sel_ToAdd; - } - } - private: - int NumInList; - Selectable theSel_A[MAX_IN_LIST]; - public: - ~SelectionList(); - }; - }; - - - class Item - { - public: - OurBool bSelectable(void); - // items can be temporarily or permanently unselectable - // e.g. "greyed out" - - /////////////// PURE VIRTUAL FUNCTIONS /////////////////////////////// - public: - // Process various keypresses: - virtual OurBool Navigate( enum NavigationOp aNavOp ) = 0; - // return = was message processed - - virtual void Diagnostic(OurBool bSelected) const = 0; - - virtual void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const = 0; - - virtual SizeInfo GetSizeInfo(void) const = 0; - - - public: - void DiagnosticAppearance(OurBool bSelected) const; - - // Methods relating to rendering: - void RenderAppearance - ( - const RenderContext& theContext, - OurBool bSelected - ) const - { - theOnOffApp_Val . GetAppearance - ( - bSelected - ) . Render - ( - theContext, - bSelected - ); - } - SizeInfo AppearanceSizeInfo(void) const - { - return theOnOffApp_Val . GetSizeInfo(); - } - - - public: - virtual void Selected_Hook - ( - enum NavigationOp // theNavOp - ) - { - // empty default implementation - } - - protected: - Item - ( - OnOffAppearance theOnOffApp_New - ) : theOnOffApp_Val(theOnOffApp_New) - { - // empty inline constructor; but protected so must use - // a derived class. - } - - virtual ~Item() - { - } - - private: - OnOffAppearance theOnOffApp_Val; - }; - - // Proposed derived classes of Item: - class Item_Unimplemented; - - class Item_Command; - // contains a command; can contain a "goto menu page" command - - class Item_Selection; - - class Item_Slider; - - class Item_Toggle; - - class Item_KeyConfig_PageView; - - // A composition of items. - // There will exist a selected item iff there are any items contained - // in this composition - class CompositeItem : public Item - { - public: - CompositeItem - ( - OnOffAppearance theOnOffApp_New, - enum Direction theD, - enum Alignment theAlignment_New - ) : Item(theOnOffApp_New), - NumItems(0), - theDir(theD), - theAlignment_Val(theAlignment_New) - { - // what value should SelectedItem have when there aren't any items? - } - - // Combined factory/"add to list" methods: - Item_Unimplemented* AddUnimplementedItem - ( - OnOffAppearance theOnOffApp - ); - - Item_Command* AddNewCommandItem - ( - OnOffAppearance theOnOffApp, - Command* pCommand - ); - - Item_Command* AddNewJumpItem - ( - OnOffAppearance theOnOffApp, - enum PageID theDst - ); - - Item_Selection* AddNewSelectionItem - ( - OnOffAppearance theOnOffApp, - enum Direction initDir, - SelectionVariable* pSelectionVar - ); - - Item_Slider* AddNewSliderItem - ( - OnOffAppearance theOnOffApp, - enum Direction initDir, - BoundedExportVariable* pBoundedExpVar - ); - - Item_Toggle* AddNewToggleItem - ( - OnOffAppearance theOnOffApp_Label, - enum Direction initDir, - OnOffAppearance theOnOffApp_Choice, - ExportVariable* pExpVar - ); - - CompositeItem* AddNewCompositeItem - ( - OnOffAppearance theOnOffApp, - enum Direction theD, - enum Alignment theAlignment_New - ); - - Item* AddNewCancelItem - ( - OnOffAppearance theOnOffApp - ); - - void AddNewItem_Special(Item* pItem); - - // Process various keypresses: - OurBool Navigate( enum NavigationOp aNavOp ); - // return = was message processed - - virtual void Diagnostic(OurBool bSelected) const; - - Item* GetSelected(void) const; - // will return NULL iff there are no items in the composition - - // Get index of next selectable - #if 0 - // what if all disabled? - - // what if wraparound turned off? - - ItemIndex NxtSelectable(void) const; - ItemIndex PrvSelectable(void) const; - #endif - - // Methods relating to rendering: - virtual void Render - ( - const RenderContext& theContext, - OurBool bSelected - ) const; - - virtual SizeInfo GetSizeInfo(void) const; - - - private: - void AddToList - ( - Item* pItem_ToAdd - ); - static int ItemSpacing(void); - - // List of selectables: - enum {MAX_ITEMS_PER_LIST = 20}; - - int NumItems; - Item* pItem_A[ MAX_ITEMS_PER_LIST ]; - - #if 1 - int SelectedItem; - #else - // Selected item: - IndexInRange theIIR; - #endif - - // Direction: - const enum Direction theDir; - - // Alignment: - const enum Alignment theAlignment_Val; - - // selection list contains a list of selectables; - // has a selected child. - - // Has an "enum direction": - // if D_Horiz, interprets left/right as moving the selection - // if D_Vert, interprets up/down as moving the selection - - // Considered doing it with two separate classes, but makes it nasty - // to derive stuff off them - - }; - - - class Page : public CompositeItem - { - // This class maintains a static array - // mapping of PageIDs to Page*s - // There can be at most one Page of each ID; the class implements - // a kind of array of singletons - // (See "Design Patterns" Addison-Wesley 1994) - - // The precise classes derived from Page are project-specific. A project might - // choose to derive a new class used by all of its pages, or have - // a separate class for each page, or any combination in between. - - // An internal class for storing a history of menu pages visited: - class MiniStack - { - // A small stack; when it gets full, the items - // at the bottom are lost - // Originally done as a template, but Jonathon told be to stop being too - // clever for my own good... - - public: - enum { NUM_PAGES_MEMORY = 16 }; - - public: - MiniStack() : NumItems(0) - { - } - - void Push(enum PageID in); - - OurBool Pop(enum PageID& out); - // return value: was there anything? - - void Diagnostic(void); - - void Clear(void); - - private: - int NumItems; - enum PageID theA[ NUM_PAGES_MEMORY ]; - }; - - protected: - Page - ( - Appearance theApp_New, - enum Direction theD, - enum Alignment theAlignment_New, - PageID theID - ); - - ~Page(); - - public: - void Diagnostic(OurBool bSelected) const; - - static void SelectPage(enum PageID inID); - static void SelectPage_ClearingStack(enum PageID inID); - static void TryToReturn(void); - - static Page* Get(enum PageID inID); - static Page* GetSelected(void); - - private: - // Every page can have hook functions for entering/leaving the page - // These are private since they're only to be called by the page selection - // function - // Default implementation is empty; specific pages can override this. - virtual void Hook_EnteringPage(void) - { - } - virtual void Hook_LeavingPage(void) - { - } - - private: - static void Internal_SelectPage_NoPush( enum PageID inID ); - // Worker function to call hooks and actually change the page - // Used by SelectPage() and TryToReturn() - // Doesn't push current page onto page stack - - - private: - - const PageID theID_Val; - static Page* pPage[ NUM_PAGE_IDS ]; - - static enum PageID SelectedPageID; - - static MiniStack thePageStack; - }; - - - // What happens if you compose various levels of selection list? - // - - // Is a menu page a type of selection list; if so, how does it respond - // to cursor keys? - - // - - // now - - class Wraparound - { - public: - static OurBool bEnabled(void) - { - return bEnabled_Val; - } - - private: - const static OurBool bEnabled_Val; - }; - - // Globals within RebMenus: - void Init(void); - void UnInit(void); - void Maintain(void); - void Render(void); - - -}; // end of namespace RebMenus -#endif // __cplusplus -#endif // UseRebMenus -/* Exported globals *****************************************************/ - -/* Function prototypes **************************************************/ -#ifdef __cplusplus - extern "C" - { -#endif - - extern void REBMENUS_ProjectSpecific_EndOfMainLoopHook(void); - -#ifdef __cplusplus - }; -#endif - -/* End of the header ****************************************************/ - - -#endif - - - - - - - - - - - - - - diff --git a/src/avp/win95/frontend/avp_intro.cpp b/src/avp/win95/frontend/avp_intro.cpp index ee26dfc..8356131 100644 --- a/src/avp/win95/frontend/avp_intro.cpp +++ b/src/avp/win95/frontend/avp_intro.cpp @@ -2,7 +2,6 @@ extern "C" { #include "3dc.h" - //#include "intro.hpp" #include "inline.h" //#include "smacker.h" #include "avp_menus.h" diff --git a/src/avp/win95/frontend/avp_intro.h b/src/avp/win95/frontend/avp_intro.h index 09ce400..90e5d2a 100644 --- a/src/avp/win95/frontend/avp_intro.h +++ b/src/avp/win95/frontend/avp_intro.h @@ -1,6 +1,15 @@ #ifndef AVP_INTRO_H #define AVP_INTRO_H -void PlayMenuMusic(void); +#ifdef __cplusplus +extern "C" +{ +#endif + void PlayMenuMusic(void); + void PlayIntroSequence(void); + void WeWantAnIntro(void); +#ifdef __cplusplus +}; +#endif #endif diff --git a/src/avp/win95/intro.cpp b/src/avp/win95/intro.cpp deleted file mode 100644 index 951c293..0000000 --- a/src/avp/win95/intro.cpp +++ /dev/null @@ -1,359 +0,0 @@ -#if 0 -/* KJL 13:52:20 28/03/98 - game intro */ -#include "3dc.h" -#include "intro.hpp" -#include "menugfx.h" - -extern "C" -{ - #include "inline.h" - #include "smacker.h" - extern int NormalFrameTime; - extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; - extern DDPIXELFORMAT DisplayPixelFormat; - extern LPDIRECTDRAWSURFACE lpDDSBack; - extern int GotAnyKey; - -}; -extern void DirectReadKeyboard(void); - - - - -static MENUGRAPHIC Presents = -{ - "Graphics\\NewMenus\\presents.rim", -1, NULL, NULL, 0, 0, 640, 480, -}; - -static MENUGRAPHIC RebellionLogo = -{ - "Graphics\\NewMenus\\ARebellionGame.rim", -1, NULL, NULL, 0, 0, 640, 480, -}; -static MENUGRAPHIC AvPLogo = -{ - "Graphics\\NewMenus\\AliensVPredator.rim", -1, NULL, NULL, 0, 0, 640, 480, -}; - -extern MENUGRAPHIC Starfield_Backdrop; -static IntroHasAlreadyBeenPlayed = 1; - - -void Show_Presents(void); -void Show_ARebellionGame(void); -void Show_AvPLogo(void); -void DrawGraphicWithAlphaChannel(MENUGRAPHIC *image, int alpha); -void DrawGraphicWithFadingLevel(MENUGRAPHIC *image, int alpha); - -extern "C" -{ - void WeWantAnIntro(void) - { - IntroHasAlreadyBeenPlayed = 0; - } -} - -void PlayIntroSequence(void) -{ - if (IntroHasAlreadyBeenPlayed) - { - /* play music */ - StartMenuMusic(); - return; - } - IntroHasAlreadyBeenPlayed=1; - - /* load the graphics we'll need later, so as to avoid glitches */ - LoadMenuGraphic(&Presents); - LoadMenuGraphic(&RebellionLogo); - LoadMenuGraphic(&AvPLogo); - - /* play the Fox Interactive FMV */ - PlayFMV("FMVs/fox640.smk"); - - /* play music */ - StartMenuMusic(); - - ResetFrameCounter(); - - Show_Presents(); - if (!GotAnyKey) Show_ARebellionGame(); - if (!GotAnyKey) Show_AvPLogo(); - - /* unload the graphics */ - ReleaseMenuGraphic(&Presents); - ReleaseMenuGraphic(&RebellionLogo); - ReleaseMenuGraphic(&AvPLogo); - -} -void Show_Presents(void) -{ - int timeRemaining = 8*ONE_FIXED; - do - { - { - PlayMenuMusic(); - - if (timeRemaining > 7*ONE_FIXED) - { - DrawGraphicWithFadingLevel(&Starfield_Backdrop,timeRemaining-7*ONE_FIXED); - } - else if (timeRemaining > 6*ONE_FIXED) - { - BLTMenuToScreen(&Starfield_Backdrop); - } - else if (timeRemaining > 5*ONE_FIXED) - { - BLTMenuToScreen(&Starfield_Backdrop); - DrawGraphicWithAlphaChannel(&Presents,timeRemaining-5*ONE_FIXED); - } - else if (timeRemaining > 4*ONE_FIXED) - { - BLTMenuToScreen(&Starfield_Backdrop); - DrawGraphicWithAlphaChannel(&Presents,0); - } - else if (timeRemaining > 3*ONE_FIXED) - { - BLTMenuToScreen(&Starfield_Backdrop); - DrawGraphicWithAlphaChannel(&Presents,4*ONE_FIXED-timeRemaining); - } - else - { - BLTMenuToScreen(&Starfield_Backdrop); - } - - FlipBuffers(); - } - DirectReadKeyboard(); - FrameCounterHandler(); - timeRemaining-=NormalFrameTime; - } - while(timeRemaining>0 && !GotAnyKey); -} - -void Show_ARebellionGame(void) -{ - int timeRemaining = 7*ONE_FIXED; - do - { - { - BLTMenuToScreen(&Starfield_Backdrop); - PlayMenuMusic(); - - if (timeRemaining > 13*ONE_FIXED/2) - { - DrawGraphicWithAlphaChannel(&RebellionLogo,timeRemaining*2-13*ONE_FIXED); - } - else if (timeRemaining > 5*ONE_FIXED) - { - DrawGraphicWithAlphaChannel(&RebellionLogo,0); - } - else if (timeRemaining > 3*ONE_FIXED) - { - DrawGraphicWithAlphaChannel(&RebellionLogo, ONE_FIXED - (timeRemaining-3*ONE_FIXED)/2); - } - - FlipBuffers(); - } - DirectReadKeyboard(); - FrameCounterHandler(); - timeRemaining-=NormalFrameTime; - } - while(timeRemaining>ONE_FIXED/4 && !GotAnyKey); -} -void Show_AvPLogo(void) -{ - int timeRemaining = 5*ONE_FIXED; - do - { - { - BLTMenuToScreen(&Starfield_Backdrop); - PlayMenuMusic(); - - if (timeRemaining > 9*ONE_FIXED/2) - { - DrawGraphicWithAlphaChannel(&AvPLogo,timeRemaining*2-9*ONE_FIXED); - } - else if (timeRemaining > 4*ONE_FIXED) - { - DrawGraphicWithAlphaChannel(&AvPLogo,0); - } - else - { - DrawGraphicWithAlphaChannel(&AvPLogo, ONE_FIXED - timeRemaining/4); - } - - FlipBuffers(); - } - DirectReadKeyboard(); - FrameCounterHandler(); - timeRemaining-=NormalFrameTime; - } - while(timeRemaining>0 && !GotAnyKey); -} - - - - -void DrawGraphicWithAlphaChannel(MENUGRAPHIC *image, int alpha) -{ - DDSURFACEDESC ddsdback, ddsdimage; - - unsigned short *srcPtr; - unsigned short *destPtr; - - long destPitch; - - memset(&ddsdback, 0, sizeof(ddsdback)); - memset(&ddsdimage, 0, sizeof(ddsdimage)); - ddsdback.dwSize = sizeof(ddsdback); - ddsdimage.dwSize = sizeof(ddsdimage); - - alpha = ONE_FIXED-alpha; - - - /* lock the image */ - while ((image->image_ptr)->Lock(NULL, &ddsdimage, DDLOCK_WAIT, NULL) == DDERR_WASSTILLDRAWING); - - /* lock the backbuffer */ - while (lpDDSBack->Lock(NULL, &ddsdback, DDLOCK_WAIT, NULL) == DDERR_WASSTILLDRAWING); - - destPtr = (unsigned short *)ddsdimage.lpSurface; - destPitch = ddsdimage.lPitch - ddsdimage.dwWidth; - - // okay, now we have the surfaces, we can copy from one to the other, - // darkening pixels as we go - { - int x,y; - - for (y=(ScreenDescriptorBlock.SDB_Height - image->height)/2; y<(ScreenDescriptorBlock.SDB_Height - image->height)/2+image->height; y++) - { - srcPtr = (unsigned short *)ddsdback.lpSurface + (ScreenDescriptorBlock.SDB_Width - image->width)/2; - srcPtr += y*ddsdback.lPitch/2; - - for (x=0; xwidth; x++) - { - - if (*destPtr) - { - unsigned int srcR,srcG,srcB; - unsigned int destR,destG,destB; - - srcR = (int)(*srcPtr) & DisplayPixelFormat.dwRBitMask; - srcG = (int)(*srcPtr) & DisplayPixelFormat.dwGBitMask; - srcB = (int)(*srcPtr) & DisplayPixelFormat.dwBBitMask; - - destR = (int)(*destPtr) & DisplayPixelFormat.dwRBitMask; - destG = (int)(*destPtr) & DisplayPixelFormat.dwGBitMask; - destB = (int)(*destPtr) & DisplayPixelFormat.dwBBitMask; - #if 0 - srcR = destR + MUL_FIXED(alpha,srcR - destR); - if (srcR>DisplayPixelFormat.dwRBitMask) srcR = DisplayPixelFormat.dwRBitMask; - else srcR &= DisplayPixelFormat.dwRBitMask; - - srcG = destG + MUL_FIXED(alpha,srcG - destG); - if (srcG>DisplayPixelFormat.dwGBitMask) srcG = DisplayPixelFormat.dwGBitMask; - else srcG &= DisplayPixelFormat.dwGBitMask; - - srcB = destB + MUL_FIXED(alpha,srcB - destB); - if (srcB>DisplayPixelFormat.dwBBitMask) srcB = DisplayPixelFormat.dwBBitMask; - else srcB &= DisplayPixelFormat.dwBBitMask; - #else - srcR += MUL_FIXED(alpha,destR); - if (srcR>DisplayPixelFormat.dwRBitMask) srcR = DisplayPixelFormat.dwRBitMask; - else srcR &= DisplayPixelFormat.dwRBitMask; - - srcG += MUL_FIXED(alpha,destG); - if (srcG>DisplayPixelFormat.dwGBitMask) srcG = DisplayPixelFormat.dwGBitMask; - else srcG &= DisplayPixelFormat.dwGBitMask; - - srcB += MUL_FIXED(alpha,destB); - if (srcB>DisplayPixelFormat.dwBBitMask) srcB = DisplayPixelFormat.dwBBitMask; - else srcB &= DisplayPixelFormat.dwBBitMask; - #endif - *srcPtr = (short)(srcR|srcG|srcB); - } - srcPtr++; - destPtr++; - } - destPtr += (ddsdimage.lPitch/2) - image->width; - } - } - - lpDDSBack->Unlock((LPVOID)ddsdback.lpSurface); - (image->image_ptr)->Unlock((LPVOID)ddsdimage.lpSurface); - -} -void DrawGraphicWithFadingLevel(MENUGRAPHIC *image, int alpha) -{ - DDSURFACEDESC ddsdback, ddsdimage; - - unsigned short *srcPtr; - unsigned short *destPtr; - - long destPitch; - - memset(&ddsdback, 0, sizeof(ddsdback)); - memset(&ddsdimage, 0, sizeof(ddsdimage)); - ddsdback.dwSize = sizeof(ddsdback); - ddsdimage.dwSize = sizeof(ddsdimage); - - alpha = ONE_FIXED-alpha; - - - /* lock the image */ - while ((image->image_ptr)->Lock(NULL, &ddsdimage, DDLOCK_WAIT, NULL) == DDERR_WASSTILLDRAWING); - - /* lock the backbuffer */ - while (lpDDSBack->Lock(NULL, &ddsdback, DDLOCK_WAIT, NULL) == DDERR_WASSTILLDRAWING); - - destPtr = (unsigned short *)ddsdimage.lpSurface; - destPitch = ddsdimage.lPitch - ddsdimage.dwWidth; - - // okay, now we have the surfaces, we can copy from one to the other, - // darkening pixels as we go - { - int x,y; - - for (y=(ScreenDescriptorBlock.SDB_Height - image->height)/2; y<(ScreenDescriptorBlock.SDB_Height - image->height)/2+image->height; y++) - { - srcPtr = (unsigned short *)ddsdback.lpSurface + (ScreenDescriptorBlock.SDB_Width - image->width)/2; - srcPtr += y*ddsdback.lPitch/2; - - for (x=0; xwidth; x++) - { - - if (*destPtr) - { - unsigned int srcR,srcG,srcB; - - srcR = (int)(*destPtr) & DisplayPixelFormat.dwRBitMask; - srcG = (int)(*destPtr) & DisplayPixelFormat.dwGBitMask; - srcB = (int)(*destPtr) & DisplayPixelFormat.dwBBitMask; - - srcR = MUL_FIXED(alpha,srcR); - srcR &= DisplayPixelFormat.dwRBitMask; - - srcG = MUL_FIXED(alpha,srcG); - srcG &= DisplayPixelFormat.dwGBitMask; - - srcB = MUL_FIXED(alpha,srcB); - srcB &= DisplayPixelFormat.dwBBitMask; - - *srcPtr = (short)(srcR|srcG|srcB); - } - else - { - *srcPtr = 0; - } - srcPtr++; - destPtr++; - } - destPtr += (ddsdimage.lPitch/2) - image->width; - } - } - - lpDDSBack->Unlock((LPVOID)ddsdback.lpSurface); - (image->image_ptr)->Unlock((LPVOID)ddsdimage.lpSurface); - -} -#endif \ No newline at end of file diff --git a/src/avp/win95/intro.hpp b/src/avp/win95/intro.hpp deleted file mode 100644 index e795290..0000000 --- a/src/avp/win95/intro.hpp +++ /dev/null @@ -1,10 +0,0 @@ -extern void PlayIntroSequence(void); - -#ifdef __cplusplus -extern "C" -{ -#endif - extern void WeWantAnIntro(void); -#ifdef __cplusplus -}; -#endif diff --git a/src/avp/win95/menuplat.cpp b/src/avp/win95/menuplat.cpp deleted file mode 100644 index 72f740e..0000000 --- a/src/avp/win95/menuplat.cpp +++ /dev/null @@ -1,1228 +0,0 @@ -/*KJL*************************** -* Platform specific menu stuff * -* Transplanted from ddplat.cpp * -***************************KJL*/ - -/* KJL 14:41:13 04/28/97 - I hate this code so much, I put it -in a separate file so that I could keep an eye on it. */ -extern "C" { - -#include "3dc.h" -#include "module.h" -#include "inline.h" -#include "dxlog.h" - -#include - -#include "stratdef.h" -#include "gamedef.h" -#include "gameplat.h" -#include "bh_types.h" - -#include "equipmnt.h" - -#include "huddefs.h" -#include "hudgfx.h" - -#include "font.h" - -#include "menudefs.h" -#include "menugfx.h" -#include "pcmenus.h" - -#include "krender.h" -#include "chnktexi.h" -#include "language.h" - -#include "awTexLd.h" -#include "alt_tab.h" - -extern "C++" -{ -#include "projload.hpp" // c++ header which ignores class definitions/member functions if __cplusplus is not defined ? -#include "chnkload.hpp" // c++ header which ignores class definitions/member functions if __cplusplus is not defined ? -}; -extern void SelectMenuDisplayMode(void); - - -extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; - -extern DDPIXELFORMAT DisplayPixelFormat; - -extern RIFFHANDLE player_rif; - -/***************** Functions ******************/ -// RWH - unashamably stolen from the PSX -/****************** GAMESTART *****************/ -// THESE ARE THE GRAPHICS WE NEED -MENU_GRAPHIC_ITEM Gamestart_MenuItems[] = -{ - { - -1, - } -}; - -MENUGRAPHIC Gamestart_Backdrop = -{ - "menugfx\\pg0.pg0", -1, NULL, NULL, 0, 0, 640, 480, -}; - - -/* Hardcoded text centring since FJ_CENTRED doesn't work in BLTstring - (some highlighted characters have different widths from their non-highlighted versions?!) -*/ -MENU_TEXT_ITEM Gamestart_MenuFItems[] = -{ - { NEW_GAME_ITEM,TEXTSTRING_MAINMENUS_NEWGAME, NULL, 271, 160 }, - { LOAD_GAME_ITEM, TEXTSTRING_MAINMENUS_LOADGAME, NULL, 268, 180 }, - { OPTIONS_ITEM, TEXTSTRING_MAINMENUS_OPTIONS, NULL, 282, 200 }, - { DEMO_ITEM, TEXTSTRING_MAINMENUS_DEMO, NULL, 293, 220 }, - { MULTIPLAYER_ITEM, TEXTSTRING_MAINMENUS_MULTIPLAYER, NULL, 232, 240 }, - { QUIT_ITEM, TEXTSTRING_MAINMENUS_EXIT, NULL, 297, 270 }, - { -1, } -}; - - -AVP_MENU GameStartMenu = -{ - &Gamestart_Backdrop, - &Gamestart_MenuItems[0], - &Gamestart_MenuFItems[0], - -1, - 0, -}; - - -/**************** CHOOSE CHAR ****************/ - -MENU_GRAPHIC_ITEM ChooseCharacter_MenuGItems[] = -{ - { - ALIEN_ITEM, - {"menugfx\\pg1A.pg0",-1,NULL, NULL, 0, 0, 0, 0,}, - {"NONE", -1, NULL,NULL,}, - }, - { - MARINE_ITEM, - {"menugfx\\pg1M.pg0",-1,NULL, NULL, 208, 0, 0, 0,}, - {"NONE",-1, NULL,NULL,}, - }, - { - PREDATOR_ITEM, - {"menugfx\\pg1P.pg0",-1,NULL, NULL, 420, 0, 0, 0,}, - {"NONE",-1, NULL,NULL,}, - }, - { - -1, - } - -}; - - -MENU_TEXT_ITEM ChooseCharacter_MenuFItems[] = -{ - { EXIT_ITEM, TEXTSTRING_MAINMENUS_EXIT, NULL, 300, 440 }, - { -1, } -}; - - -MENUGRAPHIC ChooseCharacter_Backdrop = -{ - "menugfx\\pg1.pg0", -1, NULL, NULL, 0, 0, 640, 480, -}; - - -AVP_MENU CharacterMenu = -{ - &ChooseCharacter_Backdrop, - &ChooseCharacter_MenuGItems[0], - &ChooseCharacter_MenuFItems[0], - -1, - 0, -}; - - - -/**************** ALIEN BRIEFING ****************/ - -MENU_GRAPHIC_ITEM AlienBriefing_MenuGItems[] = -{ - { -1, } -}; - - -MENU_TEXT_ITEM AlienBriefing_MenuFItems[] = -{ - { ENTER_GAME_ALIEN, TEXTSTRING_MAINMENUS_STARTGAME, NULL, 200, 440 }, - { EXIT_ITEM_ALIEN, TEXTSTRING_MAINMENUS_EXIT, NULL, 400, 440 }, - { -1, } -}; - -MENUGRAPHIC AlienBriefing_Backdrop = -{"menugfx\\pg2a.pg0",-1, NULL, NULL, 0,0,0,0,}; - -AVP_MENU AlienBriefing = -{ - &AlienBriefing_Backdrop, - AlienBriefing_MenuGItems, - AlienBriefing_MenuFItems, - -1, - 0, -}; - - -/******************* PREDATOR BRIEFING ***************/ - -MENU_GRAPHIC_ITEM PredatorBriefing_MenuGItems[] = -{ - { -1, } -}; - -MENU_TEXT_ITEM PredatorBriefing_MenuFItems[] = -{ - { ENTER_GAME_PREDATOR, TEXTSTRING_MAINMENUS_STARTGAME, NULL, 200, 440 }, - { EXIT_ITEM_PREDATOR, TEXTSTRING_MAINMENUS_EXIT, NULL, 400, 440 }, - { -1, } -}; - -MENUGRAPHIC PredatorBriefing_Backdrop = -{"menugfx\\pg2b.pg0", -1, NULL, NULL, 0,0,0,0}; - -AVP_MENU PredatorBriefing = -{ - &PredatorBriefing_Backdrop, - &PredatorBriefing_MenuGItems[0], - &PredatorBriefing_MenuFItems[0], - -1, - 0, -}; - - -/********************** MARINE BRIEFING **************/ - - -MENU_TEXT_ITEM MarineBriefing_MenuFItems[] = -{ - { ENTER_GAME_MARINE, TEXTSTRING_MAINMENUS_STARTGAME, NULL, 200, 440 }, - { EXIT_ITEM_MARINE, TEXTSTRING_MAINMENUS_EXIT, NULL, 400, 440 }, - { -1, } -}; - -MENU_GRAPHIC_ITEM MarineBriefing_MenuGItems[] = -{ - -#if 0 - { - MALE_MARINE_FACE, - {MARPROF2,-1,NULL,NULL, 189, 42, 52,52,}, - {MARPROF2,-1,NULL,NULL, 189, 42, 52,52,}, - }, - { - FEMALE_MARINE_FACE, - {MARPROF2,-1,NULL,NULL, 249, 42, 52,52,}, - {MARPROF2,-1,NULL,NULL, 249, 42, 52,52,}, - }, -#endif - { - -1, - } -}; - -MENUGRAPHIC MarineBriefing_Backdrop = {"menugfx\\pg2c.pg0", -1, NULL, NULL, 0,0,0,0}; - -AVP_MENU MarineBriefing = -{ - &MarineBriefing_Backdrop, - &MarineBriefing_MenuGItems[0], - &MarineBriefing_MenuFItems[0], - -1, - 0, -}; - - -#if 0 -/********************** LOAD MENU **************/ - -MENU_TEXT_ITEM LoadGame_MenuFItems[] = -{ - { ENTER_GAME_MARINE, TEXTSTRING_MAINMENUS_STARTGAME, NULL, 200, 440 }, - { EXIT_ITEM_MARINE, TEXTSTRING_MAINMENUS_EXIT, NULL, 400, 440 }, - { -1, } -}; - -MENU_GRAPHIC_ITEMLoadGame_MenuItems[] = -{ - { -1, } -}; - - -MENUGRAPHIC Load_Backdrop = {"menugfx\\pg2c.pg0", -1, NULL, NULL, 0,0,0,0}; - -AVP_MENU LoadGame = -{ - &LoadGame_Backdrop, - &LoadGame_MenuGItems[0], - &LoadGame_MenuFItems[0], - -1, - 0, -}; - -#endif - - -AVP_MENU *Current_Menu; - -extern void DrawInternationalizedString(MENU_TEXT_ITEM *itemPtr, int highlighted); -extern void DrawMenuBackdrop(void); - -void LoadMenuGraphics(int menu_id) -{ - // this loads up the correct menu items - effectively - // it is a draw menu items function - - switch (menu_id) - { - case CHOOSE_GAMESTART: - Current_Menu=&GameStartMenu; - break; - case CHOOSE_CHARACTER: - Current_Menu=&CharacterMenu; - break; - case CHOOSE_OPTIONS: - Current_Menu=&OptionsMenuData; - break; - case MARINE_BRIEFING: - Current_Menu=&MarineBriefing; - break; - case PREDATOR_BRIEFING: - Current_Menu=&PredatorBriefing; - break; - case ALIEN_BRIEFING: - Current_Menu=&AlienBriefing; - break; - default: - break; - } - ProcessGraphicForLoading(Current_Menu); -} - -// okay lets load the menu graphics - -void ProcessGraphicForLoading(AVP_MENU *menu_to_load) -{ - MENU_GRAPHIC_ITEM *menuitemptr; - menuitemptr = menu_to_load->menugitems; - - LoadMenuGraphic(menu_to_load->backdrop); - - while (menuitemptr->id != -1) - { - if(strcmp(menuitemptr->On.filename, "NONE")) - LoadMenuGraphic(&menuitemptr->On); - if(strcmp(menuitemptr->Off.filename, "NONE")) - LoadMenuGraphic(&menuitemptr->Off); - menuitemptr++; - } -} - - -void UnLoadMenuGraphics(int menu_id) -{ - // this loads up the correct menu items - effectively - // it is a draw menu items function - -// int a; - - switch (menu_id) - { - case CHOOSE_GAMESTART: - Current_Menu=&GameStartMenu; - break; - case CHOOSE_CHARACTER: - Current_Menu=&CharacterMenu; - break; - case CHOOSE_OPTIONS: - Current_Menu=&OptionsMenuData; - break; - case MARINE_BRIEFING: - Current_Menu=&MarineBriefing; - break; - case PREDATOR_BRIEFING: - Current_Menu=&PredatorBriefing; - break; - case ALIEN_BRIEFING: - Current_Menu=&AlienBriefing; - GLOBALASSERT(menu_id==ALIEN_BRIEFING); - break; - default: - break; - } - ProcessGraphicForUnloading(Current_Menu); -} - -void ProcessGraphicForUnloading(AVP_MENU *menu_to_unload) -{ - MENU_GRAPHIC_ITEM *menuitemptr; - // okay lets Unload the menu graphics - ReleaseMenuGraphic(menu_to_unload->backdrop); - menuitemptr=menu_to_unload->menugitems; - - while (menuitemptr->id != -1) - { - if(strcmp(menuitemptr->On.filename, "NONE")) - ReleaseMenuGraphic(&menuitemptr->On); - if(strcmp(menuitemptr->Off.filename, "NONE")) - ReleaseMenuGraphic(&menuitemptr->Off); - menuitemptr++; - } -} - - -/* JH 12/5/97 - no longer static function */ -void LoadMenuGraphic(MENUGRAPHIC* menugraphptr) -{ - /* - Weapons - - The hud direct draw surfaces are stored in - system memory. It is only the current weapon that is - cashed into video memory - - First we attach the weapons direct draw surface to the - Direct Draw lpDD. We then lock the newly created surface and draw the - weapon image into it. FIle in the rest of the HUD graphic and then - exit - */ - - /* - set up the direct draw surface. we can take the width and height - from the imageheader image - */ - // JH 17/2/98 - just a bit of a wrapper to AwCreateSurface now... - - unsigned nWidth,nHeight; - - GLOBALASSERT(menugraphptr); - menugraphptr->image_ptr = AwCreateSurface("sfXYB",menugraphptr->filename,AW_TLF_TRANSP|AW_TLF_CHROMAKEY,&nWidth,&nHeight,&menugraphptr->hBackup); - menugraphptr->width = nWidth; - menugraphptr->height = nHeight; - GLOBALASSERT(menugraphptr->image_ptr); - GLOBALASSERT(menugraphptr->hBackup); - GLOBALASSERT(menugraphptr->width>0); - GLOBALASSERT(menugraphptr->height>0); - ATIncludeSurface(menugraphptr->image_ptr,menugraphptr->hBackup); -} - - - -void DeIlluminate(int menuitem) -{ - - /***** Menuitem comes from the enum. Match it to id. *****/ - - int num_menu_item = 0; - - MENU_GRAPHIC_ITEM *ThisMenuGItem = NULL; - MENU_TEXT_ITEM *ThisMenuFItem = NULL; - - - // lok throught the array of graphic oitems and font - // items, and draw the menu item we have been passed - - while (Current_Menu->menugitems[num_menu_item].id!=-1) - { - - if(Current_Menu->menugitems[num_menu_item].id==menuitem) - { - ThisMenuGItem=&Current_Menu->menugitems[num_menu_item]; - } - num_menu_item++; - } - - num_menu_item = 0; - while (Current_Menu->menufitems[num_menu_item].id!=-1) - { - if(Current_Menu->menufitems[num_menu_item].id==menuitem) - { - ThisMenuFItem=&Current_Menu->menufitems[num_menu_item]; - } - num_menu_item++; - } - - - if(ThisMenuGItem != NULL) - { - if(strcmp(ThisMenuGItem->Off.filename, "NONE")) - BLTMenuToScreen(&ThisMenuGItem->Off); - } - - if(ThisMenuFItem != NULL) - { - DrawInternationalizedString(ThisMenuFItem,0); - } - -} - - - -void Illuminate(int menuitem) -{ - - /***** Menuitem comes from the enum. Match it to id. *****/ - - int num_menu_item = 0; - - MENU_GRAPHIC_ITEM *ThisMenuGItem = NULL; - MENU_TEXT_ITEM *ThisMenuFItem = NULL; - - - // lok throught the array of graphic oitems and font - // items, and draw the menu item we have been passed - - while (Current_Menu->menugitems[num_menu_item].id!=-1) - { - - if(Current_Menu->menugitems[num_menu_item].id==menuitem) - { - ThisMenuGItem=&Current_Menu->menugitems[num_menu_item]; - } - num_menu_item++; - } - - - num_menu_item = 0; - while (Current_Menu->menufitems[num_menu_item].id!=-1) - { - if(Current_Menu->menufitems[num_menu_item].id==menuitem) - { - ThisMenuFItem=&Current_Menu->menufitems[num_menu_item]; - } - num_menu_item++; - } - - - if(ThisMenuGItem != NULL) - { - if(strcmp(ThisMenuGItem->On.filename, "NONE")) - BLTMenuToScreen(&ThisMenuGItem->On); - } - - if(ThisMenuFItem != NULL) - { - DrawInternationalizedString(ThisMenuFItem,1); - } - - // okay, now we draw a -} - -extern HINSTANCE AVP_HInstance, hInst; -extern int AVP_NCmd; - - -static RIFFHANDLE menu_rif = INVALID_RIFFHANDLE; - -void PlatformSpecificEnteringMenus(void) -{ - // Load and process the font - SelectMenuDisplayMode(); - - SetCursor(NULL); - - - - cl_pszGameMode = "menus"; - - if(menu_rif == INVALID_RIFFHANDLE) - { - menu_rif = load_rif("menugfx\\menugfx.rif"); - LoadPFFont(MENU_FONT_1); - } - - if(menu_rif == INVALID_RIFFHANDLE) - { - GLOBALASSERT(0); - } - -} - -void PlatformSpecificExitingMenus(void) -{ - // just need to release the DD surface - // lets leave the rects as valid, so we can - // do lazy eval of the font char rects if we want - int fadeLevel=65536; - while(fadeLevel>=0) - { - /* fade screen to black */ - SetPaletteFadeLevel(fadeLevel); - fadeLevel-= 2048; - } - - UnloadFont(&AvpFonts[MENU_FONT_1]); - unload_rif(menu_rif);//get rid of File_Chunk - menu_rif = INVALID_RIFFHANDLE; - BlankScreen(); -} - - -void DrawMenuBackdrop(void) -{ - BLTMenuToScreen(Current_Menu->backdrop); -} - -/* KJL 15:54:28 03/20/97 - intro hack variable */ -int WhiteOutLevel; -extern int NormalFrameTime; - -extern int VideoMode; -extern void (*UpdateScreen[]) (void); - -void DrawEntireMenuScreen(void) -{ - /***** Frankly, I don't care which menu. *****/ - - int a; - - DrawMenuBackdrop(); - - a=0; - - while (CurrentMenuStatus[a]!=-1) - { - - if (CurrentMenuStatus[a]!=0) - { - Illuminate(a); - } - else - { - DeIlluminate(a); - } - - a++; - } - - UpdateScreen[VideoMode](); - - /* KJL 15:52:41 03/20/97 - hack from intro that's ended up here */ - { - // fade in - if (WhiteOutLevel==0) - { - int fadeLevel = 0; - do - { - ResetFrameCounter(); - FadePaletteToWhite(TestPalette,fadeLevel); - fadeLevel+=NormalFrameTime*4; - FrameCounterHandler(); - } - while(fadeLevel<65536); - - ChangePalette(TestPalette); - WhiteOutLevel=65536; - } - } - -} - - - -/* JH 12/5/97 - no longer static functions */ - -void ReleaseMenuGraphic(MENUGRAPHIC* mptr) -{ - GLOBALASSERT(mptr); - GLOBALASSERT(mptr->image_ptr); - ATRemoveSurface(mptr->image_ptr); - ReleaseDDSurface(mptr->image_ptr); - mptr->image_ptr = NULL; - if (mptr->hBackup) - AwDestroyBackupTexture(mptr->hBackup); - mptr->hBackup = NULL; -} - - - -/* - Windows externs. See win_func -*/ - - - -void BLTMenuToScreen(MENUGRAPHIC* menuptr) -{ - /* - sets up the drawing of general hud graphics. Bltted - to full screen if there is no width and heiht information in - the DD HUDGRAPHIC - */ - - RECT destRect; - RECT scrRect; - HRESULT ddrval; - - GLOBALASSERT(menuptr != NULL); - - scrRect.top = 0; - scrRect.bottom = menuptr->height; - scrRect.left = 0; - scrRect.right = menuptr->width; - - - destRect.top = menuptr->desty; - destRect.bottom = menuptr->desty + menuptr->height; - destRect.left = menuptr->destx; - destRect.right = menuptr->destx + menuptr->width; - - ddrval = lpDDSBack->Blt(&destRect, menuptr->image_ptr, &scrRect, DDBLT_WAIT, NULL); - - if(ddrval != DD_OK) - { - ReleaseDirect3D(); - exit(0x666009); - } -} - - -void DrawInternationalizedString(MENU_TEXT_ITEM *itemPtr, int highlighted) -{ - char textBuffer[100]; - char *destPtr = textBuffer; - char offset; - - /* KJL 17:39:03 05/03/97 - I hate Roxby. Due to the way he's set up the menu font - I have to add 27+'a'-'A' (!) to each letter if I want it *not* to be highlighted. */ - if (!highlighted) - { - offset = 27+'a'-'A'; - } - else - { - offset = 0; - } - - if (itemPtr->StringID != TEXTSTRING_BLANK) - { - /* copy the string into the buffer */ - char *sourcePtr = GetTextString(itemPtr->StringID); - - while(*sourcePtr) - { - /* Roxby has a lot to answer for... */ - *destPtr++ = offset + (*sourcePtr++); - } - - /* if another string follows this string, add a space */ - if (itemPtr->SecondStringPtr) - { - *destPtr++=' '; - } - } - - /* add second string, if it exists */ - if (itemPtr->SecondStringPtr) - { - char *sourcePtr = itemPtr->SecondStringPtr; - - while(*sourcePtr) - { - /* Roxby has a lot to answer for... */ - *destPtr++ = offset + (*sourcePtr++); - } - } - - /* add null terminator to end of string */ - *destPtr = 0; - - { - FONT_DESC packet; - packet.fontnum = MENU_FONT_1; - packet.string = textBuffer; - packet.destx = itemPtr->X; - packet.desty = itemPtr->Y; - packet.just = FJ_LEFT_JUST; - packet.width = 320; - - BLTString(packet); - } -} - - - - -/*KJL******* -* DATABASE * -*******KJL*/ -#include "database.h" -void LoadDDGraphic2(struct DDGraphicTag *DDGfxPtr, char *Filename); -static void GetMessageName(char* messagename); - -static RIFFHANDLE dbgfx_rif = INVALID_RIFFHANDLE; - - - -struct DDGraphicTag DatabaseBackground; -struct DatabaseGraphicsDataTag -{ - char *Filename; - int X; /* top-left coords */ - int Y; -}; - - - -LPDIRECTDRAWSURFACE lpDDSInGameMenuBackdrop; -extern LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface - - -static int DatabaseInitialised = 1; - -void InitialiseDatabaseGraphics() -{ - // load up the fonts - - LoadPFFont(DATABASE_FONT_DARK); - LoadPFFont(DATABASE_FONT_LITE); - LoadPFFont(DATABASE_MESSAGE_FONT); - - - { - DDSURFACEDESC ddsd; - HRESULT ddrval; - - // attach a system memory back buffer so we can record - // what is on the screen before we enter the menus - - // Create back buffer - memset(&ddsd,0,sizeof(DDSURFACEDESC)); - ddsd.dwSize = sizeof(DDSURFACEDESC); - ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; - ddsd.dwHeight = ScreenDescriptorBlock.SDB_Height; - ddsd.dwWidth = ScreenDescriptorBlock.SDB_Width; - - // Request a 3D capable device so that - // Direct3D accesses will work - ddsd.ddsCaps.dwCaps = - ( - DDSCAPS_OFFSCREENPLAIN | - DDSCAPS_SYSTEMMEMORY | - DDSCAPS_3DDEVICE - ); - - ddrval = lpDD->CreateSurface(&ddsd, &lpDDSInGameMenuBackdrop, NULL); - LOGDXERR(ddrval); - if (ddrval != DD_OK) - #if debug - { - ReleaseDirect3D(); - exit(0x1055); - } - #else - return; - #endif - } -} - - - - - - -void PlatformSpecificEnteringDatabase(void) -{ - - - // lets make a copy of the back buffer, and in the process darken the - // colours by half - - // first, take a lock for both surfaces - - - DDSURFACEDESC ddsdback; - DDSURFACEDESC ddsdmenu; - unsigned char *src, *dest, *srcStart, *destStart; - long srcPitch, destPitch; - HRESULT ddrval; - - - memset(&ddsdback, 0, sizeof(ddsdback)); - ddsdback.dwSize = sizeof(ddsdback); - - memset(&ddsdmenu, 0, sizeof(ddsdmenu)); - ddsdmenu.dwSize = sizeof(ddsdmenu); - - - // take a lock of the back buffer - - while ((ddrval = lpDDSBack->Lock(NULL, &ddsdback, DDLOCK_WAIT, NULL)) == DDERR_WASSTILLDRAWING) - { - LOGDXERR(ddrval); - ReleaseDirect3D(); - exit(0x2021); - } - - LOGDXERR(ddrval); - if (ddrval != DD_OK) - { - #if debug - ReleaseDirect3D(); - exit(ddrval); - #else - return; - #endif - } - - /* ddsdback now contains my lpSurface)*/ - - src = srcStart = (unsigned char *)ddsdback.lpSurface; - srcPitch = ddsdback.lPitch - ddsdback.dwWidth; - - - // take a lock of the menubackdrop buffer - - - while ((ddrval = lpDDSInGameMenuBackdrop->Lock(NULL, &ddsdmenu, DDLOCK_WAIT, NULL)) == DDERR_WASSTILLDRAWING) - { - LOGDXERR(ddrval); - ReleaseDirect3D(); - exit(0x2022); - } - - LOGDXERR(ddrval); - if (ddrval != DD_OK) - { - #if debug - ReleaseDirect3D(); - exit(ddrval); - #else - return; - #endif - } - - destStart = (unsigned char *)ddsdmenu.lpSurface; - destPitch = ddsdmenu.lPitch - ddsdmenu.dwWidth; - - - - // okay, now we have the surfaces, we can copy from one to the other, - // darkening pixels as we go - - - { - int i = 0, j = 0; - extern int VideoModeColourDepth; - - - switch(VideoModeColourDepth) - { - case 8: - { - unsigned char* dest = (unsigned char *)ddsdmenu.lpSurface; - unsigned char* src = (unsigned char *)ddsdback.lpSurface; - - for(j=0; j < ScreenDescriptorBlock.SDB_Height; j++) - { - for(i=0;i < ScreenDescriptorBlock.SDB_Width; i++) - { - extern unsigned char* TextureLightingTable; - - *dest++ = *(TextureLightingTable + (32 * 256) + *src++); - } - - dest += destPitch; - src += srcPitch; - } - break; - } -#if 1 - case 16: - { - short r,g,b; - short *destShort = (short*)ddsdmenu.lpSurface; - short *srcShort = (short*)ddsdback.lpSurface; - - for(j=0; j < ScreenDescriptorBlock.SDB_Height; j++) - { - destShort = (short*)(((char*)ddsdmenu.lpSurface) - + ddsdmenu.lPitch * j); - srcShort = (short*)(((char*)ddsdback.lpSurface) - + ddsdback.lPitch * j); - - - for(i=0;i < ScreenDescriptorBlock.SDB_Width; i++) - { - r = (*srcShort & DisplayPixelFormat.dwRBitMask)>>1; - g = (*srcShort & DisplayPixelFormat.dwGBitMask)>>1; - b = (*srcShort & DisplayPixelFormat.dwBBitMask)>>1; - srcShort++; - - r &= DisplayPixelFormat.dwRBitMask; - g &= DisplayPixelFormat.dwGBitMask; - b &= DisplayPixelFormat.dwBBitMask; - - *destShort++ = r|g|b; - } - } - break; - } - case 32: - { - int *destInt = (int*)ddsdmenu.lpSurface; - int *srcInt = (int*)ddsdback.lpSurface; - int r,g,b; - - for(j=0; j < ScreenDescriptorBlock.SDB_Height; j++) - { - for(i=0;i < ScreenDescriptorBlock.SDB_Width; i++) - { - r = (*srcInt & DisplayPixelFormat.dwRBitMask)>>1; - g = (*srcInt & DisplayPixelFormat.dwGBitMask)>>1; - b = (*srcInt++ & DisplayPixelFormat.dwBBitMask)>>1; - - r &= DisplayPixelFormat.dwRBitMask; - g &= DisplayPixelFormat.dwGBitMask; - b &= DisplayPixelFormat.dwBBitMask; - - *destInt++ = r|g|b; - - - } - - destInt += (destPitch >> 2); - srcInt += (srcPitch >> 2); - } - break; - - } -#endif - default: - break; - } - } - - - // unlock the two surfaces - - ddrval = lpDDSInGameMenuBackdrop->Unlock((LPVOID)destStart); - LOGDXERR(ddrval); - #if debug - if (ddrval != DD_OK) - { - ReleaseDirect3D(); - exit(ddrval); - } - #endif - ddrval = lpDDSBack->Unlock((LPVOID)srcStart); - LOGDXERR(ddrval); - - #if debug - if (ddrval != DD_OK) - { - ReleaseDirect3D(); - exit(ddrval); - } - #endif -} - - - - - -void DrawDatabaseBackground(void) -{ - HRESULT ddrval; - RECT screen_coords; - - screen_coords.left = 0; - screen_coords.top =0; - screen_coords.right = ScreenDescriptorBlock.SDB_Width; - screen_coords.bottom = ScreenDescriptorBlock.SDB_Height; - - - ddrval = lpDDSBack->BltFast - ( - 0, - 0, - lpDDSInGameMenuBackdrop, - &screen_coords, - DDBLTFAST_WAIT - ); - - if (ddrval != DD_OK) - #if debug - { - ReleaseDirect3D(); - exit(0x2055); - } - #else - return; - #endif - - - - return; - - /* draw to top-left corner of the screen, opaque */ - ddrval = lpDDSBack->BltFast - ( - 0, - 0, - DatabaseBackground.LPDDS, - &(DatabaseBackground.SrcRect), - DDBLTFAST_WAIT - ); - if(ddrval != DD_OK) - { - ReleaseDirect3D(); - exit(0); - } - return; -} - - -extern int IDemandGoForward(); -extern int IDemandGoBackward(); -extern int IDemandTurnRight(); -extern int IDemandTurnLeft(); -extern int IDemandSelect(); -#define MAPSCREENWIDTH 251 -#define MAPSCREENHEIGHT 137 - -int MapXOffset = (640-MAPSCREENWIDTH)/2; -int MapYOffset = (480-MAPSCREENHEIGHT)/2; - - - -void PlatformSpecificExitingDatabase(void) -{ -// extern void SetVisionPalette(void); - -// unload_rif(dbgfx_rif);//get rid of File_Chunk - -// UnloadFont(&AvpFonts[DATABASE_FONT_LITE]); -// UnloadFont(&AvpFonts[DATABASE_FONT_DARK]); - -// ReleaseDDSurface(DatabaseBackground.LPDDS); - - /* blank screen before changing palette to avoid screen glitches */ -// BlankScreen(); - /* KJL 12:35:21 03/12/97 - get correct palette */ -// SetVisionPalette(); -} - - -void LoadDDGraphic2(struct DDGraphicTag *DDGfxPtr, char *Filename) -{ - /* - set up the direct draw surface. we can take the width and height - from the imageheader image - */ - - GLOBALASSERT(DDGfxPtr); - GLOBALASSERT(Filename); - - unsigned nWidth,nHeight; - DDGfxPtr->LPDDS = AwCreateSurface("sfXYB",Filename,AW_TLF_TRANSP|AW_TLF_CHROMAKEY,&nWidth,&nHeight,&DDGfxPtr->hBackup); - GLOBALASSERT(DDGfxPtr->LPDDS); - - ATIncludeSurface(DDGfxPtr->LPDDS,DDGfxPtr->hBackup); - - DDGfxPtr->SrcRect.left = 0; - DDGfxPtr->SrcRect.right = nWidth; - DDGfxPtr->SrcRect.top = 0; - DDGfxPtr->SrcRect.bottom = nHeight; -} - - -static void* MessageString; - -#define DATABASE_MESSAGE_NAME_LENGTH 50 - -#if 1 -void LoadDatabaseMessage() -{ - char filename[DATABASE_MESSAGE_NAME_LENGTH] = {"\000"}; - FILE* message_fp; - struct _stat filestatus; - int filesize; - - GetMessageName(filename); - - message_fp = fopen(filename, "rb"); - - GLOBALASSERT(message_fp); - - _stat(filename, &filestatus); - - filesize = filestatus.st_size;//filestatus.off_t; - - MessageString = AllocateMem(filesize + 1); - - if (!MessageString) - { - memoryInitialisationFailure = 1; - return; - } - - fread(MessageString, 1, filesize, message_fp); - - // add the terminator - - *((char*)MessageString + filesize) = 0; -} - - -static void GetMessageName(char* messagename) -{ - char messagenum[5]; - - sprintf(messagenum,"%d", (int)PlayerStatusPtr->CurrentMission); - - strcat(messagename, "DBMESS\\"); - strcat(messagename, LanguageDirNames[AvP.Language]); - strcat(messagename, "\\MSG"); - strcat(messagename, messagenum); - strcat(messagename, ".TXT"); - -} - - -#define MESSAGE_TOP_MARGIN 25 -#define MESSAGE_SIDE_MARGIN 35 - -void WriteDatabaseMessage() -{ - - extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; - - FONT_DESC db_message; - - db_message.fontnum = DATABASE_MESSAGE_FONT; - db_message.string = (char*)MessageString; - db_message.destx = MESSAGE_SIDE_MARGIN; - db_message.desty = MESSAGE_TOP_MARGIN; - db_message.width = ScreenDescriptorBlock.SDB_Width - (MESSAGE_SIDE_MARGIN*2); - db_message.just = FJ_LEFT_JUST; - - - BLTString(db_message); -} - - -void UnloadDatabaseMessage() -{ - if (MessageString) DeallocateMem(MessageString); -} -#endif - -void UpdateDatabaseScreen(void) -{ - FlipBuffers(); -} - - - - - -}; // extern "C" \ No newline at end of file diff --git a/src/avp/win95/multmenu.c b/src/avp/win95/multmenu.c deleted file mode 100644 index a9c1e2d..0000000 --- a/src/avp/win95/multmenu.c +++ /dev/null @@ -1,844 +0,0 @@ -/*-------------------------Patrick 7/5/97----------------------------- - Source for the multiplayer menus: I have have heavily modified this - ---------------------------------------------------------------------*/ - -#include "3dc.h" -#include "module.h" -#include "inline.h" -#include "stratdef.h" -#include "gamedef.h" -#include "font.h" -#include "menudefs.h" -#include "menugfx.h" -#include "dp_func.h" -#include "multmenu.h" -#include "equipmnt.h" -#include "pldnet.h" - -#define UseLocalAssert Yes -#include "ourasert.h" - -static char mPLevelNameString[] = "KIPPER"; -static char mPScoreLimitString[] = "PAT"; -static char mPTimeLimitString[] = "PAT"; -static char mPBlankString[] = "\0"; - -/* Setup stuff for the Multiplayer Menus graphics and options */ -static MENU_GRAPHIC_ITEM MPGameSelect_MenuItems[] = {{-1,}}; - -static MENUGRAPHIC MPGameSelect_Backdrop = {"menugfx\\pg0.pg0",-1,NULL,NULL,0,0,640,480,}; - -static MENU_TEXT_ITEM MPGameSelect_MenuFItems[] = -{ - {MMSelect_Title, TEXTSTRING_MULTI_TITLE, NULL, 80, 40}, - {MMSelect_P1Name, TEXTSTRING_BLANK, mPBlankString, 80, 80}, - {MMSelect_P2Name, TEXTSTRING_BLANK, mPBlankString, 80, 100}, - {MMSelect_P3Name, TEXTSTRING_BLANK, mPBlankString, 80, 120}, - {MMSelect_P4Name, TEXTSTRING_BLANK, mPBlankString, 80, 140}, - {MMSelect_P5Name, TEXTSTRING_BLANK, mPBlankString, 80, 160}, - {MMSelect_P6Name, TEXTSTRING_BLANK, mPBlankString, 80, 180}, - {MMSelect_P7Name, TEXTSTRING_BLANK, mPBlankString, 80, 200}, - {MMSelect_P8Name, TEXTSTRING_BLANK, mPBlankString, 80, 220}, - {MMSelect_P1Type, TEXTSTRING_BLANK, mPBlankString, 240, 80}, - {MMSelect_P2Type, TEXTSTRING_BLANK, mPBlankString, 240, 100}, - {MMSelect_P3Type, TEXTSTRING_BLANK, mPBlankString, 240, 120}, - {MMSelect_P4Type, TEXTSTRING_BLANK, mPBlankString, 240, 140}, - {MMSelect_P5Type, TEXTSTRING_BLANK, mPBlankString, 240, 160}, - {MMSelect_P6Type, TEXTSTRING_BLANK, mPBlankString, 240, 180}, - {MMSelect_P7Type, TEXTSTRING_BLANK, mPBlankString, 240, 200}, - {MMSelect_P8Type, TEXTSTRING_BLANK, mPBlankString, 240, 220}, - {MMSelect_P1Ok, TEXTSTRING_BLANK, mPBlankString, 400, 80}, - {MMSelect_P2Ok, TEXTSTRING_BLANK, mPBlankString, 400, 100}, - {MMSelect_P3Ok, TEXTSTRING_BLANK, mPBlankString, 400, 120}, - {MMSelect_P4Ok, TEXTSTRING_BLANK, mPBlankString, 400, 140}, - {MMSelect_P5Ok, TEXTSTRING_BLANK, mPBlankString, 400, 160}, - {MMSelect_P6Ok, TEXTSTRING_BLANK, mPBlankString, 400, 180}, - {MMSelect_P7Ok, TEXTSTRING_BLANK, mPBlankString, 400, 200}, - {MMSelect_P8Ok, TEXTSTRING_BLANK, mPBlankString, 400, 220}, - {MMSelect_Character, TEXTSTRING_MULTI_CHARACTER, NULL, 80, 260}, - {MMSelect_Level, TEXTSTRING_MULTI_LEVEL, NULL, 80, 280}, - {MMSelect_Mode, TEXTSTRING_MULTI_GAMEMODE, NULL, 80, 300}, - {MMSelect_ScoreLimit, TEXTSTRING_MULTI_SCORELIMIT, NULL, 80, 320}, - {MMSelect_TimeLimit, TEXTSTRING_MULTI_TIMELIMIT, NULL, 80, 340}, - {MMSelect_Start, TEXTSTRING_MULTI_START, NULL, 80, 380}, - {MMSelect_Cancel, TEXTSTRING_MULTI_CANCEL, NULL, 240, 380}, - {MMSelect_CharacterSelection, TEXTSTRING_MULTI_MARINE, NULL, 240, 260}, - {MMSelect_LevelSelection, TEXTSTRING_BLANK, mPLevelNameString, 240, 280}, - {MMSelect_ModeSelection, TEXTSTRING_MULTI_INDIVIDUAL, NULL, 240, 300}, - {MMSelect_ScoreLimitSelection, TEXTSTRING_NO, NULL, 240, 320}, - {MMSelect_TimeLimitSelection, TEXTSTRING_NO, NULL, 240, 340}, - {-1,} -}; - -static AVP_MENU MPGameSelectMenu = -{ - &MPGameSelect_Backdrop, - &MPGameSelect_MenuItems[0], - &MPGameSelect_MenuFItems[0], - -1, - 0, -}; - - -/* Local function prototypes */ -static MULTIPLAYER_SELECT_OPTIONS DoSelectionState(void); -static void DrawMultiStartUpScreen(void); -static void DoMultiStartUpSelection(void); -static void DisplayMultiStartUpErrorMessage(void); - -/* Externally defined functions and variables used in this file */ -extern int IDemandGoBackward(); -extern int IDemandGoForward(); -extern int IDemandSelect(); -extern int menustate; -extern int NormalFrameTime; - -/* globals used in this file */ -static int debounce = 0; -static MULTIPLAYER_SELECT_OPTIONS thisSelection = MMSelect_Max; -static int currentItem = MMSelect_Start; - -/* The main multiplayer menu state loop function */ -int RunMultiplayerStartUp(int lobbied) -{ - /* first, run the connection dialog */ - if(!lobbied) - { - AvP.Network=I_No_Network; - InvokeDirectPlayDialog(); - - if(ProcessDirectPlayDialog()==0) - { - /* didn't connect */ - EndAVPNetGame(); - return 0; - } - } - - /* we have successfully connected to a game...*/ - InitAVPNetGame(); - - /* init the menu items and strings */ - { - int i; - - /* players names, types, and ok flags */ - for(i=0;i=NET_MAXPLAYERSCORE) netGameData.scoreLimit=0; - else netGameData.scoreLimit+=5; - break; - } - case(MMSelect_TimeLimitSelection): - { - LOCALASSERT(AvP.Network==I_Host); - if(netGameData.timeLimit>=NET_MAXGAMETIME) netGameData.timeLimit=0; - else netGameData.timeLimit+=5; - break; - } - default: - { - LOCALASSERT(1==0); - break; - } - } - } - else if((IDemandGoForward()==0)&&(IDemandGoBackward()==0)&&(IDemandSelect()==0)) - debounce =1; -} - -/* Patrick 19/7/97--------------------------------------------------- -function for displaying multiplayer startup error messages : -adjusts existing menu... ----------------------------------------------------------------------*/ -static MENU_TEXT_ITEM MPStartUpError_MenuFItems[] = -{ - {MMSelect_Title, TEXTSTRING_MULTI_TITLE, NULL, 80, 40}, - {MMSelect_Start, TEXTSTRING_BLANK, NULL, 80, 80}, - {MMSelect_Cancel, TEXTSTRING_MULTI_OK, NULL, 80, 120}, - {-1,} -}; -static AVP_MENU MPStartUpErrorMenu = -{ - &MPGameSelect_Backdrop, - &MPGameSelect_MenuItems[0], - &MPStartUpError_MenuFItems[0], - -1, - 0, -}; - - -static void DisplayMultiStartUpErrorMessage(void) -{ - /* examine our NGS and decide what message to display */ - switch(netGameData.myGameState) - { - case(NGS_Error_GameFull): - { - MPStartUpError_MenuFItems[1].StringID = TEXTSTRING_MULTI_GAMEFULL; - break; - } - case(NGS_Error_GameStarted): - { - MPStartUpError_MenuFItems[1].StringID = TEXTSTRING_MULTI_ALREADYSTARTED; - break; - } - case(NGS_Error_HostLost): - { - MPStartUpError_MenuFItems[1].StringID = TEXTSTRING_MULTI_CONNECTIONLOST; - break; - } - default: - { - LOCALASSERT(1==0); - return; - break; - } - } - - thisSelection = MMSelect_Max; - currentItem = MMSelect_Cancel; - Current_Menu = &MPStartUpErrorMenu; - { - int index; - for (index=0; index=0) sprintf(scoreStringsTotal[i],"%.3d",totalScore); - else if(totalScore>=(-99)) sprintf(scoreStringsTotal[i],"%.2d",totalScore); - else sprintf(scoreStringsTotal[i],"%.2d",(-99)); - } - EndNetGame_MenuFItems[(i+(NET_MAXPLAYERS*2))].SecondStringPtr = scoreStringsTotal[i]; - - /* initials for score table ... */ - initialString[i][0] = netGameData.playerData[i].name[0]; - initialString[i][1] = '\0'; - EndNetGame_MenuFItems[(i+(NET_MAXPLAYERS*3))].SecondStringPtr = initialString[i]; - EndNetGame_MenuFItems[(i+(NET_MAXPLAYERS*4))].SecondStringPtr = initialString[i]; - - /* score: player by player... */ - { - int j; - for(j=0;j=0) sprintf(scoreStrings[i][j],"%.3d",thisScore); - else if(thisScore>=(-99)) sprintf(scoreStrings[i][j],"%.2d",thisScore); - else sprintf(scoreStrings[i][j],"%.2d",thisScore); - EndNetGame_MenuFItems[(j+(NET_MAXPLAYERS*(5+i)))].SecondStringPtr = scoreStrings[i][j]; - } - else - { - EndNetGame_MenuFItems[(j+(NET_MAXPLAYERS*(5+i)))].SecondStringPtr = mPBlankString; - } - } - } - } - else - { - /* make sure it's blank... incase this screen has been displayed previously */ - EndNetGame_MenuFItems[i].SecondStringPtr = mPBlankString; - EndNetGame_MenuFItems[(i+NET_MAXPLAYERS)].StringID = TEXTSTRING_BLANK; - EndNetGame_MenuFItems[(i+(NET_MAXPLAYERS*2))].SecondStringPtr = mPBlankString; - EndNetGame_MenuFItems[(i+(NET_MAXPLAYERS*3))].SecondStringPtr = mPBlankString; - EndNetGame_MenuFItems[(i+(NET_MAXPLAYERS*4))].SecondStringPtr = mPBlankString; - { - int j; - for(j=0;j