mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
Fix for bad field offsets with timeserv's artill mod.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1463 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
28be10396d
commit
b3b4b8af6d
2 changed files with 27 additions and 2 deletions
|
@ -2658,11 +2658,22 @@ retry:
|
||||||
QC_RegisterFieldVar(progfuncs, type, fld16[i].s_name+pr_strings, 4*(fld16[i].ofs+progfuncs->fieldadjust), -1);
|
QC_RegisterFieldVar(progfuncs, type, fld16[i].s_name+pr_strings, 4*(fld16[i].ofs+progfuncs->fieldadjust), -1);
|
||||||
else if (type == ev_vector) //emit vector vars early, so thier fields cannot be alocated before the vector itself. (useful against scramblers)
|
else if (type == ev_vector) //emit vector vars early, so thier fields cannot be alocated before the vector itself. (useful against scramblers)
|
||||||
{
|
{
|
||||||
QC_RegisterFieldVar(progfuncs, type, fld16[i].s_name+pr_strings, -1, -1);
|
QC_RegisterFieldVar(progfuncs, type, fld16[i].s_name+pr_strings, -1, fld16[i].ofs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fld16[i].s_name += stringadjust;
|
fld16[i].s_name += stringadjust;
|
||||||
}
|
}
|
||||||
|
if (reorg && !(progfuncs->fieldadjust && !pr_typecurrent))
|
||||||
|
for (i=0 ; i<pr_progs->numfielddefs ; i++)
|
||||||
|
{
|
||||||
|
if (pr_types)
|
||||||
|
type = pr_types[fld16[i].type & ~(DEF_SHARED|DEF_SAVEGLOBAL)].type;
|
||||||
|
else
|
||||||
|
type = fld16[i].type & ~(DEF_SHARED|DEF_SAVEGLOBAL);
|
||||||
|
if (type != ev_vector)
|
||||||
|
QC_RegisterFieldVar(progfuncs, type, fld16[i].s_name+pr_strings, -1, fld16[i].ofs);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
|
for (i=0 ; i<pr_progs->numglobaldefs ; i++)
|
||||||
|
@ -2692,10 +2703,20 @@ retry:
|
||||||
if (progfuncs->fieldadjust && !pr_typecurrent) //we need to make sure all fields appear in thier original place.
|
if (progfuncs->fieldadjust && !pr_typecurrent) //we need to make sure all fields appear in thier original place.
|
||||||
QC_RegisterFieldVar(progfuncs, type, fld16[i].s_name+pr_strings, 4*(fld16[i].ofs+progfuncs->fieldadjust), -1);
|
QC_RegisterFieldVar(progfuncs, type, fld16[i].s_name+pr_strings, 4*(fld16[i].ofs+progfuncs->fieldadjust), -1);
|
||||||
else if (type == ev_vector)
|
else if (type == ev_vector)
|
||||||
QC_RegisterFieldVar(progfuncs, type, pr_fielddefs32[i].s_name+pr_strings, -1, -1);
|
QC_RegisterFieldVar(progfuncs, type, pr_fielddefs32[i].s_name+pr_strings, -1, pr_fielddefs32[i].ofs);
|
||||||
}
|
}
|
||||||
pr_fielddefs32[i].s_name += stringadjust;
|
pr_fielddefs32[i].s_name += stringadjust;
|
||||||
}
|
}
|
||||||
|
if (reorg && !(progfuncs->fieldadjust && !pr_typecurrent))
|
||||||
|
for (i=0 ; i<pr_progs->numfielddefs ; i++)
|
||||||
|
{
|
||||||
|
if (pr_types)
|
||||||
|
type = pr_types[pr_fielddefs32[i].type & ~(DEF_SHARED|DEF_SAVEGLOBAL)].type;
|
||||||
|
else
|
||||||
|
type = pr_fielddefs32[i].type & ~(DEF_SHARED|DEF_SAVEGLOBAL);
|
||||||
|
if (type != ev_vector)
|
||||||
|
QC_RegisterFieldVar(progfuncs, type, pr_fielddefs32[i].s_name+pr_strings, -1, pr_fielddefs32[i].ofs);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Sys_Error("Bad int size");
|
Sys_Error("Bad int size");
|
||||||
|
|
|
@ -235,6 +235,7 @@ int QC_RegisterFieldVar(progfuncs_t *progfuncs, unsigned int type, char *name, i
|
||||||
|
|
||||||
if (field[i].progsofs == -1)
|
if (field[i].progsofs == -1)
|
||||||
field[i].progsofs = progsofs;
|
field[i].progsofs = progsofs;
|
||||||
|
// printf("Dupfield %s %i -> %i\n", name, field[i].progsofs,field[i].ofs);
|
||||||
return field[i].ofs-progfuncs->fieldadjust; //got a match
|
return field[i].ofs-progfuncs->fieldadjust; //got a match
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,6 +305,7 @@ int QC_RegisterFieldVar(progfuncs_t *progfuncs, unsigned int type, char *name, i
|
||||||
{
|
{
|
||||||
if (field[i].progsofs == (unsigned)progsofs)
|
if (field[i].progsofs == (unsigned)progsofs)
|
||||||
{
|
{
|
||||||
|
// printf("found union field %s %i -> %i\n", field[i].name, field[i].progsofs, field[i].ofs);
|
||||||
field[fnum].ofs = ofs = field[i].ofs;
|
field[fnum].ofs = ofs = field[i].ofs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -320,6 +322,8 @@ int QC_RegisterFieldVar(progfuncs_t *progfuncs, unsigned int type, char *name, i
|
||||||
|
|
||||||
field[fnum].progsofs = progsofs;
|
field[fnum].progsofs = progsofs;
|
||||||
|
|
||||||
|
// printf("Field %s %i -> %i\n", name, field[fnum].progsofs,field[fnum].ofs);
|
||||||
|
|
||||||
//we've finished setting the structure
|
//we've finished setting the structure
|
||||||
return ofs - progfuncs->fieldadjust;
|
return ofs - progfuncs->fieldadjust;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue