mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 14:42:13 +00:00
Added support for lno files and fixed a crash when loading games/hexen2 level returns.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@419 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
a0bf669e3e
commit
6c806092b9
1 changed files with 36 additions and 2 deletions
|
@ -1517,7 +1517,10 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags)
|
|||
{
|
||||
isloadgame = false;
|
||||
|
||||
num = ED_FindGlobalOfs(progfuncs, "__fullspawndata");
|
||||
if (pr_typecurrent>=0)
|
||||
num = ED_FindGlobalOfs(progfuncs, "__fullspawndata");
|
||||
else
|
||||
num = 0;
|
||||
if (num)
|
||||
fulldata = (eval_t *)((int *)pr_globals + num);
|
||||
else
|
||||
|
@ -2324,6 +2327,37 @@ retry:
|
|||
}
|
||||
}
|
||||
|
||||
if (!pr_linenums)
|
||||
{
|
||||
unsigned int lnotype = *(unsigned int*)"LNOF";
|
||||
unsigned int version = 1;
|
||||
int ohm;
|
||||
unsigned int *file;
|
||||
char lnoname[128];
|
||||
ohm = PRHunkMark(progfuncs);
|
||||
|
||||
COM_StripExtension(filename, lnoname);
|
||||
strcat(lnoname, ".lno");
|
||||
if ((len=externs->FileSize(lnoname))>0)
|
||||
{
|
||||
file = PRHunkAlloc(progfuncs, len+1);
|
||||
if (externs->ReadFile(lnoname, file, len+1))
|
||||
|
||||
if ( file[0] != lnotype
|
||||
|| file[1] != version
|
||||
|| file[2] != pr_progs->numglobaldefs
|
||||
|| file[3] != pr_progs->numglobals
|
||||
|| file[4] != pr_progs->numfielddefs
|
||||
|| file[5] != pr_progs->numstatements
|
||||
)
|
||||
{
|
||||
PRHunkFree(progfuncs, ohm); //whoops: old progs or incompatable
|
||||
}
|
||||
else
|
||||
pr_linenums = file + 6;
|
||||
}
|
||||
}
|
||||
|
||||
pr_functions = fnc;
|
||||
// pr_strings = ((char *)pr_progs + pr_progs->ofs_strings);
|
||||
gd16 = *(ddef16_t**)¤t_progstate->globaldefs = (ddef16_t *)((qbyte *)pr_progs + pr_progs->ofs_globaldefs);
|
||||
|
|
Loading…
Reference in a new issue