Removed the old menu systems.

This commit is contained in:
Steven Fuller 2008-05-04 01:47:55 -07:00 committed by Patryk Obara
parent b80766326b
commit a64e100838
23 changed files with 12 additions and 12880 deletions

File diff suppressed because it is too large Load diff

View file

@ -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

File diff suppressed because it is too large Load diff

View file

@ -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

View file

@ -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<NumberOfCurrentDbOptions; o++)
{
if (o == selectedOption)
DrawDatabaseMenuOption(CurrentDbOptions[o],1);
else
DrawDatabaseMenuOption(CurrentDbOptions[o],0);
}
}
/* update screen */
UpdateDatabaseScreen();
/* allow user to select an option */
GetDatabaseInput();
if (DatabaseInput.RequestSelectItem)
{
selectionNotMade=0;
}
else if (DatabaseInput.RequestPreviousItem)
{
if (selectedOption == 0)
{
selectedOption = NumberOfCurrentDbOptions;
}
selectedOption--;
}
else if (DatabaseInput.RequestNextItem)
{
selectedOption++;
if (selectedOption == NumberOfCurrentDbOptions)
{
selectedOption = 0;
}
}
}
while(selectionNotMade);
return(CurrentDbOptions[selectedOption]);
}
void LoadGraphicsForDatabaseState(enum DB_STATE_ID stateID)
{
switch (stateID)
{
case DB_STATE_MISSION:
{
LoadDatabaseMessage();
break;
}
default:
break;
}
}
void UnloadGraphicsForDatabaseState(enum DB_STATE_ID stateID)
{
switch (stateID)
{
case DB_STATE_MISSION:
{
UnloadDatabaseMessage();
break;
}
default:
break;
}
}
void DrawSpecialGraphicsForState(enum DB_STATE_ID stateID)
{
if(stateID == DB_STATE_MISSION)
{
WriteDatabaseMessage();
}
if((stateID == DB_STATE_LOAD) || (stateID == DB_STATE_SAVE))
{
char game_name[GAME_NAME_LENGTH];
int i = GAME_NAME_LENGTH, j;
while(i-- > 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;
}

View file

@ -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();

View file

@ -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_ */

View file

@ -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<MAX_GAMESTART_MENU_ITEMS; a++)
{
CurrentMenuStatus[a]=0;
}
CurrentMenuStatus[MAX_GAMESTART_MENU_ITEMS]=-1;
CurrentMenuStatus[current_item]=1;
// load and draw
LoadMenuGraphics(CHOOSE_GAMESTART);
DrawEntireMenuScreen();
while (selection==-1)
{
// JCWH 18/02/98: allow ALT+TAB
CheckForWindowsMessages();
ReadUserInput();
if (IDemandGoBackward() && debounce)
{
demoTimer = 0;
debounce=0;
CurrentMenuStatus[current_item]=0;
current_item++;
#if PSX_DEMO
if (current_item==LOAD_GAME_ITEM) current_item++;
#endif
if (current_item==MAX_GAMESTART_MENU_ITEMS)
current_item=0;
CurrentMenuStatus[current_item]=1;
MenuChangeSound();
}
else if (IDemandGoForward() && debounce)
{
demoTimer = 0;
debounce=0;
CurrentMenuStatus[current_item]=0;
current_item--;
#if PSX_DEMO
if (current_item==LOAD_GAME_ITEM) current_item--;
#endif
if (current_item==-1)
current_item=(MAX_GAMESTART_MENU_ITEMS-1);
CurrentMenuStatus[current_item]=1;
MenuChangeSound();
}
else if (IDemandSelect() && debounce)
{
demoTimer = 0;
debounce=0;
selection=current_item;
MenuSelectSound();
}
else if ((IDemandGoForward()==0) && (IDemandGoBackward()==0) && (IDemandSelect()==0))
{
debounce=1;
}
DrawEntireMenuScreen();
SoundSys_Management();
#if SupportWindows95
/* Auto start the demo from the main menu if there are no keypresses for 30 seconds */
FrameCounterHandler();
demoTimer += NormalFrameTime + 1;
/* KJL 15:44:21 28/02/98 - deactivated the demo mode - it can be quite annoying */
#if 0
if (demoTimer > 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; a++)
{
CurrentMenuStatus[a]=0;
}
CurrentMenuStatus[current_item]=1;
CurrentMenuStatus[MAX_CHARACTER_MENU_ITEMS]=-1;
// load and draw the screeen
LoadMenuGraphics(CHOOSE_CHARACTER);
DrawEntireMenuScreen();
while (selection==-1)
{
// JCWH 18/02/98: allow ALT+TAB
CheckForWindowsMessages();
/***** First loop, choose character. *****/
// this wraps if we run over either end of
// the enum
ReadUserInput();
if (IDemandTurnRight() && debounce)
{
debounce=0;
CurrentMenuStatus[current_item]=0;
current_item++;
#if PSX_DEMO
if (current_item==PREDATOR_ITEM) current_item++;
#endif
if (current_item >= 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; a<MAX_ALIEN_MISSION_PROFILE_ITEMS; a++) {
CurrentMenuStatus[a]=0;
}
CurrentMenuStatus[MAX_ALIEN_MISSION_PROFILE_ITEMS]=-1;
current_item=ENTER_GAME_ALIEN;
CurrentMenuStatus[current_item]=1;
selection=-1;
debounce=0;
DrawEntireMenuScreen();
/***** Screen set up. *****/
while (selection==-1)
{
// JCWH 18/02/98: allow ALT+TAB
CheckForWindowsMessages();
ReadUserInput();
if ( (IDemandTurnLeft() && debounce) || (IDemandTurnRight() && debounce) )
{
debounce=0;
CurrentMenuStatus[current_item]=0;
current_item=((current_item==ENTER_GAME_ALIEN)? EXIT_ITEM_ALIEN:ENTER_GAME_ALIEN);
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(ALIEN_BRIEFING);
return(selection);
}
int OptionsMenu(void)
{
#if PSX
return(PsxOptionsMenu(0));
#elif SupportWindows95
extern int PcOptionsMenu(void);
return PcOptionsMenu();
return CANCEL;
#else /* Saturn */
/* Don't know what's in here yet... */
/* probably 'return SaturnOptionsMenu()' !!! */
return(CANCEL);
#endif
}
int PredatorBriefingMenu(void)
{
int a,current_item,selection,debounce;
LoadMenuGraphics(PREDATOR_BRIEFING);
for (a=0; a<MAX_PREDATOR_MISSION_PROFILE_ITEMS; a++) {
CurrentMenuStatus[a]=0;
}
CurrentMenuStatus[MAX_PREDATOR_MISSION_PROFILE_ITEMS]=-1;
current_item=ENTER_GAME_PREDATOR;
CurrentMenuStatus[current_item]=1;
selection=-1;
debounce=0;
DrawEntireMenuScreen();
/***** Screen set up. *****/
while (selection==-1)
{
// JCWH 18/02/98: allow ALT+TAB
CheckForWindowsMessages();
ReadUserInput();
if ( (IDemandTurnLeft() && debounce) || (IDemandTurnRight() && debounce) )
{
debounce=0;
CurrentMenuStatus[current_item]=0;
current_item=((current_item==ENTER_GAME_PREDATOR)? EXIT_ITEM_PREDATOR:ENTER_GAME_PREDATOR);
CurrentMenuStatus[current_item]=1;
MenuChangeSound();
DrawEntireMenuScreen();
}
else if (IDemandSelect() && debounce)
{
debounce=0;
selection=current_item;
MenuSelectSound();
DrawEntireMenuScreen();
}
else if ((IDemandTurnLeft()==0) && (IDemandTurnRight()==0) && (IDemandSelect()==0))
{
debounce=1;
}
SoundSys_Management();
}
UnLoadMenuGraphics(PREDATOR_BRIEFING);
return(selection);
}
int MarineBriefingMenu(void)
{
/***** Hey, this one IS different! *****/
int a,current_item;
int selection = -1,debounce = 0;
for (a=0; a<MAX_MARINE_MISSION_PROFILE_ITEMS; a++)
{
CurrentMenuStatus[a]=0;
}
CurrentMenuStatus[MAX_MARINE_MISSION_PROFILE_ITEMS]=-1;
current_item=MALE_MARINE_FACE;
CurrentMenuStatus[current_item]=1;
LoadMenuGraphics(MARINE_BRIEFING);
DrawEntireMenuScreen();
#if 0
// RWH removed the gender selection
// though it is still in the enum - could be used
// at some point
while (selection==-1)
{
// JCWH 18/02/98: allow ALT+TAB
CheckForWindowsMessages();
ReadUserInput();
if ( (IDemandTurnLeft() && debounce) || (IDemandTurnRight() && debounce) )
{
debounce=0;
CurrentMenuStatus[current_item]=0;
current_item=((current_item==MALE_MARINE_FACE)? FEMALE_MARINE_FACE:MALE_MARINE_FACE);
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();
}
switch (selection) {
case MALE_MARINE_FACE:
case FEMALE_MARINE_FACE:
/***** Now act on gender choice. Somehow. *****/
break;
}
#endif
current_item=ENTER_GAME_MARINE;
CurrentMenuStatus[current_item]=1;
selection=-1;
debounce=0;
/***** Screen set up. *****/
while (selection==-1)
{
// JCWH 18/02/98: allow ALT+TAB
CheckForWindowsMessages();
ReadUserInput();
if ( (IDemandTurnLeft() && debounce) || (IDemandTurnRight() && debounce) )
{
debounce=0;
CurrentMenuStatus[current_item]=0;
current_item=((current_item==ENTER_GAME_MARINE)? EXIT_ITEM_MARINE:ENTER_GAME_MARINE);
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(MARINE_BRIEFING);
return(selection);
}
#if PSX||Saturn
/* Roxby, this is PLATFORM SPECIFIC!!! */
#else
int LoadGameMenu(void)
{
int a,current_item;
int selection = -1,debounce = 0;
for (a=0; a<MAX_MARINE_MISSION_PROFILE_ITEMS; a++)
{
CurrentMenuStatus[a]=0;
}
CurrentMenuStatus[MAX_MARINE_MISSION_PROFILE_ITEMS]=-1;
current_item=MALE_MARINE_FACE;
CurrentMenuStatus[current_item]=1;
LoadMenuGraphics(MARINE_BRIEFING);
DrawEntireMenuScreen();
current_item=ENTER_GAME_MARINE;
CurrentMenuStatus[current_item]=1;
selection=-1;
debounce=0;
/***** Screen set up. *****/
while (selection==-1)
{
// JCWH 18/02/98: allow ALT+TAB
CheckForWindowsMessages();
ReadUserInput();
if ( (IDemandTurnLeft() && debounce) || (IDemandTurnRight() && debounce) )
{
debounce=0;
CurrentMenuStatus[current_item]=0;
current_item=((current_item==ENTER_GAME_MARINE)? EXIT_ITEM_MARINE:ENTER_GAME_MARINE);
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(MARINE_BRIEFING);
return(selection);
}
/*-------------------------------------------*/
#endif

View file

@ -22,9 +22,6 @@ so player.c is looking a bit bare at the moment. */
#include "game_statistics.h"
#include "pfarlocs.h"
#include "bh_ais.h"
#if SupportWindows95
#include "rebmenus.hpp"
#endif
#define UseLocalAssert Yes
#include "ourasert.h"
@ -487,13 +484,6 @@ void MaintainPlayer(void)
textprint("PlayerLight %d\n",CurrentLightAtPlayer);
#endif
#if SupportWindows95
#if 0//UseRebMenus
if(playerStatusPtr->Mvt_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)
{

View file

@ -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<enum NavigationOp>(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
}

View file

@ -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

View file

@ -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 ************************************/

View file

@ -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 ***********************************/

View file

@ -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<int>* 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<int>* const pBoundedExpVar_Val;
};
class Item_Toggle : public Item
{
public:
Item_Toggle
(
OnOffAppearance theOnOffApp_Label,
enum Direction initDir,
OnOffAppearance theOnOffApp_Choice,
ExportVariable<OurBool>* 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<OurBool>* 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

File diff suppressed because it is too large Load diff

View file

@ -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<int>* 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<int>* pBoundedExpVar_Val;
};
// Class for a list of discrete selections with appearances and values:
template <class T,int MAX_IN_LIST> 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<int>* pBoundedExpVar
);
Item_Toggle* AddNewToggleItem
(
OnOffAppearance theOnOffApp_Label,
enum Direction initDir,
OnOffAppearance theOnOffApp_Choice,
ExportVariable<OurBool>* 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

View file

@ -2,7 +2,6 @@
extern "C"
{
#include "3dc.h"
//#include "intro.hpp"
#include "inline.h"
//#include "smacker.h"
#include "avp_menus.h"

View file

@ -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

View file

@ -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; x<image->width; 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; x<image->width; 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

View file

@ -1,10 +0,0 @@
extern void PlayIntroSequence(void);
#ifdef __cplusplus
extern "C"
{
#endif
extern void WeWantAnIntro(void);
#ifdef __cplusplus
};
#endif

File diff suppressed because it is too large Load diff

View file

@ -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_MAXPLAYERS;i++)
{
MPGameSelect_MenuFItems[(i+1)].StringID = TEXTSTRING_BLANK;
MPGameSelect_MenuFItems[(i+1)].SecondStringPtr = mPBlankString;
MPGameSelect_MenuFItems[(i+9)].StringID = TEXTSTRING_BLANK;
MPGameSelect_MenuFItems[(i+9)].SecondStringPtr = mPBlankString;
MPGameSelect_MenuFItems[(i+17)].StringID = TEXTSTRING_BLANK;
MPGameSelect_MenuFItems[(i+17)].SecondStringPtr = mPBlankString;
}
}
/* init menu system for drawing */
debounce = 0;
thisSelection = MMSelect_Max;
currentItem = MMSelect_Start;
Current_Menu = &MPGameSelectMenu;
{
int index;
for (index=0; index<MMSelect_Max; index++) CurrentMenuStatus[index]=0;
}
CurrentMenuStatus[MMSelect_Max]=-1;
CurrentMenuStatus[currentItem]=1;
ProcessGraphicForLoading(&MPGameSelectMenu);
/* do start-up loop */
while(netGameData.myGameState==NGS_StartUp)
{
NetCollectMessages();
DrawMultiStartUpScreen();
if(netGameData.myGameState != NGS_StartUp) break;
/* we are still in start-up after collecting our messages */
if(AvP.Network==I_Host) AddNetMsg_GameDescription();
else AddNetMsg_PlayerDescription();
NetSendMessages();
DoMultiStartUpSelection();
if(netGameData.myGameState != NGS_StartUp) break;
/* 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
{
/* host checks for peer time-out, and game start */
LOCALASSERT(AvP.Network==I_Host);
LOCALASSERT(PlayerIdInPlayerList(AVPDPNetID)!=NET_IDNOTINPLAYERLIST);
/* check start flags on all players (including ourselves) */
{
int i;
int startOk = 1;
for(i=0;i<NET_MAXPLAYERS;i++)
{
if(netGameData.playerData[i].playerId != NULL)
{
if(netGameData.playerData[i].startFlag==0) startOk = 0;
}
}
if(startOk==1)
{
TransmitStartGameNetMsg();
netGameData.myGameState = NGS_Playing;
}
}
}
}
/* examine our NGS and decide what to do */
switch(netGameData.myGameState)
{
case(NGS_Playing):
{
/* everything went ok */
AvP.StartingEnv = I_Dml1;
AvP.CurrentEnv = AvP.StartingEnv;
switch(netGameData.myCharacterType)
{
case(NGCT_Marine):
{
AvP.PlayerType = I_Marine;
break;
}
case(NGCT_Predator):
{
AvP.PlayerType = I_Predator;
break;
}
case(NGCT_Alien):
{
AvP.PlayerType = I_Alien;
break;
}
default:
{
LOCALASSERT(1==0);
break;
}
}
ProcessGraphicForUnloading(&MPGameSelectMenu);
return 1;
break;
}
case(NGS_Leaving):
case(NGS_EndGame):
{
EndAVPNetGame();
ProcessGraphicForUnloading(&MPGameSelectMenu);
return 0;
break;
}
case(NGS_Error_GameFull):
case(NGS_Error_GameStarted):
case(NGS_Error_HostLost):
{
EndAVPNetGame();
DisplayMultiStartUpErrorMessage();
ProcessGraphicForUnloading(&MPGameSelectMenu);
return 0;
break;
}
default:
{
LOCALASSERT(1==0);
EndAVPNetGame();
ProcessGraphicForUnloading(&MPGameSelectMenu);
return 0;
break;
}
}
}
static void DrawMultiStartUpScreen(void)
{
/* update all the menu items... */
int i;
for(i=0;i<NET_MAXPLAYERS;i++)
{
if(netGameData.playerData[i].playerId!=NULL)
{
MPGameSelect_MenuFItems[(i+1)].SecondStringPtr = netGameData.playerData[i].name;
switch(netGameData.playerData[i].characterType)
{
case(NGCT_Marine):
{
MPGameSelect_MenuFItems[(i+9)].StringID = TEXTSTRING_MULTI_MARINE;
break;
}
case(NGCT_Predator):
{
MPGameSelect_MenuFItems[(i+9)].StringID = TEXTSTRING_MULTI_PREDATOR;
break;
}
case(NGCT_Alien):
{
MPGameSelect_MenuFItems[(i+9)].StringID = TEXTSTRING_MULTI_ALIEN;
break;
}
default:
{
LOCALASSERT(1==0);
break;
}
}
if(netGameData.playerData[i].startFlag)
MPGameSelect_MenuFItems[(i+17)].StringID = TEXTSTRING_MULTI_OK;
else
MPGameSelect_MenuFItems[(i+17)].StringID = TEXTSTRING_BLANK;
}
else
{
MPGameSelect_MenuFItems[(i+1)].SecondStringPtr = mPBlankString;
MPGameSelect_MenuFItems[(i+9)].StringID = TEXTSTRING_BLANK;
MPGameSelect_MenuFItems[(i+17)].SecondStringPtr = mPBlankString;
}
}
/* my character selection */
switch(netGameData.myCharacterType)
{
case(NGCT_Marine):
{
MPGameSelect_MenuFItems[(32)].StringID = TEXTSTRING_MULTI_MARINE;
break;
}
case(NGCT_Predator):
{
MPGameSelect_MenuFItems[(32)].StringID = TEXTSTRING_MULTI_PREDATOR;
break;
}
case(NGCT_Alien):
{
MPGameSelect_MenuFItems[(32)].StringID = TEXTSTRING_MULTI_ALIEN;
break;
}
default:
{
LOCALASSERT(1==0);
break;
}
}
/* level selection (actually doesn't do anything at the moment) */
MPGameSelect_MenuFItems[33].SecondStringPtr = mPLevelNameString;
/* mode selection */
switch(netGameData.gameType)
{
case(NGT_Individual):
{
MPGameSelect_MenuFItems[34].StringID = TEXTSTRING_MULTI_INDIVIDUAL;
break;
}
case(NGT_Coop):
{
MPGameSelect_MenuFItems[34].StringID = TEXTSTRING_MULTI_COOP;
break;
}
default:
{
LOCALASSERT(1==0);
break;
}
}
/* score and time limits */
if(netGameData.scoreLimit==0)
{
MPGameSelect_MenuFItems[35].StringID = TEXTSTRING_NO;
MPGameSelect_MenuFItems[35].SecondStringPtr = mPBlankString;
}
else
{
sprintf(mPScoreLimitString,"%.3d",netGameData.scoreLimit);
MPGameSelect_MenuFItems[35].StringID = TEXTSTRING_BLANK;
MPGameSelect_MenuFItems[35].SecondStringPtr = mPScoreLimitString;
}
if(netGameData.timeLimit==0)
{
MPGameSelect_MenuFItems[36].StringID = TEXTSTRING_NO;
MPGameSelect_MenuFItems[36].SecondStringPtr = mPBlankString;
}
else
{
sprintf(mPTimeLimitString,"%.3d",netGameData.timeLimit);
MPGameSelect_MenuFItems[36].StringID = TEXTSTRING_BLANK;
MPGameSelect_MenuFItems[36].SecondStringPtr = mPTimeLimitString;
}
/* and draw everything */
DrawEntireMenuScreen();
}
static void DoMultiStartUpSelection(void)
{
/* if we have selected start, we can't do any more but wait */
if(netGameData.myStartFlag==1) return;
ReadUserInput();
if(IDemandGoBackward() && debounce)
{
debounce=0;
CurrentMenuStatus[currentItem++]=0;
/* wrap around */
if(AvP.Network==I_Host)
{
if(currentItem==MMSelect_Title) currentItem=MMSelect_Start;
}
else
{
LOCALASSERT(AvP.Network==I_Peer);
if(currentItem==MMSelect_LevelSelection) currentItem=MMSelect_Start;
}
CurrentMenuStatus[currentItem]=1;
}
else if(IDemandGoForward() && debounce)
{
debounce=0;
CurrentMenuStatus[currentItem--]=0;
/* wrap around */
if(AvP.Network==I_Host)
{
if(currentItem==-1) currentItem=MMSelect_TimeLimitSelection;
}
else
{
LOCALASSERT(AvP.Network==I_Peer);
if(currentItem==-1) currentItem=MMSelect_CharacterSelection;
}
CurrentMenuStatus[currentItem]=1;
}
else if (IDemandSelect() && debounce)
{
debounce=0;
thisSelection=currentItem;
switch(thisSelection)
{
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;
}
case(MMSelect_Cancel):
{
if(AvP.Network==I_Host)
{
TransmitEndOfGameNetMsg();
netGameData.myGameState=NGS_EndGame;
}
else
{
TransmitPlayerLeavingNetMsg();
netGameData.myGameState=NGS_Leaving;
}
break;
}
case(MMSelect_CharacterSelection):
{
if(netGameData.myCharacterType==NGCT_Marine) netGameData.myCharacterType=NGCT_Predator;
else if(netGameData.myCharacterType==NGCT_Predator) netGameData.myCharacterType=NGCT_Alien;
else netGameData.myCharacterType=NGCT_Marine;
if(AvP.Network==I_Host)
{
int myIndex;
myIndex = PlayerIdInPlayerList(AVPDPNetID);
LOCALASSERT(myIndex!=NET_IDNOTINPLAYERLIST);
netGameData.playerData[myIndex].characterType = netGameData.myCharacterType;
}
break;
}
case(MMSelect_LevelSelection):
{
LOCALASSERT(AvP.Network==I_Host);
/* do nothing at the moment */
break;
}
case(MMSelect_ModeSelection):
{
LOCALASSERT(AvP.Network==I_Host);
if(netGameData.gameType==NGT_Individual) netGameData.gameType=NGT_Coop;
else netGameData.gameType=NGT_Individual;
break;
}
case(MMSelect_ScoreLimitSelection):
{
LOCALASSERT(AvP.Network==I_Host);
if(netGameData.scoreLimit>=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<MMSelect_Max; index++) CurrentMenuStatus[index]=0;
}
CurrentMenuStatus[MMSelect_Max]=-1;
CurrentMenuStatus[currentItem]=1;
while(!IDemandSelect())
{
DrawEntireMenuScreen();
ReadUserInput();
}
}
/*---------------------------Patrick 5/5/97----------------------------
These functions support the end of net-game information screen
----------------------------------------------------------------------*/
MENUGRAPHIC EndNetGame_Backdrop = { "menugfx\\pg0.pg0", -1, NULL, NULL, 0, 0, 640, 480,};
static MENU_GRAPHIC_ITEM EndNetGame_MenuItems[] = {{-1,}};
static MENU_TEXT_ITEM EndNetGame_MenuFItems[] =
{
{MMEndItem_PlayerName1, TEXTSTRING_BLANK, mPBlankString, 60, 40},
{MMEndItem_PlayerName2, TEXTSTRING_BLANK, mPBlankString, 60, 60},
{MMEndItem_PlayerName3, TEXTSTRING_BLANK, mPBlankString, 60, 80},
{MMEndItem_PlayerName4, TEXTSTRING_BLANK, mPBlankString, 60, 100},
{MMEndItem_PlayerName5, TEXTSTRING_BLANK, mPBlankString, 60, 120},
{MMEndItem_PlayerName6, TEXTSTRING_BLANK, mPBlankString, 60, 140},
{MMEndItem_PlayerName7, TEXTSTRING_BLANK, mPBlankString, 60, 160},
{MMEndItem_PlayerName8, TEXTSTRING_BLANK, mPBlankString, 60, 180},
{MMEndItem_PlayerCharacter1, TEXTSTRING_BLANK, mPBlankString, 220, 40},
{MMEndItem_PlayerCharacter2, TEXTSTRING_BLANK, mPBlankString, 220, 60},
{MMEndItem_PlayerCharacter3, TEXTSTRING_BLANK, mPBlankString, 220, 80},
{MMEndItem_PlayerCharacter4, TEXTSTRING_BLANK, mPBlankString, 220, 100},
{MMEndItem_PlayerCharacter5, TEXTSTRING_BLANK, mPBlankString, 220, 120},
{MMEndItem_PlayerCharacter6, TEXTSTRING_BLANK, mPBlankString, 220, 140},
{MMEndItem_PlayerCharacter7, TEXTSTRING_BLANK, mPBlankString, 220, 160},
{MMEndItem_PlayerCharacter8, TEXTSTRING_BLANK, mPBlankString, 220, 180},
{MMEndItem_PlayerTotalScore1, TEXTSTRING_BLANK, mPBlankString, 380, 40},
{MMEndItem_PlayerTotalScore2, TEXTSTRING_BLANK, mPBlankString, 380, 60},
{MMEndItem_PlayerTotalScore3, TEXTSTRING_BLANK, mPBlankString, 380, 80},
{MMEndItem_PlayerTotalScore4, TEXTSTRING_BLANK, mPBlankString, 380, 100},
{MMEndItem_PlayerTotalScore5, TEXTSTRING_BLANK, mPBlankString, 380, 120},
{MMEndItem_PlayerTotalScore6, TEXTSTRING_BLANK, mPBlankString, 380, 140},
{MMEndItem_PlayerTotalScore7, TEXTSTRING_BLANK, mPBlankString, 380, 160},
{MMEndItem_PlayerTotalScore8, TEXTSTRING_BLANK, mPBlankString, 380, 180},
{MMEndItem_Player1Initial1, TEXTSTRING_BLANK, mPBlankString, 60, 240},
{MMEndItem_Player2Initial1, TEXTSTRING_BLANK, mPBlankString, 60, 260},
{MMEndItem_Player3Initial1, TEXTSTRING_BLANK, mPBlankString, 60, 280},
{MMEndItem_Player4Initial1, TEXTSTRING_BLANK, mPBlankString, 60, 300},
{MMEndItem_Player5Initial1, TEXTSTRING_BLANK, mPBlankString, 60, 320},
{MMEndItem_Player6Initial1, TEXTSTRING_BLANK, mPBlankString, 60, 340},
{MMEndItem_Player7Initial1, TEXTSTRING_BLANK, mPBlankString, 60, 360},
{MMEndItem_Player8Initial1, TEXTSTRING_BLANK, mPBlankString, 60, 380},
{MMEndItem_Player1Initial2, TEXTSTRING_BLANK, mPBlankString, 110, 220},
{MMEndItem_Player2Initial2, TEXTSTRING_BLANK, mPBlankString, 170, 220},
{MMEndItem_Player3Initial2, TEXTSTRING_BLANK, mPBlankString, 230, 220},
{MMEndItem_Player4Initial2, TEXTSTRING_BLANK, mPBlankString, 290, 220},
{MMEndItem_Player5Initial2, TEXTSTRING_BLANK, mPBlankString, 350, 220},
{MMEndItem_Player6Initial2, TEXTSTRING_BLANK, mPBlankString, 410, 220},
{MMEndItem_Player7Initial2, TEXTSTRING_BLANK, mPBlankString, 470, 220},
{MMEndItem_Player8Initial2, TEXTSTRING_BLANK, mPBlankString, 530, 220},
{MMEndItem_Player1Score1, TEXTSTRING_BLANK, mPBlankString, 100, 240},
{MMEndItem_Player1Score2, TEXTSTRING_BLANK, mPBlankString, 160, 240},
{MMEndItem_Player1Score3, TEXTSTRING_BLANK, mPBlankString, 220, 240},
{MMEndItem_Player1Score4, TEXTSTRING_BLANK, mPBlankString, 280, 240},
{MMEndItem_Player1Score5, TEXTSTRING_BLANK, mPBlankString, 340, 240},
{MMEndItem_Player1Score6, TEXTSTRING_BLANK, mPBlankString, 400, 240},
{MMEndItem_Player1Score7, TEXTSTRING_BLANK, mPBlankString, 460, 240},
{MMEndItem_Player1Score8, TEXTSTRING_BLANK, mPBlankString, 520, 240},
{MMEndItem_Player2Score1, TEXTSTRING_BLANK, mPBlankString, 100, 260},
{MMEndItem_Player2Score2, TEXTSTRING_BLANK, mPBlankString, 160, 260},
{MMEndItem_Player2Score3, TEXTSTRING_BLANK, mPBlankString, 220, 260},
{MMEndItem_Player2Score4, TEXTSTRING_BLANK, mPBlankString, 280, 260},
{MMEndItem_Player2Score5, TEXTSTRING_BLANK, mPBlankString, 340, 260},
{MMEndItem_Player2Score6, TEXTSTRING_BLANK, mPBlankString, 400, 260},
{MMEndItem_Player2Score7, TEXTSTRING_BLANK, mPBlankString, 460, 260},
{MMEndItem_Player2Score8, TEXTSTRING_BLANK, mPBlankString, 520, 260},
{MMEndItem_Player3Score1, TEXTSTRING_BLANK, mPBlankString, 100, 280},
{MMEndItem_Player3Score2, TEXTSTRING_BLANK, mPBlankString, 160, 280},
{MMEndItem_Player3Score3, TEXTSTRING_BLANK, mPBlankString, 220, 280},
{MMEndItem_Player3Score4, TEXTSTRING_BLANK, mPBlankString, 280, 280},
{MMEndItem_Player3Score5, TEXTSTRING_BLANK, mPBlankString, 340, 280},
{MMEndItem_Player3Score6, TEXTSTRING_BLANK, mPBlankString, 400, 280},
{MMEndItem_Player3Score7, TEXTSTRING_BLANK, mPBlankString, 460, 280},
{MMEndItem_Player3Score8, TEXTSTRING_BLANK, mPBlankString, 520, 280},
{MMEndItem_Player4Score1, TEXTSTRING_BLANK, mPBlankString, 100, 300},
{MMEndItem_Player4Score2, TEXTSTRING_BLANK, mPBlankString, 160, 300},
{MMEndItem_Player4Score3, TEXTSTRING_BLANK, mPBlankString, 220, 300},
{MMEndItem_Player4Score4, TEXTSTRING_BLANK, mPBlankString, 280, 300},
{MMEndItem_Player4Score5, TEXTSTRING_BLANK, mPBlankString, 340, 300},
{MMEndItem_Player4Score6, TEXTSTRING_BLANK, mPBlankString, 400, 300},
{MMEndItem_Player4Score7, TEXTSTRING_BLANK, mPBlankString, 460, 300},
{MMEndItem_Player4Score8, TEXTSTRING_BLANK, mPBlankString, 520, 300},
{MMEndItem_Player5Score1, TEXTSTRING_BLANK, mPBlankString, 100, 320},
{MMEndItem_Player5Score2, TEXTSTRING_BLANK, mPBlankString, 160, 320},
{MMEndItem_Player5Score3, TEXTSTRING_BLANK, mPBlankString, 220, 320},
{MMEndItem_Player5Score4, TEXTSTRING_BLANK, mPBlankString, 280, 320},
{MMEndItem_Player5Score5, TEXTSTRING_BLANK, mPBlankString, 340, 320},
{MMEndItem_Player5Score6, TEXTSTRING_BLANK, mPBlankString, 400, 320},
{MMEndItem_Player5Score7, TEXTSTRING_BLANK, mPBlankString, 460, 320},
{MMEndItem_Player5Score8, TEXTSTRING_BLANK, mPBlankString, 520, 320},
{MMEndItem_Player6Score1, TEXTSTRING_BLANK, mPBlankString, 100, 340},
{MMEndItem_Player6Score2, TEXTSTRING_BLANK, mPBlankString, 160, 340},
{MMEndItem_Player6Score3, TEXTSTRING_BLANK, mPBlankString, 220, 340},
{MMEndItem_Player6Score4, TEXTSTRING_BLANK, mPBlankString, 280, 340},
{MMEndItem_Player6Score5, TEXTSTRING_BLANK, mPBlankString, 340, 340},
{MMEndItem_Player6Score6, TEXTSTRING_BLANK, mPBlankString, 400, 340},
{MMEndItem_Player6Score7, TEXTSTRING_BLANK, mPBlankString, 460, 340},
{MMEndItem_Player6Score8, TEXTSTRING_BLANK, mPBlankString, 520, 340},
{MMEndItem_Player7Score1, TEXTSTRING_BLANK, mPBlankString, 100, 360},
{MMEndItem_Player7Score2, TEXTSTRING_BLANK, mPBlankString, 160, 360},
{MMEndItem_Player7Score3, TEXTSTRING_BLANK, mPBlankString, 220, 360},
{MMEndItem_Player7Score4, TEXTSTRING_BLANK, mPBlankString, 280, 360},
{MMEndItem_Player7Score5, TEXTSTRING_BLANK, mPBlankString, 340, 360},
{MMEndItem_Player7Score6, TEXTSTRING_BLANK, mPBlankString, 400, 360},
{MMEndItem_Player7Score7, TEXTSTRING_BLANK, mPBlankString, 460, 360},
{MMEndItem_Player7Score8, TEXTSTRING_BLANK, mPBlankString, 520, 360},
{MMEndItem_Player8Score1, TEXTSTRING_BLANK, mPBlankString, 100, 380},
{MMEndItem_Player8Score2, TEXTSTRING_BLANK, mPBlankString, 160, 380},
{MMEndItem_Player8Score3, TEXTSTRING_BLANK, mPBlankString, 220, 380},
{MMEndItem_Player8Score4, TEXTSTRING_BLANK, mPBlankString, 280, 380},
{MMEndItem_Player8Score5, TEXTSTRING_BLANK, mPBlankString, 340, 380},
{MMEndItem_Player8Score6, TEXTSTRING_BLANK, mPBlankString, 400, 380},
{MMEndItem_Player8Score7, TEXTSTRING_BLANK, mPBlankString, 460, 380},
{MMEndItem_Player8Score8, TEXTSTRING_BLANK, mPBlankString, 520, 380},
{MMEndItem_Ok, TEXTSTRING_MULTI_OK, NULL, 60, 420},
{-1,}
};
static AVP_MENU EndNetGameMenu =
{
&EndNetGame_Backdrop,
&EndNetGame_MenuItems[0],
&EndNetGame_MenuFItems[0],
-1,
0,
};
static char scoreStringsTotal[NET_MAXPLAYERS][4];
static char initialString[NET_MAXPLAYERS][2];
static char scoreStrings[NET_MAXPLAYERS][NET_MAXPLAYERS][4];
void EndOfNetworkGameScreen(void)
{
extern int VideoMode;
extern void (*UpdateScreen[]) (void);
PlatformSpecificEnteringMenus();
Current_Menu = &EndNetGameMenu;
ProcessGraphicForLoading(&EndNetGameMenu);
thisSelection = MMEndItem_Max;
currentItem = MMEndItem_Ok;
{
int index;
for (index=0; index<MMEndItem_Max; index++) CurrentMenuStatus[index]=0;
}
CurrentMenuStatus[MMEndItem_Max]=-1;
CurrentMenuStatus[currentItem]=1;
/* set up names, etc, from the gamedata */
{
int i;
for(i=0;i<NET_MAXPLAYERS;i++)
{
if(netGameData.playerData[i].playerId)
{
/* name... */
EndNetGame_MenuFItems[i].SecondStringPtr = netGameData.playerData[i].name;
/* character type... */
switch(netGameData.playerData[i].characterType)
{
case(NGCT_Marine):
{
EndNetGame_MenuFItems[(i+NET_MAXPLAYERS)].StringID = TEXTSTRING_MULTI_MARINE;
break;
}
case(NGCT_Alien):
{
EndNetGame_MenuFItems[(i+NET_MAXPLAYERS)].StringID = TEXTSTRING_MULTI_ALIEN;
break;
}
case(NGCT_Predator):
{
EndNetGame_MenuFItems[(i+NET_MAXPLAYERS)].StringID = TEXTSTRING_MULTI_PREDATOR;
break;
}
default:
{
LOCALASSERT(1==0);
break;
}
}
/* the total score... */
{
int totalScore = AddUpPlayerScore(i);
if(totalScore>=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<NET_MAXPLAYERS;j++)
{
if(netGameData.playerData[j].playerId)
{
int thisScore;
thisScore = netGameData.playerData[i].scores[j];
if(thisScore>=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<NET_MAXPLAYERS;j++)
{
EndNetGame_MenuFItems[(j+(NET_MAXPLAYERS*(5+i)))].SecondStringPtr = mPBlankString;
}
}
}
}
}
/* wait until the user presses return */
while(!IDemandSelect())
{
DrawEntireMenuScreen();
ReadUserInput();
}
/* clean up */
ProcessGraphicForUnloading(&EndNetGameMenu);
PlatformSpecificExitingMenus();
}

View file

@ -11,7 +11,6 @@
#include "bh_types.h"
#include "dynblock.h"
#include "dynamics.h"
#include "menudefs.h"
#include "menugfx.h"
#include "bh_debri.h"
#include "pvisible.h"