2001-07-29 20:57:33 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "fixer.h"
|
|
|
|
|
2001-08-04 15:46:22 +00:00
|
|
|
#include "3dc.h"
|
2001-08-05 05:51:56 +00:00
|
|
|
#include "platform.h"
|
|
|
|
#include "gamedef.h"
|
|
|
|
#include "gameplat.h"
|
|
|
|
#include "ffstdio.h"
|
|
|
|
#include "vision.h"
|
|
|
|
#include "comp_shp.h"
|
|
|
|
#include "avp_envinfo.h"
|
2001-08-06 19:50:26 +00:00
|
|
|
#include "stratdef.h"
|
|
|
|
#include "bh_types.h"
|
|
|
|
#include "avp_userprofile.h"
|
|
|
|
#include "pldnet.h"
|
2001-08-04 15:46:22 +00:00
|
|
|
#include "cdtrackselection.h"
|
|
|
|
|
2001-08-06 04:07:44 +00:00
|
|
|
char LevelName[] = {"predbit6\0QuiteALongNameActually"}; /* the real way to load levels */
|
2001-08-05 05:51:56 +00:00
|
|
|
|
|
|
|
extern int ScanDrawMode; /* to fix image loading */
|
2001-08-06 04:07:44 +00:00
|
|
|
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; /* this should be put in a header file */
|
2001-08-05 05:51:56 +00:00
|
|
|
|
2001-07-31 04:06:01 +00:00
|
|
|
PROCESSORTYPES ReadProcessorType()
|
|
|
|
{
|
|
|
|
return PType_PentiumMMX;
|
|
|
|
}
|
|
|
|
|
|
|
|
int InitialiseWindowsSystem()
|
|
|
|
{
|
2001-08-05 05:51:56 +00:00
|
|
|
ScanDrawMode = ScanDrawD3DHardwareRGB;
|
|
|
|
|
2001-07-31 04:06:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-08-03 05:30:40 +00:00
|
|
|
int ExitWindowsSystem()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-07-29 20:57:33 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2001-08-06 19:50:26 +00:00
|
|
|
int menusActive = 0;
|
|
|
|
int thisLevelHasBeenCompleted = 0;
|
|
|
|
|
2001-08-04 15:46:22 +00:00
|
|
|
LoadCDTrackList();
|
|
|
|
|
2001-08-05 05:51:56 +00:00
|
|
|
SetFastRandom();
|
|
|
|
|
|
|
|
GetPathFromRegistry();
|
|
|
|
|
|
|
|
#if MARINE_DEMO
|
|
|
|
ffInit("fastfile/mffinfo.txt","fastfile/");
|
|
|
|
#elif ALIEN_DEMO
|
|
|
|
ffInit("alienfastfile/ffinfo.txt","alienfastfile/");
|
|
|
|
#else
|
|
|
|
ffInit("fastfile/ffinfo.txt","fastfile/");
|
|
|
|
#endif
|
|
|
|
InitGame();
|
|
|
|
|
|
|
|
InitialVideoMode();
|
|
|
|
|
2001-08-06 04:07:44 +00:00
|
|
|
/* Env_List can probably be removed */
|
2001-08-06 19:50:26 +00:00
|
|
|
// Env_List[0] = &(ELOLevelToLoad); /* overwrite the first entry of crappy env_list with LevelName */
|
2001-08-06 04:07:44 +00:00
|
|
|
Env_List[0]->main = LevelName;
|
2001-08-05 05:51:56 +00:00
|
|
|
|
|
|
|
InitialiseSystem();
|
|
|
|
InitialiseRenderer();
|
|
|
|
|
|
|
|
/* InitOptionsMenu(); NOT YET */
|
|
|
|
|
|
|
|
LoadKeyConfiguration();
|
|
|
|
|
|
|
|
SoundSys_Start();
|
|
|
|
CDDA_Start();
|
|
|
|
|
|
|
|
InitTextStrings();
|
|
|
|
|
|
|
|
BuildMultiplayerLevelNameArray();
|
|
|
|
|
|
|
|
ChangeDirectDrawObject();
|
|
|
|
AvP.LevelCompleted = 0;
|
|
|
|
LoadSounds("PLAYER");
|
|
|
|
|
2001-08-06 04:07:44 +00:00
|
|
|
AvP.CurrentEnv = AvP.StartingEnv = 0; /* are these even used? */
|
2001-08-05 05:51:56 +00:00
|
|
|
SetLevelToLoad(AVP_ENVIRONMENT_INVASION); /* because the menus aren't implemented */
|
|
|
|
|
|
|
|
// while(AvP_MainMenus()) {
|
|
|
|
|
|
|
|
d3d_light_ctrl.ctrl = LCCM_NORMAL;
|
|
|
|
d3d_overlay_ctrl.ctrl = OCCM_NORMAL;
|
|
|
|
|
2001-08-06 04:07:44 +00:00
|
|
|
/* this was in windows SetGameVideoMode: */
|
|
|
|
ScreenDescriptorBlock.SDB_Width = 640;
|
|
|
|
ScreenDescriptorBlock.SDB_Height = 480;
|
|
|
|
ScreenDescriptorBlock.SDB_CentreX = 640/2;
|
|
|
|
ScreenDescriptorBlock.SDB_CentreY = 480/2;
|
|
|
|
ScreenDescriptorBlock.SDB_ProjX = 640/2;
|
|
|
|
ScreenDescriptorBlock.SDB_ProjY = 480/2;
|
|
|
|
ScreenDescriptorBlock.SDB_ClipLeft = 0;
|
|
|
|
ScreenDescriptorBlock.SDB_ClipRight = 640;
|
|
|
|
ScreenDescriptorBlock.SDB_ClipUp = 0;
|
|
|
|
ScreenDescriptorBlock.SDB_ClipDown = 480;
|
|
|
|
|
2001-08-05 05:51:56 +00:00
|
|
|
// GetCorrectDirectDrawObject();
|
|
|
|
|
|
|
|
start_of_loaded_shapes = load_precompiled_shapes();
|
|
|
|
|
|
|
|
InitCharacter();
|
|
|
|
|
|
|
|
LoadRifFile(); /* sets up a map */
|
|
|
|
|
|
|
|
AssignAllSBNames();
|
|
|
|
|
|
|
|
StartGame();
|
|
|
|
|
|
|
|
ffcloseall();
|
|
|
|
|
|
|
|
AvP.MainLoopRunning = 1;
|
|
|
|
|
|
|
|
/* ScanImagesForFMVs(); NOT YET */
|
|
|
|
|
|
|
|
ResetFrameCounter();
|
|
|
|
|
|
|
|
/* Game_Has_Loaded(); NOT YET */
|
|
|
|
|
|
|
|
ResetFrameCounter();
|
|
|
|
|
|
|
|
/* IngameKeyboardInput_ClearBuffer(); NOT YET */
|
|
|
|
|
|
|
|
while(AvP.MainLoopRunning) {
|
|
|
|
CheckForWindowsMessages();
|
|
|
|
|
|
|
|
switch(AvP.GameMode) {
|
|
|
|
case I_GM_Playing:
|
2001-08-06 19:50:26 +00:00
|
|
|
if ((!menusActive || (AvP.Network!=I_No_Network && !netGameData.skirmishMode)) && !AvP.LevelCompleted) {
|
|
|
|
/* TODO: print some debugging stuff */
|
|
|
|
|
|
|
|
DoAllShapeAnimations();
|
|
|
|
|
|
|
|
UpdateGame();
|
|
|
|
|
|
|
|
AvpShowViews();
|
|
|
|
|
|
|
|
MaintainHUD();
|
|
|
|
|
|
|
|
CheckCDAndChooseTrackIfNeeded();
|
|
|
|
|
|
|
|
if(InGameMenusAreRunning() && ( (AvP.Network!=I_No_Network && netGameData.skirmishMode) || (AvP.Network==I_No_Network)) ) {
|
|
|
|
SoundSys_StopAll();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ReadUserInput();
|
|
|
|
|
|
|
|
/* UpdateAllFMVTextures(); NOT YET */
|
|
|
|
|
|
|
|
SoundSys_Management();
|
|
|
|
|
|
|
|
FlushD3DZBuffer();
|
|
|
|
|
|
|
|
ThisFramesRenderingHasBegun();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NOT YET
|
|
|
|
menusActive = AvP_InGameMenus();
|
|
|
|
if (AvP.RestartLevel) menusActive=0;
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (AvP.LevelCompleted) {
|
|
|
|
SoundSys_FadeOutFast();
|
|
|
|
DoCompletedLevelStatisticsScreen();
|
|
|
|
thisLevelHasBeenCompleted = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ThisFramesRenderingHasFinished();
|
|
|
|
|
|
|
|
/* NOT YET
|
|
|
|
InGameFlipBuffers();
|
|
|
|
*/
|
|
|
|
|
|
|
|
FrameCounterHandler();
|
|
|
|
{
|
|
|
|
PLAYER_STATUS *playerStatusPtr = (PLAYER_STATUS *) (Player->ObStrategyBlock->SBdataptr);
|
|
|
|
|
|
|
|
if (!menusActive && playerStatusPtr->IsAlive && !AvP.LevelCompleted) {
|
|
|
|
DealWithElapsedTime();
|
|
|
|
}
|
|
|
|
}
|
2001-08-05 05:51:56 +00:00
|
|
|
break;
|
2001-08-06 19:50:26 +00:00
|
|
|
|
2001-08-05 05:51:56 +00:00
|
|
|
case I_GM_Menus:
|
|
|
|
AvP.GameMode = I_GM_Playing;
|
|
|
|
break;
|
|
|
|
case I_GM_Paused:
|
2001-08-06 19:50:26 +00:00
|
|
|
// break;
|
2001-08-05 05:51:56 +00:00
|
|
|
default:
|
|
|
|
fprintf(stderr, "AvP.MainLoopRunning: gamemode = %d\n", AvP.GameMode);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
2001-08-06 19:50:26 +00:00
|
|
|
|
|
|
|
if (AvP.RestartLevel) {
|
|
|
|
AvP.RestartLevel = 0;
|
|
|
|
AvP.LevelCompleted = 0;
|
|
|
|
/* NOT YET
|
|
|
|
FixCheatModesInUserProfile(UserProfilePtr);
|
|
|
|
*/
|
|
|
|
RestartLevel();
|
|
|
|
}
|
|
|
|
|
2001-08-05 05:51:56 +00:00
|
|
|
break; /* TODO -- remove when loop works */
|
|
|
|
}
|
2001-08-06 19:50:26 +00:00
|
|
|
|
|
|
|
AvP.LevelCompleted = thisLevelHasBeenCompleted;
|
|
|
|
|
|
|
|
/* NOT YET
|
|
|
|
FixCheatModesInUserProfile(UserProfilePtr);
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* NOT YET
|
|
|
|
CloseFMV();
|
|
|
|
ReleaseAllFMVTextures();
|
|
|
|
*/
|
|
|
|
|
|
|
|
CONSBIND_WriteKeyBindingsToConfigFile();
|
|
|
|
|
|
|
|
DeInitialisePlayer();
|
|
|
|
|
|
|
|
DeallocatePlayersMirrorImage();
|
|
|
|
|
|
|
|
KillHUD();
|
|
|
|
|
|
|
|
Destroy_CurrentEnvironment();
|
|
|
|
|
|
|
|
DeallocateAllImages();
|
|
|
|
|
|
|
|
EndNPCs();
|
|
|
|
|
|
|
|
ExitGame();
|
|
|
|
|
|
|
|
SoundSys_StopAll();
|
|
|
|
|
|
|
|
SoundSys_ResetFadeLevel();
|
|
|
|
|
|
|
|
CDDA_Stop();
|
|
|
|
|
|
|
|
if (AvP.Network != I_No_Network) {
|
|
|
|
/* NOT YET
|
|
|
|
EndAVPNetGame();
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
ClearMemoryPool();
|
2001-08-05 05:51:56 +00:00
|
|
|
|
2001-08-06 04:07:44 +00:00
|
|
|
// }
|
|
|
|
|
2001-08-06 19:50:26 +00:00
|
|
|
SoundSys_StopAll();
|
|
|
|
SoundSys_RemoveAll();
|
|
|
|
|
|
|
|
ExitSystem();
|
|
|
|
|
|
|
|
CDDA_End();
|
|
|
|
ClearMemoryPool();
|
|
|
|
|
2001-08-06 04:07:44 +00:00
|
|
|
fprintf(stderr, "Now exiting Aliens vs Predator! At least it didn't crash!\n");
|
|
|
|
|
2001-07-29 20:57:33 +00:00
|
|
|
return 0;
|
|
|
|
}
|