summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--TODO3
-rw-r--r--notes.txt3
-rw-r--r--src/avp/language.h2
-rw-r--r--src/avp/scream.cpp21
-rw-r--r--src/avp/win95/ffread.cpp6
-rw-r--r--src/avp/win95/npcsetup.cpp6
-rw-r--r--src/avp/win95/projload.cpp44
-rw-r--r--src/avp/win95/system.c26
-rw-r--r--src/fixer.h31
-rw-r--r--src/main.c105
-rw-r--r--src/stubs.c166
-rw-r--r--src/win95/aw.h14
-rw-r--r--src/win95/awtexld.cpp22
-rw-r--r--src/win95/db.c5
-rw-r--r--src/winapi.c197
16 files changed, 441 insertions, 214 deletions
diff --git a/Makefile b/Makefile
index 875640d..bf5f3d0 100644
--- a/Makefile
+++ b/Makefile
@@ -10,14 +10,14 @@ LDLIBS += -L/usr/X11R6/lib -lX11 -lXext `sdl-config --libs`
AFLAGS = -g -Iinclude/ -w+macro-params -w+orphan-labels -w+number-overflow
-ROOT = main.c stubs.c stubs2.cpp afont.c frustum.c kshape.c map.c maths.c md5.c mem3dc.c mem3dcpp.cpp module.c morph.c mslhand.c object.c shpanim.c sphere.c tables.c vdb.c version.c
+ROOT = main.c stubs.c stubs2.cpp winapi.c afont.c frustum.c kshape.c map.c maths.c md5.c mem3dc.c mem3dcpp.cpp module.c morph.c mslhand.c object.c shpanim.c sphere.c tables.c vdb.c version.c
AVP = ai_sight.c avpview.c bh_agun.c bh_ais.c bh_alien.c bh_binsw.c bh_cable.c bh_corpse.c bh_deathvol.c bh_debri.c bh_dummy.c bh_fan.c bh_far.c bh_fhug.c bh_gener.c bh_ldoor.c bh_lift.c bh_light.c bh_lnksw.c bh_ltfx.c bh_marin.c bh_mission.c bh_near.c bh_pargen.c bh_plachier.c bh_plift.c bh_pred.c bh_queen.c bh_rubberduck.c bh_selfdest.c bh_snds.c bh_spcl.c bh_swdor.c bh_track.c bh_types.c bh_videoscreen.c bh_waypt.c bh_weap.c bh_xeno.c bonusabilities.c cconvars.cpp cdtrackselection.cpp cheatmodes.c comp_map.c comp_shp.c consolelog.cpp davehook.cpp deaths.c decal.c detaillevels.c dynamics.c dynblock.c equipmnt.c equiputl.cpp extents.c game.c game_statistics.c gamecmds.cpp gameflow.c gamevars.cpp hmodel.c hud.c inventry.c language.c lighting.c load_shp.c los.c maps.c mempool.c messagehistory.c missions.cpp movement.c paintball.c particle.c pfarlocs.c pheromon.c player.c pmove.c psnd.c psndproj.c pvisible.c savegame.c scream.cpp secstats.c sfx.c stratdef.c targeting.c track.c triggers.c weapons.c
SHAPES = cube.c
SUPPORT = consbind.cpp consbtch.cpp coordstr.cpp daemon.cpp r2base.cpp r2pos666.cpp reflist.cpp refobj.cpp scstring.cpp strtab.cpp strutil.c trig666.cpp wrapstr.cpp
AVPWIN95 = avpchunk.cpp cheat.c chtcodes.cpp d3d_hud.cpp ddplat.cpp endianio.c ffread.cpp ffstdio.cpp gflwplat.c hierplace.cpp iofocus.cpp jsndsup.cpp kzsort.c langplat.c modcmds.cpp npcsetup.cpp objsetup.cpp pathchnk.cpp platsup.c pldghost.c projload.cpp scrshot.cpp strachnk.cpp system.c usr_io.c vision.c
FRONTEND = avp_envinfo.c avp_intro.cpp avp_menudata.c
GADGETS = ahudgadg.cpp conscmnd.cpp conssym.cpp consvar.cpp gadget.cpp hudgadg.cpp rootgadg.cpp t_ingadg.cpp teletype.cpp textexp.cpp textin.cpp trepgadg.cpp
-WIN95 = animchnk.cpp animobs.cpp awtexld.cpp bmpnames.cpp chnkload.cpp chnktexi.cpp chnktype.cpp chunk.cpp chunkpal.cpp db.c debuglog.cpp dummyobjectchunk.cpp enumchnk.cpp enumsch.cpp envchunk.cpp fail.c fragchnk.cpp gsprchnk.cpp hierchnk.cpp huffman.cpp iff.cpp iff_ilbm.cpp ilbm_ext.cpp io.c list_tem.cpp ltchunk.cpp media.cpp mishchnk.cpp obchunk.cpp oechunk.cpp our_mem.c plat_shp.c plspecfn.c shpchunk.cpp sndchunk.cpp sprchunk.cpp string.cpp texio.c toolchnk.cpp txioctrl.cpp wpchunk.cpp zsp.cpp
+WIN95 = animchnk.cpp animobs.cpp awtexld.cpp awbmpld.cpp awiffld.cpp awpnmld.cpp bmpnames.cpp chnkload.cpp chnktexi.cpp chnktype.cpp chunk.cpp chunkpal.cpp db.c debuglog.cpp dummyobjectchunk.cpp enumchnk.cpp enumsch.cpp envchunk.cpp fail.c fragchnk.cpp gsprchnk.cpp hierchnk.cpp huffman.cpp iff.cpp iff_ilbm.cpp ilbm_ext.cpp io.c list_tem.cpp ltchunk.cpp media.cpp mishchnk.cpp obchunk.cpp oechunk.cpp our_mem.c plat_shp.c plspecfn.c shpchunk.cpp sndchunk.cpp sprchunk.cpp string.cpp texio.c toolchnk.cpp txioctrl.cpp wpchunk.cpp zsp.cpp
# awbmpld.cpp awiffld.cpp awpnmld.cpp awtexld.cpp
# the following should really be autogenerated...
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..25f1133
--- /dev/null
+++ b/TODO
@@ -0,0 +1,3 @@
+* ScreenDescriptorBlock: init this somewhere before StartGame, seems to be
+ initialized in the menu code
+
diff --git a/notes.txt b/notes.txt
index 3e20e46..6ac9da4 100644
--- a/notes.txt
+++ b/notes.txt
@@ -2,3 +2,6 @@ win95/awtexld.hpp line 79:
/* TODO */
/*|pixelFormat.ddpf.dwRGBAlphaBitMask*/
+========
+Changed filenames:
+avp/win95/system.c (avp_load_rif calls)
diff --git a/src/avp/language.h b/src/avp/language.h
index 7212aa0..9d95f23 100644
--- a/src/avp/language.h
+++ b/src/avp/language.h
@@ -39,4 +39,4 @@ extern void UnloadTextFile(char *filename, char *bufferPtr);
**********************************************************KJL*/
-#endif \ No newline at end of file
+#endif
diff --git a/src/avp/scream.cpp b/src/avp/scream.cpp
index a43ab8a..9d9bc9f 100644
--- a/src/avp/scream.cpp
+++ b/src/avp/scream.cpp
@@ -56,12 +56,13 @@ static CharacterSoundEffects QueenSounds={0,0,0,SID_NOSOUND};
//static SOUNDINDEX global_last_sound;
+/* TODO: dir separator */
#if ALIEN_DEMO
-#define ScreamFilePath "alienfastfile\\"
+#define ScreamFilePath "alienfastfile/"
#elif LOAD_SCREAMS_FROM_FASTFILES
-#define ScreamFilePath "fastfile\\"
+#define ScreamFilePath "fastfile/"
#else
-#define ScreamFilePath "sound\\"
+#define ScreamFilePath "sound/"
#endif
#if 0
@@ -99,7 +100,8 @@ void LoadScreamSounds()
voice_types=(ScreamVoiceType*) PoolAllocateMem(num_voice_types * sizeof(ScreamVoiceType));
- char wavpath[200]="npc\\marinevoice\\";
+ /* TODO: dir separator */
+ char wavpath[200]="npc/marinevoice/";
char* wavname=&wavpath[strlen(wavpath)];
for(int i=0;i<num_voice_types;i++)
{
@@ -345,22 +347,23 @@ void UnloadScreamSounds()
}
+/* TODO: dir separator */
void LoadMarineScreamSounds()
{
- MarineSounds.LoadSounds("marsound.dat","npc\\marinevoice\\");
+ MarineSounds.LoadSounds("marsound.dat","npc/marinevoice/");
}
void LoadAlienScreamSounds()
{
- AlienSounds.LoadSounds("aliensound.dat","npc\\alienvoice\\");
+ AlienSounds.LoadSounds("aliensound.dat","npc/alienvoice/");
}
void LoadPredatorScreamSounds()
{
- PredatorSounds.LoadSounds("predsound.dat","npc\\predatorvoice\\");
+ PredatorSounds.LoadSounds("predsound.dat","npc/predatorvoice/");
}
void LoadQueenScreamSounds()
{
- QueenSounds.LoadSounds("queensound.dat","npc\\queenvoice\\");
+ QueenSounds.LoadSounds("queensound.dat","npc/queenvoice/");
}
@@ -384,4 +387,4 @@ void PlayQueenSound(int VoiceType,int SoundCategory,int PitchShift,int* External
-}; \ No newline at end of file
+};
diff --git a/src/avp/win95/ffread.cpp b/src/avp/win95/ffread.cpp
index 6d5ef90..a66f713 100644
--- a/src/avp/win95/ffread.cpp
+++ b/src/avp/win95/ffread.cpp
@@ -179,9 +179,11 @@ FFHeaderI::FFHeaderI(char const *_filename,BOOL _should_be_kept)
{
if (_filename)
{
- filename = new char [strlen(_filename)+1];
+ filename = new char [strlen(_filename) + 1];
strcpy(filename,_filename);
+ FixFilename(filename);
+
Read();
}
}
@@ -282,7 +284,7 @@ FFError FFHeaderI::Read(char const *_filename)
if (INVALID_HANDLE_VALUE==h)
{
- ReportError(_filename);
+ ReportError(filename);
return FF_COULDNOTOPENFILE;
}
diff --git a/src/avp/win95/npcsetup.cpp b/src/avp/win95/npcsetup.cpp
index 4a650e4..8d9a75a 100644
--- a/src/avp/win95/npcsetup.cpp
+++ b/src/avp/win95/npcsetup.cpp
@@ -13,10 +13,12 @@
#include "avp_menus.h"
+/* TODO: dir separator */
+
#if ALIEN_DEMO
-#define DIRECTORY_FOR_RIFS "alienavp_huds\\"
+#define DIRECTORY_FOR_RIFS "alienavp_huds/"
#else
-#define DIRECTORY_FOR_RIFS "avp_huds\\"
+#define DIRECTORY_FOR_RIFS "avp_huds/"
#endif
#define FIRST_FREE_IMAGE_GROUP 3 // 0 for char,1 for weapon rif ,2 for env
diff --git a/src/avp/win95/projload.cpp b/src/avp/win95/projload.cpp
index 10e1d2d..7838cda 100644
--- a/src/avp/win95/projload.cpp
+++ b/src/avp/win95/projload.cpp
@@ -368,7 +368,9 @@ void LoadedPlacedHierarchy::load_rif()
{
if(placed_rif!=INVALID_RIFFHANDLE) return;
char file_path[100];
- sprintf(file_path,"avp_huds\\%s.rif",file_name);
+
+/* TODO: dir seperator */
+ sprintf(file_path,"avp_huds/%s.rif",file_name);
placed_rif=avp_load_rif_non_env(file_path);
if(placed_rif!=INVALID_RIFFHANDLE)
@@ -504,7 +506,8 @@ Global_Hierarchy_Store::Global_Hierarchy_Store (RIFFHANDLE h)
sound_array[index].volume=isc->max_volume;
if(dir_chunk)
{
- sprintf(wavname,"%s\\%s",dir_chunk->directory,isc->wav_name);
+ /* TODO: dir separator */
+ sprintf(wavname,"%s/%s",dir_chunk->directory,isc->wav_name);
sound_array[index].sound_loaded=GetSound(wavname);
}
else
@@ -3082,11 +3085,8 @@ void DeallocateModules()
//and get rid of the strategy lists
deallocate_behaviour_list();
-
-
}
-
void avp_undo_rif_load(RIFFHANDLE h)
{
DeleteHierarchyLibraryEntry(h);
@@ -3096,34 +3096,40 @@ void avp_undo_rif_load(RIFFHANDLE h)
RIFFHANDLE avp_load_rif (const char * fname)
{
//see if there is a local copy of the rif file
- FILE* rifFile=fopen(fname,"rb");
- if(!rifFile && AvpCDPath)
+ FILE* rifFile = fopen(fname,"rb");
+
+/* TODO: Let's find a better method */
+ if (!rifFile && AvpCDPath)
{
//try and load rif file from cd instead
char RifName[200];
- sprintf(RifName,"%s%s",AvpCDPath,fname);
+ sprintf(RifName, "%s%s", AvpCDPath, fname);
return load_rif(RifName);
}
- fclose(rifFile);
+ if (rifFile)
+ fclose(rifFile);
return load_rif(fname);
-
}
+
RIFFHANDLE avp_load_rif_non_env (const char * fname)
{
//see if there is a local copy of the rif file
- FILE* rifFile=fopen(fname,"rb");
- if(!rifFile && AvpCDPath)
+ FILE* rifFile = fopen(fname, "rb");
+
+/* TODO: Let's find a better method */
+ if (!rifFile && AvpCDPath)
{
//try and load rif file from cd instead
char RifName[200];
- sprintf(RifName,"%s%s",AvpCDPath,fname);
+ sprintf(RifName, "%s%s", AvpCDPath, fname);
return load_rif_non_env(RifName);
}
- fclose(rifFile);
+ if (rifFile)
+ fclose(rifFile);
+
return load_rif_non_env(fname);
-
}
@@ -3136,7 +3142,8 @@ void LoadModuleData()
{
GLOBALASSERT(env_rif);
- HANDLE file = CreateFile ("avp_rifs\\module.bbb", GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
+/* TODO: dir separator */
+ HANDLE file = CreateFile ("avp_rifs/module.bbb", GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
FILE_FLAG_RANDOM_ACCESS, 0);
unsigned long byteswritten;
WriteFile(file,&Global_VDB_Ptr->VDB_World,sizeof(VECTORCH),&byteswritten,0);
@@ -3144,7 +3151,8 @@ void LoadModuleData()
CloseHandle(file);
- file = CreateFile ("avp_rifs\\module.aaa", GENERIC_READ, 0, 0, OPEN_EXISTING,
+/* TODO: dir separator */
+ file = CreateFile ("avp_rifs/module.aaa", GENERIC_READ, 0, 0, OPEN_EXISTING,
FILE_FLAG_RANDOM_ACCESS, 0);
if(file==INVALID_HANDLE_VALUE) return;
@@ -3168,7 +3176,7 @@ void LoadModuleData()
char* name1=&name[0];
while(name[i])
{
- if(name[i]=='\\' || name[i]==':')
+ if(name[i]=='\\' || name[i]==':' /* || name[i]=='/' */)
{
name1=&name[i+1];
}
diff --git a/src/avp/win95/system.c b/src/avp/win95/system.c
index f8bd597..363a8da 100644
--- a/src/avp/win95/system.c
+++ b/src/avp/win95/system.c
@@ -399,29 +399,29 @@ void InitCharacter()
{
case I_Marine:
{
- marine_weapon_rif = avp_load_rif("avp_huds\\marwep.rif");
+ marine_weapon_rif = avp_load_rif("avp_huds/marwep.rif");
Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.25);
- player_rif = avp_load_rif("avp_huds\\marine.rif");
+ player_rif = avp_load_rif("avp_huds/marine.rif");
break;
}
case I_Predator:
{
- predator_weapon_rif = avp_load_rif("avp_huds\\pred_hud.rif");
+ predator_weapon_rif = avp_load_rif("avp_huds/pred_hud.rif");
Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.25);
- player_rif = avp_load_rif("avp_huds\\predator.rif");
+ player_rif = avp_load_rif("avp_huds/predator.rif");
break;
}
case I_Alien:
{
#if ALIEN_DEMO
- alien_weapon_rif = avp_load_rif("alienavp_huds\\alien_hud.rif");
+ alien_weapon_rif = avp_load_rif("alienavp_huds/alien_hud.rif");
Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.25);
- player_rif = avp_load_rif("alienavp_huds\\alien.rif");
+ player_rif = avp_load_rif("alienavp_huds/alien.rif");
#else
- alien_weapon_rif = avp_load_rif("avp_huds\\alien_hud.rif");
+ alien_weapon_rif = avp_load_rif("avp_huds/alien_hud.rif");
Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.25);
- player_rif = avp_load_rif("avp_huds\\alien.rif");
+ player_rif = avp_load_rif("avp_huds/alien.rif");
#endif
break;
}
@@ -440,12 +440,12 @@ void InitCharacter()
// set up a multiplayer game - here becuse we might end
// up with a cooperative game
//load all weapon rifs
- marine_weapon_rif = avp_load_rif("avp_huds\\marwep.rif");
- predator_weapon_rif = avp_load_rif("avp_huds\\pred_hud.rif");
- alien_weapon_rif = avp_load_rif("avp_huds\\alien_hud.rif");
+ marine_weapon_rif = avp_load_rif("avp_huds/marwep.rif");
+ predator_weapon_rif = avp_load_rif("avp_huds/pred_hud.rif");
+ alien_weapon_rif = avp_load_rif("avp_huds/alien_hud.rif");
Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.25);
- player_rif = avp_load_rif("avp_huds\\multip.rif");
+ player_rif = avp_load_rif("avp_huds/multip.rif");
}
}
Set_Progress_Bar_Position(PBAR_HUD_START+PBAR_HUD_INTERVAL*.5);
@@ -821,6 +821,8 @@ void LoadRifFile()
catpathandextension(&file_and_path[0], Env_List[AvP.CurrentEnv]->main); /* root of the file name,smae as dir*/
catpathandextension(&file_and_path[0], (char *)&FileNameExtension[0]); /* extension*/
+ FixFilename(file_and_path);
+
env_rif = avp_load_rif((const char*)&file_and_path[0]);
Set_Progress_Bar_Position(PBAR_LEVEL_START+PBAR_LEVEL_INTERVAL*.4);
diff --git a/src/fixer.h b/src/fixer.h
index 1c714fe..ee99063 100644
--- a/src/fixer.h
+++ b/src/fixer.h
@@ -45,6 +45,8 @@ size_t _mbclen(const unsigned char *s);
#define MAX_PATH PATH_MAX
+void FixFilename(char *str);
+
/* windows junk */
typedef int GUID;
typedef int DPID;
@@ -90,20 +92,21 @@ typedef struct SYSTEMTIME
} SYSTEMTIME;
#define INVALID_HANDLE_VALUE -1
-#define GENERIC_WRITE 1
-#define CREATE_ALWAYS 2
-#define FILE_FLAG_RANDOM_ACCESS 3
-#define GENERIC_READ 4
-#define OPEN_EXISTING 5
-#define FILE_ATTRIBUTE_READONLY 6
-#define FILE_CURRENT 7
-#define FILE_BEGIN 8
-#define FILE_END 9
-#define FILE_SHARE_READ 10
-#define FILE_ATTRIBUTE_DIRECTORY 11
-#define FILE_SHARE_WRITE 12
-#define OPEN_ALWAYS 13
-#define FILE_ATTRIBUTE_NORMAL 14
+#define GENERIC_WRITE 0x0001
+#define CREATE_ALWAYS 0x0002
+#define FILE_FLAG_RANDOM_ACCESS 0x0004
+#define GENERIC_READ 0x0008
+#define OPEN_EXISTING 0x0010
+#define FILE_ATTRIBUTE_READONLY 0x0020
+#define FILE_CURRENT 0x0040
+#define FILE_BEGIN 0x0080
+#define FILE_END 0x0100
+#define FILE_SHARE_READ 0x0200
+#define FILE_ATTRIBUTE_DIRECTORY 0x0400
+#define FILE_SHARE_WRITE 0x0800
+#define OPEN_ALWAYS 0x1000
+#define FILE_ATTRIBUTE_NORMAL 0x2000
+
HANDLE CreateFile(const char *file, int write, int x, int y, int flags, int flags2, int z);
HANDLE CreateFileA(const char *file, int write, int x, int y, int flags, int flags2, int z);
diff --git a/src/main.c b/src/main.c
index 62c0c74..594e494 100644
--- a/src/main.c
+++ b/src/main.c
@@ -5,8 +5,20 @@
#include "fixer.h"
#include "3dc.h"
+#include "platform.h"
+#include "gamedef.h"
+#include "gameplat.h"
+#include "ffstdio.h"
+#include "vision.h"
+#include "comp_shp.h"
+#include "avp_envinfo.h"
#include "cdtrackselection.h"
+char LevelName[] = {"predbit6\0QuiteALongNameActually"};
+static ELO ELOLevelToLoad = {&LevelName};
+
+extern int ScanDrawMode; /* to fix image loading */
+
PROCESSORTYPES ReadProcessorType()
{
return PType_PentiumMMX;
@@ -14,6 +26,8 @@ PROCESSORTYPES ReadProcessorType()
int InitialiseWindowsSystem()
{
+ ScanDrawMode = ScanDrawD3DHardwareRGB;
+
return 0;
}
@@ -24,7 +38,98 @@ int ExitWindowsSystem()
int main(int argc, char *argv[])
{
+ int level_to_load = I_Num_Environments;
+
LoadCDTrackList();
+ 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();
+
+ Env_List[0] = &(ELOLevelToLoad);
+ level_to_load = 0;
+
+ InitialiseSystem();
+ InitialiseRenderer();
+
+/* InitOptionsMenu(); NOT YET */
+
+ LoadKeyConfiguration();
+
+ SoundSys_Start();
+ CDDA_Start();
+
+ InitTextStrings();
+
+ BuildMultiplayerLevelNameArray();
+
+ ChangeDirectDrawObject();
+ AvP.LevelCompleted = 0;
+ LoadSounds("PLAYER");
+
+ AvP.CurrentEnv = AvP.StartingEnv = 0; /* ??? */
+ 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;
+
+ // 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:
+ break;
+ case I_GM_Menus:
+ AvP.GameMode = I_GM_Playing;
+ break;
+ case I_GM_Paused:
+ break;
+ default:
+ fprintf(stderr, "AvP.MainLoopRunning: gamemode = %d\n", AvP.GameMode);
+ exit(EXIT_FAILURE);
+ }
+ break; /* TODO -- remove when loop works */
+ }
+
+// }
return 0;
}
diff --git a/src/stubs.c b/src/stubs.c
index f8e100d..08c3ea8 100644
--- a/src/stubs.c
+++ b/src/stubs.c
@@ -19,8 +19,7 @@
/* winmain.c */
BOOL KeepMainRifFile = FALSE;
-char LevelName[] = {"predbit6\0QuiteALongNameActually"};
-int HWAccel = 0;
+int HWAccel = 1;
/* win_func.cpp */
@@ -67,6 +66,11 @@ char* GetCustomMultiplayerLevelName(int index, int gameType)
return NULL;
}
+void BuildMultiplayerLevelNameArray()
+{
+ fprintf(stderr, "BuildMultiplayerLevelNameArray()\n");
+}
+
BOOL BuildLoadIPAddressMenu()
{
fprintf(stderr, "BuildLoadIPAddressMenu()\n");
@@ -97,9 +101,9 @@ void Start_Progress_Bar()
fprintf(stderr, "Start_Progress_Bar()\n");
}
-void Set_Progress_Bar_Position()
+void Set_Progress_Bar_Position(int pos)
{
- fprintf(stderr, "Set_Progress_Bar_Position()\n");
+ fprintf(stderr, "Set_Progress_Bar_Position(%d)\n", pos);
}
@@ -391,6 +395,14 @@ int NumberOfUserProfiles()
return 0;
}
+/* d3_func.cpp */
+int GetTextureHandle(IMAGEHEADER *imageHeaderPtr)
+{
+ fprintf(stderr, "GetTextureHandle(%p)\n", imageHeaderPtr);
+
+ return 1;
+}
+
/* d3d_render.cpp -- some of these got mixed in with d3_func.cpp! */
int NumberOfLandscapePolygons;
int FMVParticleColour;
@@ -496,13 +508,6 @@ void ReleaseD3DTexture(void* D3DTexture)
fprintf(stderr, "ReleaseD3DTexture(%p)\n", D3DTexture);
}
-int GetTextureHandle(IMAGEHEADER *imageHeaderPtr)
-{
- fprintf(stderr, "GetTextureHandle(%p)\n", imageHeaderPtr);
-
- return 0;
-}
-
void FlushD3DZBuffer()
{
fprintf(stderr, "FlushD3DZBuffer()\n");
@@ -713,10 +718,15 @@ void ReadJoysticks()
/* dx_proj.cpp */
-int use_mmx_math = 1;
+int use_mmx_math = 0;
/* cd_player.c */
+void CDDA_Start()
+{
+ fprintf(stderr, "CDDA_Start()\n");
+}
+
void CDDA_ChangeVolume(int volume)
{
fprintf(stderr, "CDDA_ChangeVolume(%d)\n", volume);
@@ -1027,135 +1037,3 @@ void AddNetMsg_SpotOtherSound(enum soundindex SoundIndex,VECTORCH *position,int
fprintf(stderr, "AddNetMsg_SpotOtherSound(%d, %p, %d)\n", SoundIndex, position, explosion);
}
-
-/* win32 api */
-size_t _mbclen(const unsigned char *s)
-{
- return strlen((const char *)s);
-}
-
-HANDLE CreateFile(const char *file, int write, int x, int y, int flags, int flags2, int z)
-{
- fprintf(stderr, "CreateFile(%s, %d, %d, %d, %d, %d, %d)\n", file, write, x, y, flags, flags2, z);
-
- return -1;
-}
-
-HANDLE CreateFileA(const char *file, int write, int x, int y, int flags, int flags2, int z)
-{
- return CreateFileA(file, write, x, y, flags, flags2, z);
-}
-
-int WriteFile(HANDLE file, const void *data, int len, /* unsigned long */ void *byteswritten, int x)
-{
- fprintf(stderr, "WriteFile(%d, %p, %d, %p, %d)\n", file, data, len, byteswritten, x);
-
- return -1;
-}
-
-int ReadFile(HANDLE file, void *data, int len, /* unsigned long */ void *bytesread, int x)
-{
- fprintf(stderr, "ReadFile(%d, %p, %d, %p, %d)\n", file, data, len, bytesread, x);
-
- return -1;
-}
-
-int GetFileSize(HANDLE file, int x)
-{
- fprintf(stderr, "GetFileSize(%d, %d)\n", file, x);
-
- return -1;
-}
-
-int CloseHandle(HANDLE file)
-{
- fprintf(stderr, "CloseHandle(%d)\n", file);
-
- return -1;
-}
-
-int DeleteFile(const char *file)
-{
- fprintf(stderr, "DeleteFile(%s)\n", file);
-
- return -1;
-}
-
-int DeleteFileA(const char *file)
-{
- return DeleteFile(file);
-}
-
-int GetDiskFreeSpace(int x, unsigned long *a, unsigned long *b, unsigned long *c, unsigned long *d)
-{
- fprintf(stderr, "GetDiskFreeSpace(%d, %p, %p, %p, %p)\n", x, a, b, c, d);
-
- return -1;
-}
-
-int CreateDirectory(char *dir, int x)
-{
- fprintf(stderr, "CreateDirectory(%s, %d)\n", dir, x);
-
- return -1;
-}
-
-int MoveFile(const char *newfile, const char *oldfile)
-{
- fprintf(stderr, "MoveFile(%s, %s)\n", newfile, oldfile);
-
- return -1;
-}
-
-int MoveFileA(const char *newfile, const char *oldfile)
-{
- return MoveFile(newfile, oldfile);
-}
-
-int CopyFile(const char *newfile, const char *oldfile, int x)
-{
- fprintf(stderr, "CopyFile(%s, %s, %d)\n", newfile, oldfile, x);
-
- return -1;
-}
-
-int GetFileAttributes(const char *file)
-{
- fprintf(stderr, "GetFileAttributes(%s)\n", file);
-
- return -1;
-}
-
-int GetFileAttributesA(const char *file)
-{
- return GetFileAttributes(file);
-}
-
-int SetFilePointer(HANDLE file, int x, int y, int z)
-{
- fprintf(stderr, "SetFilePointer(%d, %d, %d, %d)\n", file, x, y, z);
-
- return -1;
-}
-
-int SetEndOfFile(HANDLE file)
-{
- fprintf(stderr, "SetEndOfFile(%d)\n", file);
-
- return -1;
-}
-
-/* time in miliseconds */
-int timeGetTime()
-{
- fprintf(stderr, "timeGetTime()\n");
-
- return 0;
-}
-
-int GetTickCount()
-{
- fprintf(stderr, "GetTickCount()\n");
-
- return 0;
-}
diff --git a/src/win95/aw.h b/src/win95/aw.h
index a70be64..ed35da4 100644
--- a/src/win95/aw.h
+++ b/src/win95/aw.h
@@ -6,7 +6,12 @@ typedef struct AwBackupTexture * AW_BACKUPTEXTUREHANDLE;
typedef struct DIRECTDRAWSURFACE
{
- int x;
+ int id;
+
+ int w;
+ int h;
+ unsigned char *data;
+ int type;
} DIRECTDRAWSURFACE;
typedef DIRECTDRAWSURFACE * LPDIRECTDRAWSURFACE;
@@ -14,7 +19,12 @@ typedef DIRECTDRAWSURFACE DDSurface;
typedef struct DIRECT3DTEXTURE
{
- int x;
+ int id;
+
+ int w;
+ int h;
+ unsigned char *data;
+ int type;
} DIRECT3DTEXTURE;
typedef DIRECT3DTEXTURE * LPDIRECT3DTEXTURE;
diff --git a/src/win95/awtexld.cpp b/src/win95/awtexld.cpp
index aa5f568..0d3ab5b 100644
--- a/src/win95/awtexld.cpp
+++ b/src/win95/awtexld.cpp
@@ -381,7 +381,7 @@ namespace AwTl
AwTl::SurfUnion AwBackupTexture::Restore(AwTl::CreateTextureParms const & rParams)
{
using namespace AwTl;
-
+
ChoosePixelFormat(rParams);
if (!pixelFormat.validB)
@@ -510,11 +510,14 @@ void AwBackupTexture::ChoosePixelFormat(AwTl::CreateTextureParms const & _parmsR
AwTl::SurfUnion AwBackupTexture::CreateTexture(AwTl::CreateTextureParms const & _parmsR)
{
- fprintf(stderr, "AwBackupTexture::CreateTexture(...)\n");
+ using namespace AwTl;
+
+ fprintf(stderr, "AwBackupTexture::CreateTexture(...) This is where we could convert the image to RGB/RGBA, and so on\n");
- return static_cast<D3DTexture *>(NULL);
+ SurfUnion pRet = static_cast<D3DTexture *>(new D3DTexture);
+
+ return pRet;
#if 0
- using namespace AwTl;
// which flags to use?
unsigned fMyFlags =
@@ -1390,7 +1393,8 @@ namespace AwTl {
// CHECK_MEDIA_ERRORS("loading file headers")
ON_ERROR_RETURN_NULL("loading file headers")
-
+
+#if 0
ChoosePixelFormat(rParams);
if (!pixelFormat.validB)
@@ -1401,7 +1405,12 @@ namespace AwTl {
awTlLastErr = pixelFormat.validB && driverDesc.ddP && (driverDesc.validB || !rParams.loadTextureB) ? AW_TLE_OK : AW_TLE_NOINIT;
ON_ERROR_RETURN_NULL("initializing load")
-
+#endif
+ fprintf(stderr, "TexFileLoader::Load Pixel Format?! It's not implemented!\n");
+
+/* TODO */
+ AllocateBuffers(/* rParams.backupHP ? true : */ false, /* pixelFormat.palettizedB ? ? 1<<pixelFormat.bitsPerPixel : */ 0);
+
// CHECK_MEDIA_ERRORS("allocating buffers")
ON_ERROR_RETURN_NULL("allocating buffers")
@@ -2079,6 +2088,7 @@ D3DTexture * _AWTL_VARARG AwCreateTexture(char const * _argFormatS, ...)
parms.loadTextureB = true;
bool bParmsOK = ParseParams(&parms, _argFormatS, ap);
va_end(ap);
+
return bParmsOK ? LoadFromParams(&parms).textureP : NULL;
}
diff --git a/src/win95/db.c b/src/win95/db.c
index e3ee6d4..13fc187 100644
--- a/src/win95/db.c
+++ b/src/win95/db.c
@@ -79,7 +79,7 @@ int db_option = 0; /* Default is off. */
#define PROP_WIDTH 0
/* Logfile name */
-#define LOGFILE_NAME "LOGFILE.TXT"
+#define LOGFILE_NAME "logfile.txt"
/* Set this to 1 if the logfile name is an absolute path. Otherwise the
* logfile will go in the directory that is current when db_log_init()
@@ -405,7 +405,8 @@ void db_log_init(void)
sprintf( LogFileNameP, "%s", db_log_file_name );
#else
/* Append the log file name to the current working directory. */
- sprintf( LogFileNameP, "%s\\%s", getcwd( LogFileNameP, 240 ),
+/* TODO - path seperator */
+ sprintf( LogFileNameP, "%s/%s", getcwd( LogFileNameP, 240 ),
db_log_file_name );
#endif
diff --git a/src/winapi.c b/src/winapi.c
new file mode 100644
index 0000000..6719293
--- /dev/null
+++ b/src/winapi.c
@@ -0,0 +1,197 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "fixer.h"
+
+void FixFilename(char *str)
+{
+ int len = strlen(str);
+ int i;
+
+ for (i = 0; i < len; i++) {
+ if (str[i] == '\\')
+ str[i] = '/';
+ else if (str[i] == '\r')
+ str[i] = 0;
+ else if (str[i] == '\n')
+ str[i] = 0;
+ else
+ str[i] = tolower(str[i]);
+ }
+}
+
+size_t _mbclen(const unsigned char *s)
+{
+ return strlen((const char *)s);
+}
+
+HANDLE CreateFile(const char *file, int mode, int x, int y, int flags, int flags2, int z)
+{
+ int fd;
+
+ fprintf(stderr, "CreateFile(%s, %d, %d, %d, %d, %d, %d)\n", file, mode, x, y, flags, flags2, z);
+
+ switch(mode) {
+ case GENERIC_READ:
+ if (flags != OPEN_EXISTING) {
+ fprintf(stderr, "CreateFile: GENERIC_READ flags = %d\n", flags);
+ exit(EXIT_FAILURE);
+ }
+ fd = open(file, O_RDONLY);
+ if (fd == -1)
+ return -1;
+ break;
+ case GENERIC_WRITE:
+// break;
+ case GENERIC_READ|GENERIC_WRITE:
+// break;
+ default:
+ fprintf(stderr, "CreateFile: unknown mode %d\n", mode);
+ exit(EXIT_FAILURE);
+ }
+
+ return (HANDLE)fd;
+}
+
+HANDLE CreateFileA(const char *file, int write, int x, int y, int flags, int flags2, int z)
+{
+ return CreateFile(file, write, x, y, flags, flags2, z);
+}
+
+int WriteFile(HANDLE file, const void *data, int len, /* unsigned long */ void *byteswritten, int x)
+{
+ unsigned long *bw;
+
+ fprintf(stderr, "WriteFile(%d, %p, %d, %p, %d)\n", file, data, len, byteswritten, x);
+
+ bw = (unsigned long *)byteswritten;
+
+ *bw = write(file, data, len);
+
+ return 0;
+}
+
+int ReadFile(HANDLE file, void *data, int len, /* unsigned long */ void *bytesread, int x)
+{
+ unsigned long *br;
+
+ fprintf(stderr, "ReadFile(%d, %p, %d, %p, %d)\n", file, data, len, bytesread, x);
+
+ br = (unsigned long *)bytesread;
+
+ *br = read(file, data, len);
+
+ return 1; /* TODO: what is the correct return value? */
+}
+
+int GetFileSize(HANDLE file, int x)
+{
+ struct stat buf;
+
+ fprintf(stderr, "GetFileSize(%d, %d)\n", file, x);
+
+ if (fstat(file, &buf) == -1)
+ return -1;
+ return buf.st_size;
+}
+
+int CloseHandle(HANDLE file)
+{
+ fprintf(stderr, "CloseHandle(%d)\n", file);
+
+ close(file);
+
+ return 0;
+}
+
+int DeleteFile(const char *file)
+{
+ fprintf(stderr, "DeleteFile(%s)\n", file);
+
+ return -1;
+}
+
+int DeleteFileA(const char *file)
+{
+ return DeleteFile(file);
+}
+
+int GetDiskFreeSpace(int x, unsigned long *a, unsigned long *b, unsigned long *c, unsigned long *d)
+{
+ fprintf(stderr, "GetDiskFreeSpace(%d, %p, %p, %p, %p)\n", x, a, b, c, d);
+
+ return -1;
+}
+
+int CreateDirectory(char *dir, int x)
+{
+ fprintf(stderr, "CreateDirectory(%s, %d)\n", dir, x);
+
+ return -1;
+}
+
+int MoveFile(const char *newfile, const char *oldfile)
+{
+ fprintf(stderr, "MoveFile(%s, %s)\n", newfile, oldfile);
+
+ return -1;
+}
+
+int MoveFileA(const char *newfile, const char *oldfile)
+{
+ return MoveFile(newfile, oldfile);
+}
+
+int CopyFile(const char *newfile, const char *oldfile, int x)
+{
+ fprintf(stderr, "CopyFile(%s, %s, %d)\n", newfile, oldfile, x);
+
+ return -1;
+}
+
+int GetFileAttributes(const char *file)
+{
+ fprintf(stderr, "GetFileAttributes(%s)\n", file);
+
+ return -1;
+}
+
+int GetFileAttributesA(const char *file)
+{
+ return GetFileAttributes(file);
+}
+
+int SetFilePointer(HANDLE file, int x, int y, int z)
+{
+ fprintf(stderr, "SetFilePointer(%d, %d, %d, %d)\n", file, x, y, z);
+
+ return -1;
+}
+
+int SetEndOfFile(HANDLE file)
+{
+ fprintf(stderr, "SetEndOfFile(%d)\n", file);
+
+ return -1;
+}
+
+/* time in miliseconds */
+int timeGetTime()
+{
+ fprintf(stderr, "timeGetTime()\n");
+
+ return 0;
+}
+
+int GetTickCount()
+{
+ fprintf(stderr, "GetTickCount()\n");
+
+ return 0;
+}