From 12c6a39177837a5c4dc8928a78140b4c3bb8f47a Mon Sep 17 00:00:00 2001 From: Steven Fuller Date: Mon, 6 Aug 2001 04:07:44 +0000 Subject: [PATCH] 'Undid' stubbing of IndexedFont::IndexedFont and IndexedFont::GetFont(). Initialized ScreenDescriptorBlock to some default values. Now AvP runs and exits with no errors with current main() --- notes.txt | 2 ++ src/avp/support/indexfnt.hpp | 15 +-------------- src/main.c | 30 ++++++++++++++++++++++-------- src/stubs2.cpp | 30 +++++++++++++----------------- 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/notes.txt b/notes.txt index 6ac9da4..3852832 100644 --- a/notes.txt +++ b/notes.txt @@ -5,3 +5,5 @@ win95/awtexld.hpp line 79: ======== Changed filenames: avp/win95/system.c (avp_load_rif calls) +======== +is AvP.CurrentEnv and StartingEnv used? diff --git a/src/avp/support/indexfnt.hpp b/src/avp/support/indexfnt.hpp index b1cf0ab..a8acb16 100644 --- a/src/avp/support/indexfnt.hpp +++ b/src/avp/support/indexfnt.hpp @@ -44,10 +44,6 @@ { public: static IndexedFont* GetFont( FontIndex I_Font_ToGet ); -// static IndexedFont* GetFont( FontIndex I_Font_ToGet ) -// { -// return pIndexedFont[ I_Font_ToGet ]; -// } // can return NULL if no font loaded in that slot static void UnloadFont( FontIndex I_Font_ToGet ); @@ -164,21 +160,12 @@ static IndexedFont* pIndexedFont[ IndexedFonts_MAX_NUMBER_OF_FONTS ]; }; -#if 0 /* moved elsewhere because of GCC! */ // Inline methods: - /*inline*/ /* static */ IndexedFont* IndexedFont::GetFont( FontIndex I_Font_ToGet ) + inline /* static */ IndexedFont* IndexedFont::GetFont( FontIndex I_Font_ToGet ) { return pIndexedFont[ I_Font_ToGet ]; } -#endif - #if 0 - class IndexedFont_FixedSpace : public IndexedFont - { - public: - private: - }; - #endif /* KJL 17:20:10 15/04/98 - May God have mercy on my soul fixed space HUD font diff --git a/src/main.c b/src/main.c index 594e494..1ab8cc5 100644 --- a/src/main.c +++ b/src/main.c @@ -14,10 +14,10 @@ #include "avp_envinfo.h" #include "cdtrackselection.h" -char LevelName[] = {"predbit6\0QuiteALongNameActually"}; -static ELO ELOLevelToLoad = {&LevelName}; +char LevelName[] = {"predbit6\0QuiteALongNameActually"}; /* the real way to load levels */ extern int ScanDrawMode; /* to fix image loading */ +extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; /* this should be put in a header file */ PROCESSORTYPES ReadProcessorType() { @@ -38,8 +38,6 @@ int ExitWindowsSystem() int main(int argc, char *argv[]) { - int level_to_load = I_Num_Environments; - LoadCDTrackList(); SetFastRandom(); @@ -57,8 +55,9 @@ int main(int argc, char *argv[]) InitialVideoMode(); - Env_List[0] = &(ELOLevelToLoad); - level_to_load = 0; + /* Env_List can probably be removed */ +// Env_List[0]->main = &(ELOLevelToLoad); /* overwrite the first entry of crappy env_list with LevelName */ + Env_List[0]->main = LevelName; InitialiseSystem(); InitialiseRenderer(); @@ -78,7 +77,7 @@ int main(int argc, char *argv[]) AvP.LevelCompleted = 0; LoadSounds("PLAYER"); - AvP.CurrentEnv = AvP.StartingEnv = 0; /* ??? */ + AvP.CurrentEnv = AvP.StartingEnv = 0; /* are these even used? */ SetLevelToLoad(AVP_ENVIRONMENT_INVASION); /* because the menus aren't implemented */ // while(AvP_MainMenus()) { @@ -86,6 +85,18 @@ int main(int argc, char *argv[]) d3d_light_ctrl.ctrl = LCCM_NORMAL; d3d_overlay_ctrl.ctrl = OCCM_NORMAL; + /* 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; + // GetCorrectDirectDrawObject(); start_of_loaded_shapes = load_precompiled_shapes(); @@ -130,6 +141,9 @@ int main(int argc, char *argv[]) break; /* TODO -- remove when loop works */ } -// } +// } + + fprintf(stderr, "Now exiting Aliens vs Predator! At least it didn't crash!\n"); + return 0; } diff --git a/src/stubs2.cpp b/src/stubs2.cpp index 72cb86e..e2c8d8c 100644 --- a/src/stubs2.cpp +++ b/src/stubs2.cpp @@ -27,15 +27,21 @@ void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour /* indexfnt.cpp */ -#if 1 -IndexedFont* IndexedFont::GetFont(FontIndex I_Font_ToGet) -{ - fprintf(stderr, "IndexedFont::GetFont(%d)\n", I_Font_ToGet); -// return pIndexedFont[ I_Font_ToGet ]; +IndexedFont* IndexedFont :: pIndexedFont[ IndexedFonts_MAX_NUMBER_OF_FONTS ]; - return NULL; +IndexedFont::IndexedFont(FontIndex I_Font_New) +{ + fprintf(stderr, "IndexedFont::IndexedFont(%d)\n", I_Font_New); + + I_Font_Val = I_Font_New; + + pIndexedFont[ I_Font_New ] = this; +} + +IndexedFont::~IndexedFont() +{ + fprintf(stderr, "IndexedFont::~IndexedFont()\n"); } -#endif void IndexedFont::UnloadFont(FontIndex I_Font_ToGet) { @@ -54,16 +60,6 @@ void IndexedFont_Proportional_PF::PFUnLoadHook(FontIndex I_Font_ToGet) fprintf(stderr, "IndexedFont_Proportional_PF::PFUnLoadHook(%d)\n", I_Font_ToGet); } -IndexedFont::IndexedFont(FontIndex I_Font_New) -{ - fprintf(stderr, "IndexedFont::IndexedFont(%d)\n", I_Font_New); -} - -IndexedFont::~IndexedFont() -{ - fprintf(stderr, "IndexedFont::~IndexedFont()\n"); -} - IndexedFont_HUD::IndexedFont_HUD(FontIndex I_Font_New) : IndexedFont(I_Font_New) { fprintf(stderr, "IndexedFont_HUD::IndexedFont_HUD(%d)\n", I_Font_New);