23 Jul 2007

This commit is contained in:
g-cont 2007-07-23 00:00:00 +04:00 committed by Alibek Omarov
parent 72bfd12fca
commit 5662596670
19 changed files with 381 additions and 919 deletions

View File

@ -1,3 +1,13 @@
сохранялки, вида:
1. autosave (единственное отличие от обычной - делается движком при переходе на след. уровень)
2. обычная - сохраняется в слот (кол-во слотов не ограничено)
3. quick - сохранение-загрузка через F6\F7
выглядят след. образом:
save/quick.bin - имя быстрой сохранялки
save/dm_qstyle-22.07.07(23.51).bin - имя обычной сохранялки
Xash Studio:
1.Мессага анимации Viewmodel OK
@ -23,7 +33,8 @@ engine.dll
1. Добавить dedicated режим OK
2. Переписать cvar system
3. Пофиксить сохранялки
4. Создать lump-структуру для save-файла
4. Создать lump-структуру для save-файла OK
5. Организовать структуру для save-файлов
launcher.dll
1. Сделать read-only консоли OK
@ -56,7 +67,7 @@ platform.dll
+исправлен баг в коде bloom
+пофикшен баг с загрузкой процессора на 100% при системной ошибке
+добавлена новая функция файловой системы - поиск только директорий
+добавлена команда debug для studiomdl. В этом режеиме большинство ошибок заменяются на предупреждения
+добавлена команда debug для studiomdl. В этом режиме большинство ошибок заменяются на предупреждения
+studiomdl пропускает анимацию, если для нее не указан smd-файл (вместо остановки компиляции)
+studiomdl больше не обязательно прописывать actweight в анимации (по умолчанию равен 1)
+spritegen проапгрейжен до версии 0.2

View File

@ -6,38 +6,6 @@
--------------------Configuration: editor - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\Temp\RSP550.tmp" with contents
[
/nologo /MTd /W3 /Gm /Gi /GX /ZI /Od /I "../public" /I "../platform/formats" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\editor\!debug/" /Fo"..\temp\editor\!debug/" /Fd"..\temp\editor\!debug/" /FD /GZ /c
"D:\XASH3D\src_main\!source\editor\editor.c"
"D:\XASH3D\src_main\!source\editor\guiutils.c"
"D:\XASH3D\src_main\!source\editor\guiforms.c"
]
Creating command line "cl.exe @C:\Temp\RSP550.tmp"
Creating temporary file "C:\Temp\RSP551.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib /nologo /dll /incremental:yes /pdb:"..\temp\editor\!debug/editor.pdb" /debug /machine:I386 /out:"..\temp\editor\!debug/editor.dll" /implib:"..\temp\editor\!debug/editor.lib" /pdbtype:sept
"\XASH3D\src_main\!source\temp\editor\!debug\editor.obj"
"\XASH3D\src_main\!source\temp\editor\!debug\guiutils.obj"
"\XASH3D\src_main\!source\temp\editor\!debug\guiforms.obj"
"\XASH3D\src_main\!source\temp\editor\!debug\editor.res"
]
Creating command line "link.exe @C:\Temp\RSP551.tmp"
Creating temporary file "C:\Temp\RSP552.bat" with contents
[
@echo off
copy \XASH3D\src_main\!source\temp\editor\!debug\editor.dll "D:\Xash3D\bin\editor.dll"
]
Creating command line "C:\Temp\RSP552.bat"
Compiling...
editor.c
guiutils.c
guiforms.c
Generating Code...
Linking...
<h3>Output Window</h3>
Performing Custom Build Step on \XASH3D\src_main\!source\temp\editor\!debug\editor.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.

View File

@ -2022,13 +2022,13 @@ bool m_savevalid[MAX_SAVEGAMES];
void Create_Savestrings (void)
{
int i;
file_t *f;
char name[MAX_SYSPATH];
file_t *f;
char name[MAX_SYSPATH];
search_t *t = FS_Search( "save/*.bin" );
for (i=0 ; i<MAX_SAVEGAMES ; i++)
for (i = 0; i < t->numfilenames; i++)
{
Com_sprintf (name, sizeof(name), "save/save%i/server.ssv", i);
f = FS_Open (name, "rb");
f = FS_Open (t->filenames[i], "rb");
if (!f)
{
strcpy (m_savestrings[i], "<EMPTY>");
@ -2064,10 +2064,10 @@ void LoadGame_MenuInit( void )
for ( i = 0; i < MAX_SAVEGAMES; i++ )
{
s_loadgame_actions[i].generic.name = m_savestrings[i];
s_loadgame_actions[i].generic.flags = QMF_LEFT_JUSTIFY;
s_loadgame_actions[i].generic.localdata[0] = i;
s_loadgame_actions[i].generic.callback = LoadGameCallback;
s_loadgame_actions[i].generic.name = m_savestrings[i];
s_loadgame_actions[i].generic.flags = QMF_LEFT_JUSTIFY;
s_loadgame_actions[i].generic.localdata[0] = i;
s_loadgame_actions[i].generic.callback = LoadGameCallback;
s_loadgame_actions[i].generic.x = 0;
s_loadgame_actions[i].generic.y = ( i ) * 10;

View File

@ -55,6 +55,8 @@ memory manager
#define Mem_FreePool(pool) pi->Mem.FreePool(pool, __FILE__, __LINE__)
#define Mem_EmptyPool(pool) pi->Mem.EmptyPool(pool, __FILE__, __LINE__)
#define Mem_Copy(dest, src, size) pi->Mem.Copy(dest, src, size, __FILE__, __LINE__)
/*
===========================================
filesystem manager

View File

@ -6,59 +6,13 @@
--------------------Configuration: engine - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\Temp\RSP588.tmp" with contents
Creating temporary file "C:\Temp\RSPCBC.tmp" with contents
[
/nologo /MTd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "prvm" /I "common" /I "server" /I "client" /I "../public" /I "../platform/formats" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\engine\!debug/" /Fo"..\temp\engine\!debug/" /Fd"..\temp\engine\!debug/" /FD /c
"D:\XASH3D\src_main\!source\engine\cd_win.c"
"D:\XASH3D\src_main\!source\engine\client\cl_cin.c"
"D:\XASH3D\src_main\!source\engine\client\cl_ents.c"
"D:\XASH3D\src_main\!source\engine\client\cl_fx.c"
"D:\XASH3D\src_main\!source\engine\client\cl_input.c"
"D:\XASH3D\src_main\!source\engine\client\cl_inv.c"
"D:\XASH3D\src_main\!source\engine\client\cl_main.c"
"D:\XASH3D\src_main\!source\engine\client\cl_newfx.c"
"D:\XASH3D\src_main\!source\engine\client\cl_parse.c"
"D:\XASH3D\src_main\!source\engine\client\cl_pred.c"
"D:\XASH3D\src_main\!source\engine\client\cl_scrn.c"
"D:\XASH3D\src_main\!source\engine\client\cl_tent.c"
"D:\XASH3D\src_main\!source\engine\client\cl_view.c"
"D:\XASH3D\src_main\!source\engine\common\cmd.c"
"D:\XASH3D\src_main\!source\engine\common\cmodel.c"
"D:\XASH3D\src_main\!source\engine\common\common.c"
"D:\XASH3D\src_main\!source\engine\common\console.c"
"D:\XASH3D\src_main\!source\engine\common\crc.c"
"D:\XASH3D\src_main\!source\engine\common\cvar.c"
"D:\XASH3D\src_main\!source\engine\host.c"
"D:\XASH3D\src_main\!source\engine\in_win.c"
"D:\XASH3D\src_main\!source\engine\common\keys.c"
"D:\XASH3D\src_main\!source\server\m_flash.c"
"D:\XASH3D\src_main\!source\engine\common\md4.c"
"D:\XASH3D\src_main\!source\engine\common\menu.c"
"D:\XASH3D\src_main\!source\engine\common\net_chan.c"
"D:\XASH3D\src_main\!source\engine\net_wins.c"
"D:\XASH3D\src_main\!source\engine\common\pmove.c"
"D:\XASH3D\src_main\!source\engine\common\q_shared.c"
"D:\XASH3D\src_main\!source\engine\common\qmenu.c"
"D:\XASH3D\src_main\!source\engine\snd_dma.c"
"D:\XASH3D\src_main\!source\engine\snd_mem.c"
"D:\XASH3D\src_main\!source\engine\snd_mix.c"
"D:\XASH3D\src_main\!source\engine\snd_win.c"
"D:\XASH3D\src_main\!source\engine\server\sv_ccmds.c"
"D:\XASH3D\src_main\!source\engine\server\sv_ents.c"
"D:\XASH3D\src_main\!source\engine\server\sv_game.c"
"D:\XASH3D\src_main\!source\engine\server\sv_init.c"
"D:\XASH3D\src_main\!source\engine\server\sv_main.c"
"D:\XASH3D\src_main\!source\engine\server\sv_save.c"
"D:\XASH3D\src_main\!source\engine\server\sv_send.c"
"D:\XASH3D\src_main\!source\engine\server\sv_studio.c"
"D:\XASH3D\src_main\!source\engine\server\sv_user.c"
"D:\XASH3D\src_main\!source\engine\server\sv_world.c"
"D:\XASH3D\src_main\!source\engine\system.c"
"D:\XASH3D\src_main\!source\engine\vid_dll.c"
"D:\XASH3D\src_main\!source\engine\vid_menu.c"
]
Creating command line "cl.exe @C:\Temp\RSP588.tmp"
Creating temporary file "C:\Temp\RSP589.tmp" with contents
Creating command line "cl.exe @C:\Temp\RSPCBC.tmp"
Creating temporary file "C:\Temp\RSPCBD.tmp" with contents
[
winmm.lib wsock32.lib kernel32.lib user32.lib gdi32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\engine\!debug/engine.pdb" /debug /machine:I386 /out:"..\temp\engine\!debug/engine.dll" /implib:"..\temp\engine\!debug/engine.lib" /pdbtype:sept
"\XASH3D\src_main\!source\temp\engine\!debug\cd_win.obj"
@ -109,69 +63,16 @@ winmm.lib wsock32.lib kernel32.lib user32.lib gdi32.lib /nologo /subsystem:windo
"\XASH3D\src_main\!source\temp\engine\!debug\vid_dll.obj"
"\XASH3D\src_main\!source\temp\engine\!debug\vid_menu.obj"
]
Creating command line "link.exe @C:\Temp\RSP589.tmp"
Creating temporary file "C:\Temp\RSP58A.bat" with contents
Creating command line "link.exe @C:\Temp\RSPCBD.tmp"
Creating temporary file "C:\Temp\RSPCBE.bat" with contents
[
@echo off
copy \XASH3D\src_main\!source\temp\engine\!debug\engine.dll "D:\Xash3D\bin\engine.dll"
]
Creating command line "C:\Temp\RSP58A.bat"
Creating command line "C:\Temp\RSPCBE.bat"
Compiling...
cd_win.c
cl_cin.c
cl_ents.c
cl_fx.c
cl_input.c
cl_inv.c
cl_main.c
cl_newfx.c
cl_parse.c
cl_pred.c
cl_scrn.c
cl_tent.c
cl_view.c
cmd.c
cmodel.c
common.c
console.c
crc.c
cvar.c
host.c
Generating Code...
Compiling...
in_win.c
keys.c
m_flash.c
md4.c
menu.c
net_chan.c
net_wins.c
pmove.c
q_shared.c
qmenu.c
snd_dma.c
snd_mem.c
snd_mix.c
snd_win.c
sv_ccmds.c
d:\xash3d\src_main\!source\engine\server\sv_ccmds.c(166) : warning C4013: 'SV_CurTime' undefined; assuming extern returning int
sv_ents.c
sv_game.c
sv_init.c
sv_main.c
sv_save.c
Generating Code...
Compiling...
sv_send.c
sv_studio.c
sv_user.c
sv_world.c
system.c
vid_dll.c
vid_menu.c
Generating Code...
Linking...
Creating library ..\temp\engine\!debug/engine.lib and object ..\temp\engine\!debug/engine.exp
<h3>Output Window</h3>
Performing Custom Build Step on \XASH3D\src_main\!source\temp\engine\!debug\engine.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
@ -179,7 +80,7 @@ Performing Custom Build Step on \XASH3D\src_main\!source\temp\engine\!debug\engi
<h3>Results</h3>
engine.dll - 0 error(s), 1 warning(s)
engine.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -155,20 +155,21 @@ typedef struct
typedef struct
{
bool initialized; // sv_init has completed
int realtime; // always increasing, no clamping, etc
bool initialized; // sv_init has completed
int realtime; // always increasing, no clamping, etc
char mapcmd[MAX_TOKEN_CHARS]; // ie: *intro.cin+base
char comment[MAX_TOKEN_CHARS]; // map name, e.t.c.
int spawncount; // incremented each server start
int spawncount; // incremented each server start
// used to check late spawns
client_t *clients; // [maxclients->value];
int num_client_entities; // maxclients->value*UPDATE_BACKUP*MAX_PACKET_ENTITIES
int next_client_entities; // next client_entity to use
client_t *clients; // [maxclients->value];
int num_client_entities; // maxclients->value*UPDATE_BACKUP*MAX_PACKET_ENTITIES
int next_client_entities; // next client_entity to use
entity_state_t *client_entities; // [num_client_entities]
int last_heartbeat;
int last_heartbeat;
challenge_t challenges[MAX_CHALLENGES]; // to prevent invalid IPs from connecting
@ -264,7 +265,7 @@ void SV_ExecuteClientMessage (client_t *cl);
//
// sv_ccmds.c
//
void SV_ReadLevelFile (void);
void SV_ReadLevelFile ( int mode );
void SV_Status_f (void);
//

View File

@ -147,55 +147,6 @@ SAVEGAME FILES
===============================================================================
*/
/*
==============
SV_WriteLevelFile
mode: 0 - regular save, 1 - autosave, 2 - quicksave
==============
*/
char* LF( int mode )
{
static char path[MAX_SYSPATH];
switch(mode)
{
case REGULAR:
Com_sprintf (path, sizeof(path), "save/%s/%s.bin", sv.name, SV_CurTime());
break;
case AUTOSAVE:
Com_sprintf (path, sizeof(path), "save/%s/auto.bin", sv.name );
break;
case QUICK:
Com_sprintf (path, sizeof(path), "save/quick.bin" );
break;
}
return path;
}
char* SF( int mode )
{
static char path[MAX_SYSPATH];
switch(mode)
{
case REGULAR:
Com_sprintf (path, sizeof(path), "save/%s/%s.sav", sv.name, SV_CurTime());
break;
case AUTOSAVE:
Com_sprintf (path, sizeof(path), "save/%s/auto.sav", sv.name );
break;
case QUICK:
Com_sprintf (path, sizeof(path), "save/quick.sav" );
break;
}
return path;
}
/*
==============
SV_WriteLevelFile
@ -204,190 +155,8 @@ SV_WriteLevelFile
*/
void SV_WriteLevelFile (void)
{
char name[MAX_OSPATH];
file_t *f;
Com_DPrintf("SV_WriteLevelFile()\n");
f = FS_Open(LF( QUICK ), "wb");
if (!f)
{
Com_Printf ("Failed to open %s\n", name);
return;
}
Msg("wirte configstrings pos %d\n", FS_Tell(f));
FS_Write (f, sv.configstrings, sizeof(sv.configstrings));
Msg("wirte portalstate pos %d\n", FS_Tell(f));
CM_WritePortalState (f);
Msg("wirte level pos %d\n", FS_Tell(f));
ge->WriteLevel(f);
FS_Close (f);
}
/*
==============
SV_ReadLevelFile
==============
*/
void SV_ReadLevelFile (void)
{
char name[MAX_OSPATH];
file_t *f;
Com_DPrintf("SV_ReadLevelFile()\n");
f = FS_Open(LF( QUICK ), "rb");
if (!f)
{
Com_Printf ("Failed to open %s\n", name);
return;
}
Msg("read configstrings pos %d\n", FS_Tell(f));
FS_Read (f, sv.configstrings, sizeof(sv.configstrings));
Msg("read portalstate pos %d\n", FS_Tell(f));
CM_ReadPortalState (f);
Msg("read level pos %d\n", FS_Tell(f));
ge->ReadLevel(f);
FS_Close (f);
}
/*
==============
SV_WriteServerFile
==============
*/
void SV_WriteServerFile (bool autosave)
{
file_t *f;
cvar_t *var;
char name[MAX_OSPATH], string[128];
char comment[32];
time_t aclock;
struct tm *newtime;
int mode;
Com_DPrintf("SV_WriteServerFile(%s)\n", autosave ? "true" : "false");
if(autosave)mode = AUTOSAVE;
else mode = QUICK;
f = FS_Open (SF(mode), "wb");
if (!f)
{
Com_Printf ("Couldn't write %s\n", name);
return;
}
// write the comment field
memset (comment, 0, sizeof(comment));
if (!autosave)
{
time (&aclock);
newtime = localtime (&aclock);
Com_sprintf (comment, sizeof(comment), "%s", SV_CurTime());
strncat (comment, sv.configstrings[CS_NAME], sizeof(comment)-1-strlen(comment) );
}
else
{ // autosaved
Com_sprintf (comment, sizeof(comment), "ENTERING %s", sv.configstrings[CS_NAME]);
}
FS_Write (f, comment, sizeof(comment));
// write the mapcmd
FS_Write (f, svs.mapcmd, sizeof(svs.mapcmd));
// write all CVAR_LATCH cvars
// these will be things like coop, skill, deathmatch, etc
for (var = cvar_vars; var; var = var->next)
{
if (!(var->flags & CVAR_LATCH))
continue;
if (strlen(var->name) >= sizeof(name)-1 || strlen(var->string) >= sizeof(string)-1)
{
Com_Printf ("Cvar too long: %s = %s\n", var->name, var->string);
continue;
}
memset (name, 0, sizeof(name));
memset (string, 0, sizeof(string));
strcpy (name, var->name);
strcpy (string, var->string);
FS_Write (f, name, sizeof(name));
FS_Write (f, string, sizeof(string));
}
FS_Write(f, "§", 1 );//end of cvars
ge->WriteGame (f, autosave);
FS_Close (f);
}
/*
==============
SV_ReadServerFile
==============
*/
void SV_ReadServerFile (void)
{
file_t *f;
char name[MAX_OSPATH], string[128];
char comment[32];
char mapcmd[MAX_TOKEN_CHARS];
Com_DPrintf("SV_ReadServerFile()\n");
f = FS_Open (SF(QUICK), "rb");
if (!f)
{
Com_Printf ("Couldn't read %s\n", name);
return;
}
// read the comment field
FS_Read (f, comment, sizeof(comment));
// read the mapcmd
FS_Read (f, mapcmd, sizeof(mapcmd));
// read all CVAR_LATCH cvars
// these will be things like coop, skill, deathmatch, etc
while (1)
{
if (!FS_Read (f, name, sizeof(name)))
break;
if(name[0] == '§')
{
int curpos = FS_Tell(f);
curpos -= sizeof(name);
curpos++;//skip § character
FS_Seek(f, curpos, SEEK_SET);
break;
}
FS_Read (f, string, sizeof(string));
Com_DPrintf ("Set %s = %s\n", name, string);
Cvar_ForceSet (name, string);
}
// start a new game fresh with new cvars
SV_InitGame ();
strcpy (svs.mapcmd, mapcmd);
ge->ReadGame (f);
FS_Close (f);
}
//=========================================================
/*
==================
SV_DemoMap_f
@ -444,7 +213,7 @@ void SV_GameMap_f (void)
// when the level is re-entered, the clients will spawn
// at spawn points instead of occupying body shells
savedInuse = Z_Malloc(maxclients->value * sizeof(bool));
for (i=0,cl=svs.clients ; i<maxclients->value; i++,cl++)
for (i = 0, cl = svs.clients; i < maxclients->value; i++, cl++)
{
savedInuse[i] = cl->edict->inuse;
cl->edict->inuse = false;
@ -453,7 +222,7 @@ void SV_GameMap_f (void)
SV_WriteLevelFile ();
// we must restore these for clients to transfer over correctly
for (i=0,cl=svs.clients ; i<maxclients->value; i++,cl++)
for (i = 0, cl = svs.clients; i < maxclients->value; i++, cl++)
cl->edict->inuse = savedInuse[i];
Z_Free (savedInuse);
}
@ -528,7 +297,7 @@ void SV_Loadgame_f (void)
Com_Printf ("Bad savedir.\n");
}
SV_ReadServerFile ();
SV_ReadSaveFile( REGULAR ); //TEST
// go to the map
sv.state = ss_dead; // don't save current level when changing
@ -583,17 +352,12 @@ void SV_Savegame_f (void)
Com_Printf ("Bad savedir.\n");
}
Com_Printf ("Saving game...\n");
Com_Printf ("Saving game... %s\n", Cmd_Argv(1));
// archive current level, including all client edicts.
// when the level is reloaded, they will be shells awaiting
// a connecting client
SV_WriteLevelFile ();
// save server state
SV_WriteServerFile (false);
//SV_WriteSaveFile( AUTOSAVE );//TEST
SV_WriteSaveFile( REGULAR );//TEST
Com_Printf ("Done.\n");
}
@ -621,8 +385,7 @@ void SV_Kick_f (void)
return;
}
if (!SV_SetPlayer ())
return;
if (!SV_SetPlayer ()) return;
SV_BroadcastPrintf (PRINT_HIGH, "%s was kicked\n", sv_client->name);
// print directly, because the dropped client won't get the
@ -653,10 +416,9 @@ void SV_Status_f (void)
Com_Printf ("num score ping name lastmsg address qport \n");
Com_Printf ("--- ----- ---- --------------- ------- --------------------- ------\n");
for (i=0,cl=svs.clients ; i<maxclients->value; i++,cl++)
for (i = 0, cl = svs.clients; i < maxclients->value; i++, cl++)
{
if (!cl->state)
continue;
if (!cl->state) continue;
Com_Printf ("%3i ", i);
Com_Printf ("%5i ", cl->edict->client->ps.stats[STAT_FRAGS]);

View File

@ -117,21 +117,18 @@ SV_CheckForSavegame
*/
void SV_CheckForSavegame (void)
{
file_t *f;
int i;
if (sv_noreload->value) return;
if (Cvar_VariableValue ("deathmatch")) return;
f = FS_Open ("save/quick.bin", "rb");
if (!f) return; // no savegame
FS_Close (f);
if(!FS_FileExists("save/quick.bin")) return;
SV_ClearWorld ();
// get configstrings and areaportals
SV_ReadLevelFile ();
SV_ReadLevelFile ( REGULAR );
if (!sv.loadgame)
{ // coming back to a level after being in a different
@ -143,9 +140,8 @@ void SV_CheckForSavegame (void)
server_state_t previousState; // PGM
previousState = sv.state; // PGM
sv.state = ss_loading; // PGM
for (i=0 ; i<100 ; i++)
ge->RunFrame ();
sv.state = ss_loading; // PGM
for (i = 0; i < 100; i++) ge->RunFrame ();
sv.state = previousState; // PGM
}

View File

@ -8,8 +8,6 @@
#include "server.h"
#include "savefile.h"
dsavehdr_t *header;
/*
====================
CurTime()
@ -33,17 +31,17 @@ const char* SV_CurTime( void )
return timestamp;
}
void SV_AddSaveLump( file_t *f, int lumpnum, void *data, int len )
void SV_AddSaveLump( dsavehdr_t *hdr, file_t *f, int lumpnum, void *data, int len )
{
lump_t *lump;
lump = &header->lumps[lumpnum];
lump = &hdr->lumps[lumpnum];
lump->fileofs = LittleLong( FS_Tell(f));
lump->filelen = LittleLong(len);
FS_Write(f, data, (len + 3) & ~3 );
}
void SV_AddCvarLump( file_t *f )
void SV_AddCvarLump( dsavehdr_t *hdr, file_t *f )
{
cvar_t *var;
int numsavedcvars = 0;
@ -79,10 +77,12 @@ void SV_AddCvarLump( file_t *f )
Msg("numcvars %d\n", numsavedcvars );
SV_AddSaveLump( f, LUMP_GAMECVARS, dout, numsavedcvars * sizeof(dsavecvar_t));
SV_AddSaveLump( hdr, f, LUMP_GAMECVARS, dout, numsavedcvars * sizeof(dsavecvar_t));
Z_Free( dout );
}
byte *sav_base;
/*
=============
SV_WriteSaveFile
@ -91,10 +91,10 @@ SV_WriteSaveFile
void SV_WriteSaveFile( int mode )
{
char path[MAX_SYSPATH];
char comment[32];
file_t *savfile;
char path[MAX_SYSPATH];
char comment[32];
dsavehdr_t *header;
file_t *savfile;
switch( mode )
{
@ -103,13 +103,12 @@ void SV_WriteSaveFile( int mode )
sprintf (comment, "Quick save %s", sv.configstrings[CS_NAME]);
break;
case AUTOSAVE:
sprintf (path, "save/%s/auto.bin", sv.name );
sprintf (path, "save/auto.bin" );
sprintf (comment, "Autosave %s", sv.configstrings[CS_NAME]);
break;
case REGULAR:
sprintf (path, "save/%s/%s.bin", sv.name, SV_CurTime());
strlcpy (comment, SV_CurTime(), sizeof(comment));
strlcat (comment, sv.configstrings[CS_NAME], sizeof(comment) - 1 - strlen(comment));
sprintf (path, "save/%s.bin", SV_CurTime());
sprintf (comment, "%s - %s", sv.configstrings[CS_NAME], SV_CurTime());
break;
}
@ -119,23 +118,20 @@ void SV_WriteSaveFile( int mode )
MsgDev ("Failed to open %s\n", path );
return;
}
MsgDev("SV_WriteLevelFile()\n");
header = (dsavehdr_t *)Z_Malloc( sizeof(dsavehdr_t));
header->ident = LittleLong (IDSAVEHEADER);
header->version = LittleLong (SAVE_VERSION);
FS_Write( savfile, header, sizeof(dsavehdr_t));
//write lumps
SV_AddSaveLump( savfile, LUMP_COMMENTS, comment, sizeof(comment));
SV_AddSaveLump( savfile, LUMP_MAPCMDS, svs.mapcmd, sizeof(svs.mapcmd));
SV_AddSaveLump( savfile, LUMP_CFGSTRING, sv.configstrings, sizeof(sv.configstrings));
SV_AddCvarLump( savfile );
SV_AddSaveLump( savfile, LUMP_AREASTATE, portalopen, sizeof(portalopen));
//ge->WriteLump (f, LUMP_GAMELOCAL);
//ge->WriteLump (f, LUMP_ENTSSTATE);
//ge->WriteLump (f, LUMP_GAMETRANS);
SV_AddSaveLump( header, savfile, LUMP_COMMENTS, comment, sizeof(comment));
SV_AddSaveLump( header, savfile, LUMP_CFGSTRING, sv.configstrings, sizeof(sv.configstrings));
SV_AddSaveLump( header, savfile, LUMP_AREASTATE, portalopen, sizeof(portalopen));
ge->WriteLump ( header, savfile, LUMP_GAMELEVEL);
SV_AddSaveLump( header, savfile, LUMP_MAPCMDS, svs.mapcmd, sizeof(svs.mapcmd));
SV_AddCvarLump( header, savfile );
ge->WriteLump ( header, savfile, LUMP_GAMELOCAL );
//merge header
FS_Seek( savfile, 0, SEEK_SET );
@ -143,4 +139,168 @@ void SV_WriteSaveFile( int mode )
FS_Close( savfile );
Z_Free( header );
}
void Sav_LoadComment( lump_t *l )
{
byte *in;
int size;
in = (void *)(sav_base + l->fileofs);
if (l->filelen % sizeof(*in)) Com_Error (ERR_DROP, "Sav_LoadComment: funny lump size\n" );
size = l->filelen / sizeof(*in);
strlcpy(svs.comment, in, size );
}
void Sav_LoadCvars( lump_t *l )
{
char name[64], string[64];
int size, curpos = 0;
byte *in;
in = (void *)(sav_base + l->fileofs);
if (l->filelen % sizeof(*in)) Com_Error (ERR_DROP, "Sav_LoadCvars: funny lump size\n" );
size = l->filelen / sizeof(*in);
while(curpos < size)
{
strlcpy( name, in + curpos, MAX_OSPATH ); curpos += 64;
strlcpy( string, in + curpos, 128 ); curpos += 64;
Cvar_ForceSet (name, string);
}
}
void Sav_LoadMapCmds( lump_t *l )
{
byte *in;
int size;
in = (void *)(sav_base + l->fileofs);
if (l->filelen % sizeof(*in)) Com_Error (ERR_DROP, "Sav_LoadMapCmds: funny lump size\n" );
size = l->filelen / sizeof(*in);
strncpy (svs.mapcmd, in, size );
}
void Sav_LoadCfgString( lump_t *l )
{
char *in;
int size;
in = (void *)(sav_base + l->fileofs);
if (l->filelen % sizeof(*in)) Com_Error (ERR_DROP, "Sav_LoadCfgString: funny lump size\n" );
size = l->filelen / sizeof(*in);
strlcpy((char *)sv.configstrings, in, size );
}
void Sav_LoadAreaPortals( lump_t *l )
{
//CM_ReadPortalState
byte *in;
int size;
in = (void *)(sav_base + l->fileofs);
if (l->filelen % sizeof(*in)) Com_Error (ERR_DROP, "Sav_LoadAreaPortals: funny lump size\n" );
size = l->filelen / sizeof(*in);
Mem_Copy(portalopen, in, size);
}
/*
=============
SV_ReadSaveFile
=============
*/
void SV_ReadSaveFile( int mode )
{
char path[MAX_SYSPATH];
dsavehdr_t *header;
byte *savfile;
int i, id, size;
switch( mode )
{
case QUICK:
sprintf (path, "save/quick.bin" );
break;
case AUTOSAVE:
sprintf (path, "save/auto.bin" );
break;
case REGULAR:
sprintf (path, "save/%s.bin", SV_CurTime());
break;
}
savfile = FS_LoadFile(path, &size );
if(!savfile)
{
Msg("can't open %s\n", path );
return;
}
header = (dsavehdr_t *)savfile;
i = LittleLong (header->version);
id = LittleLong (header->ident);
if(id != IDSAVEHEADER) Com_Error(ERR_DROP, "SV_ReadSaveFile: file %s is corrupted\n", path );
if (i != SAVE_VERSION) Com_Error(ERR_DROP, "file %s from an older save version\n", path );
sav_base = (byte *)header;
Sav_LoadComment(&header->lumps[LUMP_COMMENTS]);
Sav_LoadCvars(&header->lumps[LUMP_GAMECVARS]);
SV_InitGame (); // start a new game fresh with new cvars
Sav_LoadMapCmds(&header->lumps[LUMP_MAPCMDS]);
ge->Sav_LoadGame( sav_base, &header->lumps[LUMP_GAMELOCAL] );
}
/*
=============
SV_ReadLevelFile
=============
*/
void SV_ReadLevelFile( int mode )
{
char path[MAX_SYSPATH];
dsavehdr_t *header;
byte *savfile;
int i, id, size;
switch( mode )
{
case QUICK:
sprintf (path, "save/quick.bin" );
break;
case AUTOSAVE:
sprintf (path, "save/%s/auto.bin", sv.name );
break;
case REGULAR:
sprintf (path, "save/%s/%s.bin", sv.name, SV_CurTime());
break;
}
savfile = FS_LoadFile(path, &size );
if(!savfile)
{
Msg("can't open %s\n", path );
return;
}
header = (dsavehdr_t *)savfile;
i = LittleLong (header->version);
id = LittleLong (header->ident);
if(id != IDSAVEHEADER) Com_Error(ERR_DROP, "SV_ReadSaveFile: file %s is corrupted\n", path );
if (i != SAVE_VERSION) Com_Error(ERR_DROP, "file %s from an older save version\n", path );
sav_base = (byte *)header;
Sav_LoadCfgString(&header->lumps[LUMP_CFGSTRING]);
Sav_LoadAreaPortals(&header->lumps[LUMP_AREASTATE]);
ge->Sav_LoadLevel( sav_base, &header->lumps[LUMP_GAMELEVEL] );
}

View File

@ -1,47 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: launcher - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\Temp\RSP558.tmp" with contents
[
/nologo /MTd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /I "../platform/formats" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\launcher\!debug/" /Fo"..\temp\launcher\!debug/" /Fd"..\temp\launcher\!debug/" /FD /GZ /c
"D:\XASH3D\src_main\!source\launcher\console.c"
"D:\XASH3D\src_main\!source\launcher\launcher.c"
"D:\XASH3D\src_main\!source\launcher\utils.c"
]
Creating command line "cl.exe @C:\Temp\RSP558.tmp"
Creating temporary file "C:\Temp\RSP559.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib advapi32.lib /nologo /dll /incremental:yes /pdb:"..\temp\launcher\!debug/launcher.pdb" /debug /machine:I386 /out:"..\temp\launcher\!debug/launcher.dll" /implib:"..\temp\launcher\!debug/launcher.lib" /pdbtype:sept
"\XASH3D\src_main\!source\temp\launcher\!debug\console.obj"
"\XASH3D\src_main\!source\temp\launcher\!debug\launcher.obj"
"\XASH3D\src_main\!source\temp\launcher\!debug\utils.obj"
]
Creating command line "link.exe @C:\Temp\RSP559.tmp"
Creating temporary file "C:\Temp\RSP55A.bat" with contents
[
@echo off
copy \XASH3D\src_main\!source\temp\launcher\!debug\launcher.dll "D:\Xash3D\bin\launcher.dll"
]
Creating command line "C:\Temp\RSP55A.bat"
Compiling...
console.c
launcher.c
utils.c
Generating Code...
Linking...
<h3>Output Window</h3>
Performing Custom Build Step on \XASH3D\src_main\!source\temp\launcher\!debug\launcher.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
launcher.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -2370,6 +2370,20 @@ VIRTUAL FILE SYSTEM - WRITE DATA INTO MEMORY
=============================================================================
*/
vfile_t *VFS_Create(byte *buffer, size_t buffsize)
{
vfile_t *file = (vfile_t *)Mem_Alloc (fs_mempool, sizeof (*file));
file->file = NULL; //no real stream
file->length = file->buffsize = buffsize;
file->buff = Mem_Alloc(fs_mempool, (file->buffsize));
file->offset = 0;
file->mode = O_RDONLY;
Mem_Copy(file->buff, buffer, buffsize );
return file;
}
vfile_t *VFS_Open(file_t* real_file, const char* mode)
{
vfile_t *file = (vfile_t *)Mem_Alloc (fs_mempool, sizeof (*file));
@ -2441,11 +2455,14 @@ fs_offset_t VFS_Write( vfile_t *file, const void *buf, size_t size )
if (file->offset + size >= file->buffsize)
{
int newsize = file->offset + size * (64 * 1024);
int newsize = file->offset + size + (64 * 1024);
//reallocate buffer now
file->buff = Mem_Realloc(fs_mempool, file->buff, newsize );
file->length = newsize; //merge file length
if (file->buffsize < newsize)
{
//reallocate buffer now
file->buff = Mem_Realloc(fs_mempool, file->buff, newsize );
file->buffsize = newsize; //merge buffsize
}
}
// write into buffer
@ -2488,8 +2505,13 @@ int VFS_Seek( vfile_t *file, fs_offset_t offset, int whence )
int VFS_Close( vfile_t *file )
{
//write real file into disk
FS_Write (file->file, file->buff, file->length);
if(!file) return -1;
if(file->mode == O_WRONLY)
{
// write real file into disk
FS_Write (file->file, file->buff, (file->length + 3) & ~3);// align
}
Free( file->buff );
Free( file ); //himself
@ -2509,6 +2531,7 @@ vfilesystem_api_t VFS_GetAPI( void )
vfs.api_size = sizeof(vfilesystem_api_t);
vfs.Create = VFS_Create;
vfs.Open = VFS_Open;
vfs.Close = VFS_Close;
vfs.Write = VFS_Write;

View File

@ -1,16 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: platform - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
platform.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -1,5 +1,6 @@
// game.h -- game dll information visible to server
#include "savefile.h"
#define GAME_API_VERSION 3
@ -177,19 +178,10 @@ typedef struct game_export_s
// each new level entered will cause a call to SpawnEntities
void (*SpawnEntities) (char *mapname, char *entstring, char *spawnpoint);
// Read/Write Game is for storing persistant cross level information
// about the world state and the clients.
// WriteGame is called every time a level is exited.
// ReadGame is called on a loadgame.
void (*WriteGame) (file_t *f, bool autosave);
void (*ReadGame) (file_t *f);
void (*WriteLump) (dsavehdr_t *hdr, file_t *f, int lumpnum);
// ReadLevel is called after the default map information has been
// loaded with SpawnEntities
void (*WriteLevel) (file_t *f);
void (*ReadLevel) (file_t *f);
void (*WriteLump) (file_t *f, int lumpnum);
void (*Sav_LoadGame)(byte *base, lump_t *l);
void (*Sav_LoadLevel)(byte *base, lump_t *l);
bool (*ClientConnect) (edict_t *ent, char *userinfo);
void (*ClientBegin) (edict_t *ent);

View File

@ -185,6 +185,7 @@ typedef struct vfilesystem_api_s
size_t api_size; // must matched with sizeof(vfilesystem_api_t)
//file low-level operations
vfile_t *(*Create)(byte *buffer, size_t buffsize); // create virtual stream
vfile_t *(*Open)(file_t* file, const char* mode); // virtual fopen
int (*Close)(vfile_t* file); // free buffer or write dump
long (*Write)(vfile_t* file, const void* data, size_t datasize); // write into buffer

View File

@ -17,19 +17,18 @@ SAVE FILE
#define QUICK 2
//header
#define SAVE_VERSION 1
#define SAVE_VERSION 2
#define IDSAVEHEADER (('E'<<24)+('V'<<16)+('A'<<8)+'S') // little-endian "SAVE"
#define LUMP_SNAPSHOT 0 // jpg image snapshot
#define LUMP_COMMENTS 1 // map comments
#define LUMP_MAPCMDS 2 // map commands
#define LUMP_GAMECVARS 3 // contain game comment and all cvar state
#define LUMP_GAMELOCAL 4 // server.dll game_locals_t struct and players info
#define LUMP_GAMETRANS 5 // level transition info
#define LUMP_CFGSTRING 6 // client info strings
#define LUMP_AREASTATE 7 // area portals state
#define LUMP_ENTSSTATE 8 // server.dll state of all entities
#define LUMP_HEADER 9 // header
#define LUMP_COMMENTS 0 // map comments
#define LUMP_CFGSTRING 1 // client info strings
#define LUMP_AREASTATE 2 // area portals state
#define LUMP_GAMELEVEL 3 // server.dll game_locals_t struct and players info
#define LUMP_MAPCMDS 4 // map commands
#define LUMP_GAMECVARS 5 // contain game comment and all cvar state
#define LUMP_GAMELOCAL 6 // server.dll game_locals_t struct and players info
#define LUMP_SNAPSHOT 7 // dxt image snapshot
#define LUMP_HEADER 8 // header
typedef struct
{

View File

@ -1,90 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: render - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\Temp\RSP563.tmp" with contents
[
/nologo /MTd /W3 /Gm /Gi /GX /ZI /Od /I "../public" /I "../platform/formats" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\render\!debug/" /Fo"..\temp\render\!debug/" /Fd"..\temp\render\!debug/" /FD /c
"D:\XASH3D\src_main\!source\render\gl_draw.c"
"D:\XASH3D\src_main\!source\render\gl_light.c"
"D:\XASH3D\src_main\!source\render\gl_mesh.c"
"D:\XASH3D\src_main\!source\render\gl_model.c"
"D:\XASH3D\src_main\!source\render\gl_rmain.c"
"D:\XASH3D\src_main\!source\render\gl_rmisc.c"
"D:\XASH3D\src_main\!source\render\gl_rsurf.c"
"D:\XASH3D\src_main\!source\render\gl_warp.c"
"D:\XASH3D\src_main\!source\render\gl_widnt.c"
"D:\XASH3D\src_main\!source\render\glw_imp.c"
"D:\XASH3D\src_main\!source\render\r_backend.c"
"D:\XASH3D\src_main\!source\render\r_bloom.c"
"D:\XASH3D\src_main\!source\render\r_bspmod.c"
"D:\XASH3D\src_main\!source\render\r_sprite.c"
"D:\XASH3D\src_main\!source\render\r_studio.c"
"D:\XASH3D\src_main\!source\render\r_texture.c"
"D:\XASH3D\src_main\!source\render\r_utils.c"
]
Creating command line "cl.exe @C:\Temp\RSP563.tmp"
Creating temporary file "C:\Temp\RSP564.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\render\!debug/render.pdb" /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\render\!debug/render.dll" /implib:"..\temp\render\!debug/render.lib" /pdbtype:sept /libpath:"../public/libs/"
"\XASH3D\src_main\!source\temp\render\!debug\gl_draw.obj"
"\XASH3D\src_main\!source\temp\render\!debug\gl_light.obj"
"\XASH3D\src_main\!source\temp\render\!debug\gl_mesh.obj"
"\XASH3D\src_main\!source\temp\render\!debug\gl_model.obj"
"\XASH3D\src_main\!source\temp\render\!debug\gl_rmain.obj"
"\XASH3D\src_main\!source\temp\render\!debug\gl_rmisc.obj"
"\XASH3D\src_main\!source\temp\render\!debug\gl_rsurf.obj"
"\XASH3D\src_main\!source\temp\render\!debug\gl_warp.obj"
"\XASH3D\src_main\!source\temp\render\!debug\gl_widnt.obj"
"\XASH3D\src_main\!source\temp\render\!debug\glw_imp.obj"
"\XASH3D\src_main\!source\temp\render\!debug\r_backend.obj"
"\XASH3D\src_main\!source\temp\render\!debug\r_bloom.obj"
"\XASH3D\src_main\!source\temp\render\!debug\r_bspmod.obj"
"\XASH3D\src_main\!source\temp\render\!debug\r_sprite.obj"
"\XASH3D\src_main\!source\temp\render\!debug\r_studio.obj"
"\XASH3D\src_main\!source\temp\render\!debug\r_texture.obj"
"\XASH3D\src_main\!source\temp\render\!debug\r_utils.obj"
]
Creating command line "link.exe @C:\Temp\RSP564.tmp"
Creating temporary file "C:\Temp\RSP565.bat" with contents
[
@echo off
copy \XASH3D\src_main\!source\temp\render\!debug\render.dll "D:\Xash3D\bin\render.dll"
]
Creating command line "C:\Temp\RSP565.bat"
Compiling...
gl_draw.c
gl_light.c
gl_mesh.c
gl_model.c
gl_rmain.c
gl_rmisc.c
gl_rsurf.c
gl_warp.c
gl_widnt.c
glw_imp.c
r_backend.c
r_bloom.c
r_bspmod.c
r_sprite.c
r_studio.c
r_texture.c
r_utils.c
Generating Code...
Linking...
Creating library ..\temp\render\!debug/render.lib and object ..\temp\render\!debug/render.exp
<h3>Output Window</h3>
Performing Custom Build Step on \XASH3D\src_main\!source\temp\render\!debug\render.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
render.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -116,10 +116,9 @@ void ClientDisconnect (edict_t *ent);
void ClientBegin (edict_t *ent);
void ClientCommand (edict_t *ent);
void RunEntity (edict_t *ent);
void WriteGame (file_t *f, bool autosave);
void ReadGame (file_t *f);
void WriteLevel (file_t *f);
void ReadLevel (file_t *f);
void WriteLump (dsavehdr_t *hdr, file_t *f, int lumpnum);
void Sav_LoadGame (byte *base, lump_t *l);
void Sav_LoadLevel (byte *base, lump_t *l);
void InitGame (void);
void G_RunFrame (void);
@ -191,10 +190,9 @@ game_export_t DLLEXPORT *ServerAPI (game_import_t *import)
globals.Shutdown = ShutdownGame;
globals.SpawnEntities = SpawnEntities;
globals.WriteGame = WriteGame;
globals.ReadGame = ReadGame;
globals.WriteLevel = WriteLevel;
globals.ReadLevel = ReadLevel;
globals.WriteLump = WriteLump;
globals.Sav_LoadGame = Sav_LoadGame;
globals.Sav_LoadLevel = Sav_LoadLevel;
globals.ClientThink = ClientThink;
globals.ClientConnect = ClientConnect;

View File

@ -432,7 +432,7 @@ void InitGame (void)
//=========================================================
void WriteField1 (file_t *f, field_t *field, byte *base)
void WriteField1 (vfile_t *f, field_t *field, byte *base)
{
void *p;
int len;
@ -500,7 +500,7 @@ void WriteField1 (file_t *f, field_t *field, byte *base)
}
void WriteField2 (file_t *f, field_t *field, byte *base)
void WriteField2 (vfile_t *f, field_t *field, byte *base)
{
int len;
void *p;
@ -515,13 +515,13 @@ void WriteField2 (file_t *f, field_t *field, byte *base)
if ( *(char **)p )
{
len = strlen(*(char **)p) + 1;
gi.Fs.Write (f, *(char **)p, len);
gi.VFs.Write (f, *(char **)p, len);
}
break;
}
}
void ReadField (file_t *f, field_t *field, byte *base)
void ReadField (vfile_t *f, field_t *field, byte *base)
{
void *p;
int len;
@ -546,7 +546,7 @@ void ReadField (file_t *f, field_t *field, byte *base)
else
{
*(char **)p = TagMalloc (len, TAG_LEVEL);
gi.Fs.Read (f, *(char **)p, len);
gi.VFs.Read (f, *(char **)p, len);
}
break;
case F_EDICT:
@ -599,7 +599,7 @@ WriteClient
All pointer variables (except function pointers) must be handled specially.
==============
*/
void WriteClient (file_t *f, gclient_t *client)
void WriteClient (vfile_t *f, gclient_t *client)
{
field_t *field;
gclient_t temp;
@ -614,7 +614,7 @@ void WriteClient (file_t *f, gclient_t *client)
}
// write the block
gi.Fs.Write (f, &temp, sizeof(temp));
gi.VFs.Write (f, &temp, sizeof(temp));
// now write any allocated data following the edict
for (field = clientfields; field->name; field++)
@ -630,11 +630,11 @@ ReadClient
All pointer variables (except function pointers) must be handled specially.
==============
*/
void ReadClient (file_t *f, gclient_t *client)
void ReadClient (vfile_t *f, gclient_t *client)
{
field_t *field;
gi.Fs.Read (f, client, sizeof(*client));
gi.VFs.Read (f, client, sizeof(*client));
client->pers.spawn_landmark = false;
client->pers.spawn_levelchange = false;
@ -658,7 +658,7 @@ A single player death will automatically restore from the
last save position.
============
*/
void WriteGame (file_t *f, bool autosave)
void WriteGame (vfile_t *f, bool autosave)
{
int i;
char str[16];
@ -670,17 +670,17 @@ void WriteGame (file_t *f, bool autosave)
memset (str, 0, sizeof(str));
strcpy (str, __DATE__ );
gi.Fs.Write (f, str, sizeof(str));
gi.VFs.Write (f, str, sizeof(str));
game.autosaved = autosave;
gi.Fs.Write (f, &game, sizeof(game));
gi.VFs.Write (f, &game, sizeof(game));
game.autosaved = false;
for (i = 0; i < game.maxclients; i++)
WriteClient (f, &game.clients[i]);
}
void ReadGame (file_t *f)
void ReadGame (vfile_t *f)
{
int i;
char str[16];
@ -689,17 +689,17 @@ void ReadGame (file_t *f)
FreeTags (TAG_GAME);
gi.Fs.Read (f, str, sizeof(str));
gi.VFs.Read (f, str, sizeof(str));
if (strcmp (str, __DATE__))
{
gi.Fs.Close (f);
gi.VFs.Close (f);
gi.error ("Savegame from an older version.\n");
}
g_edicts = TagMalloc (game.maxentities * sizeof(g_edicts[0]), TAG_GAME);
globals.edicts = g_edicts;
gi.Fs.Read (f, &game, sizeof(game));
gi.VFs.Read (f, &game, sizeof(game));
game.clients = TagMalloc (game.maxclients * sizeof(game.clients[0]), TAG_GAME);
for (i = 0; i < game.maxclients; i++) ReadClient (f, &game.clients[i]);
}
@ -714,7 +714,7 @@ WriteEdict
All pointer variables (except function pointers) must be handled specially.
==============
*/
void WriteEdict (file_t *f, edict_t *ent)
void WriteEdict (vfile_t *f, edict_t *ent)
{
field_t *field;
edict_t temp;
@ -729,7 +729,7 @@ void WriteEdict (file_t *f, edict_t *ent)
}
// write the block
gi.Fs.Write (f, &temp, sizeof(temp));
gi.VFs.Write (f, &temp, sizeof(temp));
// now write any allocated data following the edict
for (field = fields; field->name; field++)
@ -746,10 +746,10 @@ WriteLevelLocals
All pointer variables (except function pointers) must be handled specially.
==============
*/
void WriteLevelLocals (file_t *f)
void WriteLevelLocals (vfile_t *f)
{
field_t *field;
level_locals_t temp;
level_locals_t temp;
// all of the ints, floats, and vectors stay as they are
temp = level;
@ -761,7 +761,7 @@ void WriteLevelLocals (file_t *f)
}
// write the block
gi.Fs.Write (f, &temp, sizeof(temp));
gi.VFs.Write (f, &temp, sizeof(temp));
// now write any allocated data following the edict
for (field = levelfields; field->name; field++)
@ -778,11 +778,11 @@ ReadEdict
All pointer variables (except function pointers) must be handled specially.
==============
*/
void ReadEdict (file_t *f, edict_t *ent)
void ReadEdict (vfile_t *f, edict_t *ent)
{
field_t *field;
gi.Fs.Read (f, ent, sizeof(*ent));
gi.VFs.Read (f, ent, sizeof(*ent));
for (field = fields; field->name; field++)
{
@ -797,11 +797,11 @@ ReadLevelLocals
All pointer variables (except function pointers) must be handled specially.
==============
*/
void ReadLevelLocals (file_t *f)
void ReadLevelLocals (vfile_t *f)
{
field_t *field;
gi.Fs.Read (f, &level, sizeof(level));
gi.VFs.Read (f, &level, sizeof(level));
for (field = levelfields; field->name; field++)
{
@ -815,9 +815,9 @@ WriteLevel
=================
*/
void WriteLevel (file_t *f)
void WriteLevel (vfile_t *f)
{
int i;
int i;
edict_t *ent;
void *base;
@ -825,11 +825,11 @@ void WriteLevel (file_t *f)
// write out edict size for checking
i = sizeof(edict_t);
gi.Fs.Write (f, &i, sizeof(i));
gi.VFs.Write (f, &i, sizeof(i));
// write out a function pointer for checking
base = (void *)InitGame;
gi.Fs.Write (f, &base, sizeof(base));
gi.VFs.Write (f, &base, sizeof(base));
// write out level_locals_t
WriteLevelLocals (f);
@ -857,17 +857,17 @@ void WriteLevel (file_t *f)
e.nextthink = 0;
}
e.stream = NULL;
gi.Fs.Write (f, &i, sizeof(i));
gi.VFs.Write (f, &i, sizeof(i));
WriteEdict (f, &e);
}
else
{
gi.Fs.Write (f, &i, sizeof(i));
gi.VFs.Write (f, &i, sizeof(i));
WriteEdict (f, ent);
}
}
i = -1;
gi.Fs.Write (f, &i, sizeof(i));
gi.VFs.Write (f, &i, sizeof(i));
}
@ -888,12 +888,12 @@ No clients are connected yet.
=================
*/
void LoadTransitionEnts();
void ReadLevel (file_t *f)
void ReadLevel (vfile_t *f)
{
int entnum;
int i;
void *base;
edict_t *ent;
void *base;
edict_t *ent;
if(developer->value) gi.dprintf ("==== ReadLevel ====\n");
@ -902,19 +902,19 @@ void ReadLevel (file_t *f)
FreeTags (TAG_LEVEL);
// wipe all the entities
memset (g_edicts, 0, game.maxentities*sizeof(g_edicts[0]));
memset (g_edicts, 0, game.maxentities * sizeof(g_edicts[0]));
globals.num_edicts = maxclients->value+1;
// check edict size
gi.Fs.Read (f, &i, sizeof(i));
gi.VFs.Read (f, &i, sizeof(i));
if (i != sizeof(edict_t))
{
gi.Fs.Close (f);
gi.VFs.Close (f);
gi.error ("ReadLevel: mismatched edict size");
}
// check function pointer base address
gi.Fs.Read (f, &base, sizeof(base));
gi.VFs.Read (f, &base, sizeof(base));
// load the level locals
ReadLevelLocals (f);
@ -922,9 +922,9 @@ void ReadLevel (file_t *f)
// load all the entities
while (1)
{
if (!gi.Fs.Read (f, &entnum, sizeof(entnum)))
if (!gi.VFs.Read (f, &entnum, sizeof(entnum)))
{
gi.Fs.Close (f);
gi.VFs.Close (f);
gi.error ("ReadLevel: failed to read entnum");
}
if (entnum == -1) break;
@ -939,10 +939,10 @@ void ReadLevel (file_t *f)
gi.linkentity (ent);
}
gi.Fs.Close (f);
gi.VFs.Close (f);
// mark all clients as unconnected
for (i=0 ; i<maxclients->value ; i++)
for (i = 0; i < maxclients->value; i++)
{
ent = &g_edicts[i+1];
ent->client = game.clients + i;
@ -950,12 +950,10 @@ void ReadLevel (file_t *f)
}
// do any load time things at this point
for (i=0 ; i<globals.num_edicts ; i++)
for (i = 0; i < globals.num_edicts; i++)
{
ent = &g_edicts[i];
if (!ent->inuse)
continue;
if (!ent->inuse) continue;
// fire any cross-level triggers
if (ent->class_id == ENTITY_TARGET_CROSSLEVEL_TARGET)
@ -969,3 +967,52 @@ void ReadLevel (file_t *f)
actor_files();
}
}
void WriteLump (dsavehdr_t *hdr, file_t *f, int lumpnum)
{
lump_t *lump;
vfile_t *vf;
vf = gi.VFs.Open( f, "w" );
switch( lumpnum )
{
case LUMP_GAMELEVEL: WriteLevel( vf ); break;
case LUMP_GAMELOCAL: WriteGame( vf, false ); break;//FIXME
default:
gi.dprintf("unsupported lump num\n");
return;
}
lump = &hdr->lumps[lumpnum];
lump->fileofs = LittleLong( gi.Fs.Tell(f));
lump->filelen = LittleLong( gi.VFs.Tell(vf));
gi.VFs.Close( vf ); //write into disk
}
void Sav_LoadGame (byte *base, lump_t *l)
{
vfile_t *vf;
byte *in;
in = (void *)(base + l->fileofs);
if (l->filelen % sizeof(*in)) gi.error("Sav_LoadGame: funny lump size\n" );
vf = gi.VFs.Create(in, l->filelen );
ReadGame( vf );
gi.VFs.Close( vf );
}
void Sav_LoadLevel (byte *base, lump_t *l)
{
vfile_t *vf;
byte *in;
in = (void *)(base + l->fileofs);
if (l->filelen % sizeof(*in)) gi.error( "Sav_LoadLevel: funny lump size\n" );
vf = gi.VFs.Create(in, l->filelen );
ReadLevel( vf );
}

View File

@ -1,246 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: server - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\Temp\RSP5E8.tmp" with contents
[
/nologo /MTd /W3 /Gm /Gi /GX /ZI /Od /I ".\\" /I ".\monsters" /I ".\ents" /I ".\global" /I "../public" /I "../public/libs" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\server\!debug/" /Fo"..\temp\server\!debug/" /Fd"..\temp\server\!debug/" /FD /c
"D:\XASH3D\src_main\!source\server\global\g_ai.c"
"D:\XASH3D\src_main\!source\server\ents\g_camera.c"
"D:\XASH3D\src_main\!source\server\global\g_chase.c"
"D:\XASH3D\src_main\!source\server\global\g_cmds.c"
"D:\XASH3D\src_main\!source\server\global\g_combat.c"
"D:\XASH3D\src_main\!source\server\ents\g_crane.c"
"D:\XASH3D\src_main\!source\server\ents\g_fog.c"
"D:\XASH3D\src_main\!source\server\ents\g_func.c"
"D:\XASH3D\src_main\!source\server\ents\g_items.c"
"D:\XASH3D\src_main\!source\server\global\g_jetpack.c"
"D:\XASH3D\src_main\!source\server\ents\g_lights.c"
"D:\XASH3D\src_main\!source\server\ents\g_lock.c"
"D:\XASH3D\src_main\!source\server\global\g_main.c"
"D:\XASH3D\src_main\!source\server\ents\g_misc.c"
"D:\XASH3D\src_main\!source\server\ents\g_model.c"
"D:\XASH3D\src_main\!source\server\monsters\g_monster.c"
"D:\XASH3D\src_main\!source\server\ents\g_mtrain.c"
"D:\XASH3D\src_main\!source\server\global\g_newai.c"
"D:\XASH3D\src_main\!source\server\ents\g_pendulum.c"
"D:\XASH3D\src_main\!source\server\global\g_phys.c"
"D:\XASH3D\src_main\!source\server\ents\g_reflect.c"
"D:\XASH3D\src_main\!source\server\global\g_save.c"
"D:\XASH3D\src_main\!source\server\global\g_sound.c"
"D:\XASH3D\src_main\!source\server\global\g_spawn.c"
"D:\XASH3D\src_main\!source\server\global\g_svcmds.c"
"D:\XASH3D\src_main\!source\server\ents\g_target.c"
"D:\XASH3D\src_main\!source\server\ents\g_thing.c"
"D:\XASH3D\src_main\!source\server\ents\g_tracktrain.c"
"D:\XASH3D\src_main\!source\server\ents\g_trigger.c"
"D:\XASH3D\src_main\!source\server\ents\g_turret.c"
"D:\XASH3D\src_main\!source\server\global\g_utils.c"
"D:\XASH3D\src_main\!source\server\ents\g_vehicle.c"
"D:\XASH3D\src_main\!source\server\ents\g_weapon.c"
"D:\XASH3D\src_main\!source\server\ents\g_wes.c"
"D:\XASH3D\src_main\!source\server\monsters\m_actor.c"
"D:\XASH3D\src_main\!source\server\monsters\m_actor_weap.c"
"D:\XASH3D\src_main\!source\server\monsters\m_berserk.c"
"D:\XASH3D\src_main\!source\server\monsters\m_boss2.c"
"D:\XASH3D\src_main\!source\server\monsters\m_boss3.c"
"D:\XASH3D\src_main\!source\server\monsters\m_boss31.c"
"D:\XASH3D\src_main\!source\server\monsters\m_boss32.c"
"D:\XASH3D\src_main\!source\server\monsters\m_brain.c"
"D:\XASH3D\src_main\!source\server\monsters\m_chick.c"
"D:\XASH3D\src_main\!source\server\m_flash.c"
"D:\XASH3D\src_main\!source\server\monsters\m_flipper.c"
"D:\XASH3D\src_main\!source\server\monsters\m_float.c"
"D:\XASH3D\src_main\!source\server\monsters\m_flyer.c"
"D:\XASH3D\src_main\!source\server\monsters\m_gladiator.c"
"D:\XASH3D\src_main\!source\server\monsters\m_gunner.c"
"D:\XASH3D\src_main\!source\server\monsters\m_hover.c"
"D:\XASH3D\src_main\!source\server\monsters\m_infantry.c"
"D:\XASH3D\src_main\!source\server\monsters\m_insane.c"
"D:\XASH3D\src_main\!source\server\monsters\m_medic.c"
"D:\XASH3D\src_main\!source\server\monsters\m_move.c"
"D:\XASH3D\src_main\!source\server\monsters\m_mutant.c"
"D:\XASH3D\src_main\!source\server\monsters\m_parasite.c"
"D:\XASH3D\src_main\!source\server\monsters\m_soldier.c"
"D:\XASH3D\src_main\!source\server\monsters\m_supertank.c"
"D:\XASH3D\src_main\!source\server\monsters\m_tank.c"
"D:\XASH3D\src_main\!source\server\p_chase.c"
"D:\XASH3D\src_main\!source\server\p_client.c"
"D:\XASH3D\src_main\!source\server\p_hud.c"
"D:\XASH3D\src_main\!source\server\p_menu.c"
"D:\XASH3D\src_main\!source\server\p_text.c"
"D:\XASH3D\src_main\!source\server\p_trail.c"
"D:\XASH3D\src_main\!source\server\p_view.c"
"D:\XASH3D\src_main\!source\server\p_weapon.c"
]
Creating command line "cl.exe @C:\Temp\RSP5E8.tmp"
Creating temporary file "C:\Temp\RSP5E9.tmp" with contents
[
kernel32.lib user32.lib winmm.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\server\!debug/server.pdb" /debug /machine:I386 /out:"..\temp\render\!debug/server.dll" /implib:"..\temp\server\!debug/server.lib"
"\XASH3D\src_main\!source\temp\server\!debug\g_ai.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_camera.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_chase.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_cmds.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_combat.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_crane.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_fog.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_func.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_items.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_jetpack.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_lights.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_lock.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_main.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_misc.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_model.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_monster.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_mtrain.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_newai.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_pendulum.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_phys.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_reflect.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_save.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_sound.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_spawn.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_svcmds.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_target.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_thing.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_tracktrain.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_trigger.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_turret.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_utils.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_vehicle.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_weapon.obj"
"\XASH3D\src_main\!source\temp\server\!debug\g_wes.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_actor.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_actor_weap.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_berserk.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_boss2.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_boss3.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_boss31.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_boss32.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_brain.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_chick.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_flash.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_flipper.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_float.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_flyer.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_gladiator.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_gunner.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_hover.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_infantry.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_insane.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_medic.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_move.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_mutant.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_parasite.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_soldier.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_supertank.obj"
"\XASH3D\src_main\!source\temp\server\!debug\m_tank.obj"
"\XASH3D\src_main\!source\temp\server\!debug\p_chase.obj"
"\XASH3D\src_main\!source\temp\server\!debug\p_client.obj"
"\XASH3D\src_main\!source\temp\server\!debug\p_hud.obj"
"\XASH3D\src_main\!source\temp\server\!debug\p_menu.obj"
"\XASH3D\src_main\!source\temp\server\!debug\p_text.obj"
"\XASH3D\src_main\!source\temp\server\!debug\p_trail.obj"
"\XASH3D\src_main\!source\temp\server\!debug\p_view.obj"
"\XASH3D\src_main\!source\temp\server\!debug\p_weapon.obj"
]
Creating command line "link.exe @C:\Temp\RSP5E9.tmp"
Creating temporary file "C:\Temp\RSP5EA.bat" with contents
[
@echo off
copy \XASH3D\src_main\!source\temp\render\!debug\server.dll "D:\Xash3D\xash\bin\server.dll"
]
Creating command line "C:\Temp\RSP5EA.bat"
Compiling...
g_ai.c
g_camera.c
g_chase.c
g_cmds.c
g_combat.c
g_crane.c
g_fog.c
g_func.c
g_items.c
g_jetpack.c
g_lights.c
g_lock.c
g_main.c
g_misc.c
g_model.c
g_monster.c
g_mtrain.c
g_newai.c
g_pendulum.c
g_phys.c
Generating Code...
Compiling...
g_reflect.c
g_save.c
g_sound.c
g_spawn.c
g_svcmds.c
g_target.c
g_thing.c
g_tracktrain.c
g_trigger.c
g_turret.c
g_utils.c
g_vehicle.c
g_weapon.c
g_wes.c
m_actor.c
m_actor_weap.c
m_berserk.c
m_boss2.c
m_boss3.c
m_boss31.c
Generating Code...
Compiling...
m_boss32.c
m_brain.c
m_chick.c
m_flash.c
m_flipper.c
m_float.c
m_flyer.c
m_gladiator.c
m_gunner.c
m_hover.c
m_infantry.c
m_insane.c
m_medic.c
m_move.c
m_mutant.c
m_parasite.c
m_soldier.c
m_supertank.c
m_tank.c
p_chase.c
Generating Code...
Compiling...
p_client.c
p_hud.c
p_menu.c
p_text.c
p_trail.c
p_view.c
p_weapon.c
Generating Code...
Linking...
Creating library ..\temp\server\!debug/server.lib and object ..\temp\server\!debug/server.exp
<h3>Output Window</h3>
Performing Custom Build Step on \XASH3D\src_main\!source\temp\render\!debug\server.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
server.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>