mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Remove non-SAMESIZE_ACTOR_T code and remaining #defines.
We've been running with same-sized actor_t for a while without problems now. In the unlikely event (famous last words) that an issue should pop up later, this revision should be consulted for the differences between the two versions. git-svn-id: https://svn.eduke32.com/eduke32@2451 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
af2f862c85
commit
3917e05c1e
10 changed files with 28 additions and 344 deletions
|
@ -703,11 +703,7 @@ static void A_MoveSector(int32_t i)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
# define LIGHTRAD_PICOFS (T5 ? *(script+T5) + (*(script+T5+2))*T4 : 0)
|
||||
#else
|
||||
# define LIGHTRAD_PICOFS (T5 ? (*(intptr_t *)T5) + *(((intptr_t *)T5)+2) * T4 : 0)
|
||||
#endif
|
||||
#define LIGHTRAD_PICOFS (T5 ? *(script+T5) + (*(script+T5+2))*T4 : 0)
|
||||
|
||||
// this is the same crap as in game.c's tspr manipulation. puke.
|
||||
#define LIGHTRAD (s->yrepeat * tilesizy[s->picnum+LIGHTRAD_PICOFS])
|
||||
|
@ -1417,11 +1413,9 @@ ACTOR_STATIC void G_MoveStandables(void)
|
|||
{
|
||||
int32_t i = headspritestat[STAT_STANDABLE], j, k, nexti, nextj, p=0, sect, switchpicnum;
|
||||
int32_t l=0, x;
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
|
||||
int32_t *t;
|
||||
#else
|
||||
intptr_t *t;
|
||||
#endif
|
||||
|
||||
spritetype *s;
|
||||
int16_t m;
|
||||
|
||||
|
@ -3518,11 +3512,9 @@ static int16_t A_FindLocator(int32_t n,int32_t sn)
|
|||
ACTOR_STATIC void G_MoveActors(void)
|
||||
{
|
||||
int32_t x, m, l;
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
|
||||
int32_t *t;
|
||||
#else
|
||||
intptr_t *t;
|
||||
#endif
|
||||
|
||||
int32_t a, j, nexti, nextj, sect, p, switchpicnum, k;
|
||||
spritetype *s;
|
||||
int32_t i = headspritestat[STAT_ACTOR];
|
||||
|
@ -4874,11 +4866,9 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
|
|||
{
|
||||
int16_t i, j, nexti, sect, p;
|
||||
int32_t l, x;
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
|
||||
int32_t *t;
|
||||
#else
|
||||
intptr_t *t;
|
||||
#endif
|
||||
|
||||
spritetype *s;
|
||||
int32_t switchpicnum;
|
||||
|
||||
|
@ -5440,11 +5430,9 @@ BOLT:
|
|||
ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
||||
{
|
||||
int32_t q=0, m, x, st, j, l;
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
|
||||
int32_t *t;
|
||||
#else
|
||||
intptr_t *t;
|
||||
#endif
|
||||
|
||||
int32_t i = headspritestat[STAT_EFFECTOR], nexti, nextk, p, sh, nextj;
|
||||
int16_t k;
|
||||
spritetype *s;
|
||||
|
|
|
@ -23,10 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef __actors_h__
|
||||
#define __actors_h__
|
||||
|
||||
// Uncomment to have the same sizeof(actor_t) and sizeof(netactor_t) across
|
||||
// 32- and 64-bit builds; KEEPINSYNC with same #define in gamedef.h:
|
||||
#define SAMESIZE_ACTOR_T
|
||||
|
||||
#define MAXSLEEPDIST 16384
|
||||
#define SLEEPTIME 1536
|
||||
#define ZOFFSET (1<<8)
|
||||
|
@ -87,11 +83,8 @@ typedef struct {
|
|||
|
||||
// (+ 40 8 6 16 16 4 8 6 4 20)
|
||||
typedef struct {
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
|
||||
#else
|
||||
intptr_t t_data[10]; // 40b/80b sometimes used to hold pointers to con code
|
||||
#endif
|
||||
|
||||
int16_t picnum,ang,extra,owner; //8b
|
||||
int16_t movflag,tempang,timetosleep; //6b
|
||||
|
||||
|
@ -123,11 +116,7 @@ typedef struct {
|
|||
|
||||
// this struct needs to match the beginning of actor_t above
|
||||
typedef struct {
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
|
||||
#else
|
||||
intptr_t t_data[10]; // 40b/80b sometimes used to hold pointers to con code
|
||||
#endif
|
||||
|
||||
int16_t picnum,ang,extra,owner; //8b
|
||||
int16_t movflag,tempang,timetosleep; // 6b
|
||||
|
|
|
@ -63,10 +63,6 @@ extern "C" {
|
|||
#define NAM (g_gameType & GAME_NAM)
|
||||
#define WW2GI (g_gameType & GAME_WW2)
|
||||
|
||||
// Uncomment to have the same sizeof(actor_t) and sizeof(netactor_t) across
|
||||
// 32- and 64-bit builds; KEEPINSYNC with same #define in actors.h and gamedef.h:
|
||||
#define SAMESIZE_ACTOR_T
|
||||
|
||||
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
|
||||
#define BYTEVERSION_JF 240
|
||||
|
||||
|
|
|
@ -6496,17 +6496,11 @@ PALONLY:
|
|||
t->ang = sprpos[i].ang;
|
||||
}
|
||||
*/
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
|
||||
if ((unsigned)t4 + 2 >= (unsigned)g_scriptSize)
|
||||
goto skip;
|
||||
|
||||
l = *(script + t4 + 2);
|
||||
#else
|
||||
if ((unsigned)((intptr_t *)t4 - script + 2) >= (unsigned)g_scriptSize)
|
||||
goto skip;
|
||||
|
||||
l = *(((intptr_t *)t4)+2); //For TerminX: was *(int32_t *)(t4+8)
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
|
||||
|
@ -6561,11 +6555,9 @@ PALONLY:
|
|||
k = 0;
|
||||
break;
|
||||
}
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
|
||||
t->picnum += k + *(script + t4) + l*t3;
|
||||
#else
|
||||
t->picnum += k + (*(intptr_t *)t4) + l * t3;
|
||||
#endif
|
||||
|
||||
if (l > 0) while (tilesizx[t->picnum] == 0 && t->picnum > 0)
|
||||
t->picnum -= l; //Hack, for actors
|
||||
|
||||
|
|
|
@ -1778,20 +1778,10 @@ static int32_t C_GetNextValue(int32_t type)
|
|||
initprintf("%s:%d: debug: accepted %s label `%s'.\n",g_szScriptFileName,g_lineNumber,gl,label+(i<<6));
|
||||
Bfree(gl);
|
||||
}
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if ((labeltype[i]&LABEL_DEFINE)==0)
|
||||
bitptr[(g_scriptPtr-script)>>3] |= (BITPTR_POINTER<<((g_scriptPtr-script)&7));
|
||||
else // the 'define' label type is the only one that doesn't reference the script
|
||||
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
|
||||
|
||||
if ((labeltype[i]&LABEL_DEFINE)==0)
|
||||
*(g_scriptPtr++) = (intptr_t)(script + labelcode[i]);
|
||||
else
|
||||
*(g_scriptPtr++) = labelcode[i];
|
||||
#else
|
||||
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
|
||||
*(g_scriptPtr++) = labelcode[i];
|
||||
#endif
|
||||
|
||||
textptr += l;
|
||||
return labeltype[i];
|
||||
}
|
||||
|
|
|
@ -23,10 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef _gamedef_h_
|
||||
#define _gamedef_h_
|
||||
|
||||
// Uncomment to have the same sizeof(actor_t) and sizeof(netactor_t) across
|
||||
// 32- and 64-bit builds; KEEPINSYNC with same #define in actors.h:
|
||||
#define SAMESIZE_ACTOR_T
|
||||
|
||||
#define MAXGAMEEVENTS 128
|
||||
#define LABEL_HASPARM2 1
|
||||
#define LABEL_ISSTRING 2
|
||||
|
@ -130,11 +126,7 @@ enum vmflags_t {
|
|||
|
||||
typedef struct {
|
||||
int32_t g_i, g_p, g_x;
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
int32_t *g_t;
|
||||
#else
|
||||
intptr_t *g_t;
|
||||
#endif
|
||||
spritetype *g_sp;
|
||||
int32_t g_flags;
|
||||
} vmstate_t;
|
||||
|
|
|
@ -421,22 +421,16 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void VM_AlterAng(int32_t a)
|
|||
{
|
||||
int32_t ticselapsed = (vm.g_t[0])&31;
|
||||
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
const intptr_t *moveptr;
|
||||
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize)
|
||||
#else
|
||||
const intptr_t *moveptr = (intptr_t *)vm.g_t[1];
|
||||
if (moveptr < &script[0] || moveptr >= &script[g_scriptSize])
|
||||
#endif
|
||||
|
||||
{
|
||||
vm.g_t[1] = 0;
|
||||
OSD_Printf(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
moveptr = script + vm.g_t[1]; // RESEARCH: what's with move 0 and >>> 1 <<<?
|
||||
#endif
|
||||
|
||||
vm.g_sp->xvel += (*moveptr-vm.g_sp->xvel)/5;
|
||||
if (vm.g_sp->zvel < 648) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)/5;
|
||||
|
@ -565,20 +559,14 @@ GAMEEXEC_STATIC void VM_Move(void)
|
|||
}
|
||||
|
||||
dead:
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize)
|
||||
#else
|
||||
if ((moveptr = (intptr_t *)vm.g_t[1]) < &script[0] || moveptr >= &script[g_scriptSize])
|
||||
#endif
|
||||
{
|
||||
vm.g_t[1] = 0;
|
||||
OSD_Printf(OSD_ERROR "clearing bad moveptr for actor %d (%d)\n", vm.g_i, vm.g_sp->picnum);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
moveptr = script + vm.g_t[1]; // RESEARCH: what's with move 0 and >>> 1 <<<?
|
||||
#endif
|
||||
|
||||
if (a&geth) vm.g_sp->xvel += ((*moveptr)-vm.g_sp->xvel)>>1;
|
||||
if (a&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1;
|
||||
|
@ -909,15 +897,11 @@ skip_check:
|
|||
insptr++;
|
||||
//Following changed to use pointersizes
|
||||
vm.g_t[5] = *insptr++; // Ai
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
|
||||
vm.g_t[4] = *(script + vm.g_t[5]); // Action
|
||||
if (vm.g_t[5]) vm.g_t[1] = *(script + vm.g_t[5] + 1); // move
|
||||
vm.g_sp->hitag = *(script + vm.g_t[5] + 2); // move flags
|
||||
#else
|
||||
vm.g_t[4] = *(intptr_t *)(vm.g_t[5]); // Action
|
||||
if (vm.g_t[5]) vm.g_t[1] = *(((intptr_t *)vm.g_t[5])+1); // move
|
||||
vm.g_sp->hitag = *(((intptr_t *)vm.g_t[5])+2); // move flags
|
||||
#endif
|
||||
|
||||
vm.g_t[0] = vm.g_t[2] = vm.g_t[3] = 0; // count, actioncount... vm.g_t[3] = ??
|
||||
if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack
|
||||
continue;
|
||||
|
@ -1240,18 +1224,11 @@ skip_check:
|
|||
default:
|
||||
// fix for flying/jumping monsters getting stuck in water
|
||||
{
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
int32_t moveScriptOfs = vm.g_t[1];
|
||||
#else
|
||||
const intptr_t *moveptr = (intptr_t *)vm.g_t[1];
|
||||
#endif
|
||||
|
||||
if (vm.g_sp->hitag & jumptoplayer ||
|
||||
(actorscrptr[vm.g_sp->picnum] &&
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
(unsigned)moveScriptOfs < (unsigned)g_scriptSize - 1 && *(script + moveScriptOfs + 1)
|
||||
#else
|
||||
(unsigned)(moveptr - script) < (unsigned)g_scriptSize - 1 && *(moveptr+1)
|
||||
#endif
|
||||
))
|
||||
{
|
||||
// OSD_Printf("%d\n",*(moveptr+1));
|
||||
|
@ -1872,17 +1849,10 @@ nullquote:
|
|||
|
||||
if (actorscrptr[sprite[i].picnum])
|
||||
{
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
// offsets
|
||||
T5 = *(actorscrptr[sprite[i].picnum]+1); // action
|
||||
T2 = *(actorscrptr[sprite[i].picnum]+2); // move
|
||||
sprite[i].hitag = *(actorscrptr[sprite[i].picnum]+3); // ai bits
|
||||
#else
|
||||
// pointers
|
||||
T5 = *(actorscrptr[sprite[i].picnum]+1);
|
||||
T2 = *(actorscrptr[sprite[i].picnum]+2);
|
||||
sprite[i].hitag = *(actorscrptr[sprite[i].picnum]+3);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
changespritestat(i,j);
|
||||
|
@ -4976,34 +4946,19 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
|
|||
* (whether it is int32_t vs intptr_t), Although it is specifically cast to intptr_t*
|
||||
* which might be corrected if the code is converted to use offsets */
|
||||
/* Helixhorned: let's do away with intptr_t's... */
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
if ((unsigned)vm.g_t[4] + 4 < (unsigned)g_scriptSize)
|
||||
#else
|
||||
if ((unsigned)(vm.g_t[4]-(intptr_t)&script[0]) <= (unsigned)((intptr_t)&script[g_scriptSize]-(intptr_t)&script[0]))
|
||||
#endif
|
||||
{
|
||||
vm.g_sp->lotag += TICSPERFRAME;
|
||||
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
if (vm.g_sp->lotag > *(script + vm.g_t[4] + 4))
|
||||
#else
|
||||
if (vm.g_sp->lotag > *(intptr_t *)(vm.g_t[4]+4*sizeof(*insptr)))
|
||||
#endif
|
||||
{
|
||||
vm.g_t[2]++;
|
||||
vm.g_sp->lotag = 0;
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
|
||||
vm.g_t[3] += *(script + vm.g_t[4] + 3);
|
||||
#else
|
||||
vm.g_t[3] += *(intptr_t *)(vm.g_t[4]+3*sizeof(*insptr));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SAMESIZE_ACTOR_T
|
||||
if (klabs(vm.g_t[3]) >= klabs(*(script + vm.g_t[4] + 1) * *(script + vm.g_t[4] + 3)))
|
||||
#else
|
||||
if (klabs(vm.g_t[3]) >= klabs(*(intptr_t *)(vm.g_t[4]+sizeof(*insptr)) * *(intptr_t *)(vm.g_t[4]+3*sizeof(*insptr))))
|
||||
#endif
|
||||
vm.g_t[3] = 0;
|
||||
}
|
||||
|
||||
|
@ -5105,53 +5060,8 @@ void G_SaveMapState(mapstate_t *save)
|
|||
Bmemcpy(save->yax_bunchnum, yax_bunchnum, sizeof(yax_bunchnum));
|
||||
Bmemcpy(save->yax_nextwall, yax_nextwall, sizeof(yax_nextwall));
|
||||
#endif
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
for (i=MAXSPRITES-1; i>=0; i--)
|
||||
{
|
||||
intptr_t j;
|
||||
|
||||
save->scriptptrs[i] = 0;
|
||||
|
||||
if (actorscrptr[PN] == 0) continue;
|
||||
|
||||
j = (intptr_t)&script[0];
|
||||
|
||||
if (T2 >= j && T2 < (intptr_t)(&script[g_scriptSize]))
|
||||
{
|
||||
save->scriptptrs[i] |= 1;
|
||||
T2 -= j;
|
||||
}
|
||||
if (T5 >= j && T5 < (intptr_t)(&script[g_scriptSize]))
|
||||
{
|
||||
save->scriptptrs[i] |= 2;
|
||||
T5 -= j;
|
||||
}
|
||||
if (T6 >= j && T6 < (intptr_t)(&script[g_scriptSize]))
|
||||
{
|
||||
save->scriptptrs[i] |= 4;
|
||||
T6 -= j;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Bmemcpy(&save->actor[0],&actor[0],sizeof(actor_t)*MAXSPRITES);
|
||||
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
for (i=MAXSPRITES-1; i>=0; i--)
|
||||
{
|
||||
intptr_t j;
|
||||
|
||||
if (actorscrptr[PN] == 0) continue;
|
||||
j = (intptr_t)&script[0];
|
||||
|
||||
if (save->scriptptrs[i]&1)
|
||||
T2 += j;
|
||||
if (save->scriptptrs[i]&2)
|
||||
T5 += j;
|
||||
if (save->scriptptrs[i]&4)
|
||||
T6 += j;
|
||||
}
|
||||
#endif
|
||||
Bmemcpy(&save->g_numCyclers,&g_numCyclers,sizeof(g_numCyclers));
|
||||
Bmemcpy(&save->cyclers[0][0],&cyclers[0][0],sizeof(cyclers));
|
||||
Bmemcpy(&save->g_playerSpawnPoints[0],&g_playerSpawnPoints[0],sizeof(g_playerSpawnPoints));
|
||||
|
@ -5247,17 +5157,7 @@ void G_RestoreMapState(mapstate_t *save)
|
|||
Bmemcpy(yax_nextwall, save->yax_nextwall, sizeof(yax_nextwall));
|
||||
#endif
|
||||
Bmemcpy(&actor[0],&save->actor[0],sizeof(actor_t)*MAXSPRITES);
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
for (i=MAXSPRITES-1; i>=0; i--)
|
||||
{
|
||||
intptr_t j;
|
||||
|
||||
j = (intptr_t)(&script[0]);
|
||||
if (save->scriptptrs[i]&1) T2 += j;
|
||||
if (save->scriptptrs[i]&2) T5 += j;
|
||||
if (save->scriptptrs[i]&4) T6 += j;
|
||||
}
|
||||
#endif
|
||||
Bmemcpy(&g_numCyclers,&save->g_numCyclers,sizeof(g_numCyclers));
|
||||
Bmemcpy(&cyclers[0][0],&save->cyclers[0][0],sizeof(cyclers));
|
||||
Bmemcpy(&g_playerSpawnPoints[0],&save->g_playerSpawnPoints[0],sizeof(g_playerSpawnPoints));
|
||||
|
|
|
@ -612,10 +612,6 @@ int32_t Net_UnpackSprite(int32_t i, uint8_t *pbuf)
|
|||
if (flags & NET_ACTOR_T2)
|
||||
{
|
||||
actor[i].t_data[1] = *(int32_t *)&pbuf[j];
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if (flags & NET_ACTOR_PTR1)
|
||||
actor[i].t_data[1] += (intptr_t)&script[0];
|
||||
#endif
|
||||
j += sizeof(int32_t);
|
||||
}
|
||||
|
||||
|
@ -634,20 +630,12 @@ int32_t Net_UnpackSprite(int32_t i, uint8_t *pbuf)
|
|||
if (flags & NET_ACTOR_T5)
|
||||
{
|
||||
actor[i].t_data[4] = *(int32_t *)&pbuf[j];
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if (flags & NET_ACTOR_PTR2)
|
||||
actor[i].t_data[4] += (intptr_t)&script[0];
|
||||
#endif
|
||||
j += sizeof(int32_t);
|
||||
}
|
||||
|
||||
if (flags & NET_ACTOR_T6)
|
||||
{
|
||||
actor[i].t_data[5] = *(int32_t *)&pbuf[j];
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if (flags & NET_ACTOR_PTR3)
|
||||
actor[i].t_data[5] += (intptr_t)&script[0];
|
||||
#endif
|
||||
j += sizeof(int32_t);
|
||||
}
|
||||
|
||||
|
@ -945,15 +933,7 @@ int32_t Net_PackSprite(int32_t i, uint8_t *pbuf)
|
|||
if (!lastupdate[i] || actor[i].t_data[1] != netactor[i].t_data[1])
|
||||
{
|
||||
*flags |= NET_ACTOR_T2;
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if (T2 >= (intptr_t)&script[0] && T2 < (intptr_t)(&script[g_scriptSize]))
|
||||
{
|
||||
*flags |= NET_ACTOR_PTR1;
|
||||
*(int32_t *)&pbuf[j] = (int32_t)(actor[i].t_data[1] - (intptr_t)&script[0]);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
*(int32_t *)&pbuf[j] = actor[i].t_data[1];
|
||||
*(int32_t *)&pbuf[j] = actor[i].t_data[1];
|
||||
j += sizeof(int32_t);
|
||||
}
|
||||
|
||||
|
@ -974,30 +954,14 @@ int32_t Net_PackSprite(int32_t i, uint8_t *pbuf)
|
|||
if (!lastupdate[i] || actor[i].t_data[4] != netactor[i].t_data[4])
|
||||
{
|
||||
*flags |= NET_ACTOR_T5;
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if (T5 >= (intptr_t)&script[0] && T5 < (intptr_t)(&script[g_scriptSize]))
|
||||
{
|
||||
*flags |= NET_ACTOR_PTR2;
|
||||
*(int32_t *)&pbuf[j] = (int32_t)(actor[i].t_data[4] - (intptr_t)&script[0]);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
*(int32_t *)&pbuf[j] = actor[i].t_data[4];
|
||||
*(int32_t *)&pbuf[j] = actor[i].t_data[4];
|
||||
j += sizeof(int32_t);
|
||||
}
|
||||
|
||||
if (!lastupdate[i] || actor[i].t_data[5] != netactor[i].t_data[5])
|
||||
{
|
||||
*flags |= NET_ACTOR_T6;
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if (T6 >= (intptr_t)&script[0] && T6 < (intptr_t)(&script[g_scriptSize]))
|
||||
{
|
||||
*flags |= NET_ACTOR_PTR3;
|
||||
*(int32_t *)&pbuf[j] = (int32_t)(actor[i].t_data[5] - (intptr_t)&script[0]);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
*(int32_t *)&pbuf[j] = actor[i].t_data[5];
|
||||
*(int32_t *)&pbuf[j] = actor[i].t_data[5];
|
||||
j += sizeof(int32_t);
|
||||
}
|
||||
|
||||
|
@ -1822,22 +1786,9 @@ void Net_ParseServerPacket(ENetEvent *event)
|
|||
|
||||
i = g_player[l].ps->i;
|
||||
|
||||
{
|
||||
#if defined SAMESIZE_ACTOR_T
|
||||
j++;
|
||||
Bmemcpy(&T5, &pbuf[j], sizeof(T5));
|
||||
j += sizeof(T5);
|
||||
#else
|
||||
int16_t jj = j++;
|
||||
int32_t oa = (T5 >= (intptr_t)&script[0] && T5 < (intptr_t)&script[g_scriptSize]) ? T5-(intptr_t)&script[0] : T5;
|
||||
|
||||
Bmemcpy(&T5, &pbuf[j], sizeof(T5));
|
||||
j += sizeof(T5);
|
||||
|
||||
if (oa != T5) T3 = T4 = 0;
|
||||
if (pbuf[jj] & 2) T5 += (intptr_t)&script[0];
|
||||
#endif
|
||||
}
|
||||
j++;
|
||||
Bmemcpy(&T5, &pbuf[j], sizeof(T5));
|
||||
j += sizeof(T5);
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -2814,28 +2765,11 @@ void Net_UpdateClients(void)
|
|||
|
||||
{
|
||||
int32_t jj;
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
int32_t oa;
|
||||
#endif
|
||||
|
||||
packbuf[(jj = j++)] = 0;
|
||||
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if (T5 >= (intptr_t)&script[0] && T5 < (intptr_t)(&script[g_scriptSize]))
|
||||
{
|
||||
packbuf[jj] |= 2;
|
||||
T5 -= (intptr_t)&script[0];
|
||||
}
|
||||
|
||||
oa = T5;
|
||||
#endif
|
||||
Bmemcpy(&packbuf[j], &T5, sizeof(T5));
|
||||
j += sizeof(T5);
|
||||
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if (oa != T5) T3 = T4 = 0;
|
||||
|
||||
if (packbuf[jj] & 2) T5 += (intptr_t)&script[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -426,9 +426,6 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
char fn[13];
|
||||
char mpfn[13];
|
||||
char *fnptr;
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
char *scriptptrs;
|
||||
#endif
|
||||
int32_t fil, bv, i, x;
|
||||
intptr_t j;
|
||||
int32_t nump;
|
||||
|
@ -627,26 +624,8 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
if (kdfread(&actorLoadEventScrptr[0],sizeof(&actorLoadEventScrptr[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_BACK_NON0);
|
||||
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
scriptptrs = Bmalloc(MAXSPRITES * sizeof(scriptptrs));
|
||||
|
||||
if (kdfread(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
#endif
|
||||
if (kdfread(&actor[0],sizeof(actor_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
{
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
j = (intptr_t)script;
|
||||
if (scriptptrs[i]&1) T2 += j;
|
||||
if (scriptptrs[i]&2) T5 += j;
|
||||
if (scriptptrs[i]&4) T6 += j;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
Bfree(scriptptrs);
|
||||
#endif
|
||||
if (kdfread(&lockclock,sizeof(lockclock),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&pskybits,sizeof(pskybits),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil) != MAXPSKYTILES) goto corrupt;
|
||||
|
@ -923,9 +902,6 @@ int32_t G_SavePlayer(int32_t spot)
|
|||
char fn[13];
|
||||
char mpfn[13];
|
||||
char *fnptr;
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
char *scriptptrs;
|
||||
#endif
|
||||
FILE *fil;
|
||||
int32_t bv = BYTEVERSION;
|
||||
|
||||
|
@ -1065,56 +1041,8 @@ int32_t G_SavePlayer(int32_t spot)
|
|||
dfwrite(&actorLoadEventScrptr[0],sizeof(actorLoadEventScrptr[0]),MAXTILES,fil);
|
||||
G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_BACK_NON0);
|
||||
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
scriptptrs = Bcalloc(1, MAXSPRITES * sizeof(scriptptrs));
|
||||
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
{
|
||||
scriptptrs[i] = 0;
|
||||
|
||||
if (actorscrptr[PN] == 0) continue;
|
||||
|
||||
j = (intptr_t)&script[0];
|
||||
|
||||
if (T2 >= j && T2 < (intptr_t)(&script[g_scriptSize]))
|
||||
{
|
||||
scriptptrs[i] |= 1;
|
||||
T2 -= j;
|
||||
}
|
||||
if (T5 >= j && T5 < (intptr_t)(&script[g_scriptSize]))
|
||||
{
|
||||
scriptptrs[i] |= 2;
|
||||
T5 -= j;
|
||||
}
|
||||
if (T6 >= j && T6 < (intptr_t)(&script[g_scriptSize]))
|
||||
{
|
||||
scriptptrs[i] |= 4;
|
||||
T6 -= j;
|
||||
}
|
||||
}
|
||||
|
||||
dfwrite(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil);
|
||||
#endif
|
||||
|
||||
dfwrite(&actor[0],sizeof(actor_t),MAXSPRITES,fil);
|
||||
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
{
|
||||
if (actorscrptr[PN] == 0) continue;
|
||||
j = (intptr_t)&script[0];
|
||||
|
||||
if (scriptptrs[i]&1)
|
||||
T2 += j;
|
||||
if (scriptptrs[i]&2)
|
||||
T5 += j;
|
||||
if (scriptptrs[i]&4)
|
||||
T6 += j;
|
||||
}
|
||||
|
||||
Bfree(scriptptrs);
|
||||
#endif
|
||||
|
||||
dfwrite(&lockclock,sizeof(lockclock),1,fil);
|
||||
dfwrite(&pskybits,sizeof(pskybits),1,fil);
|
||||
dfwrite(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil);
|
||||
|
@ -1656,9 +1584,6 @@ static void sv_restload();
|
|||
((sizeof(g_player[0].user_name)+sizeof(g_player[0].pcolor)+sizeof(g_player[0].pteam) \
|
||||
+sizeof(g_player[0].frags)+sizeof(DukePlayer_t))*MAXPLAYERS + sizeof(_prlight)*PR_MAXLIGHTS + sizeof(lightcount))
|
||||
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
static uint8_t savegame_bitmap[MAXSPRITES>>3][3];
|
||||
#endif
|
||||
static uint32_t savegame_bitptrsize;
|
||||
static uint8_t savegame_quotedef[MAXQUOTES>>3];
|
||||
static char(*savegame_quotes)[MAXQUOTELEN];
|
||||
|
@ -1770,9 +1695,6 @@ static const dataspec_t svgm_script[] =
|
|||
{ DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)&sv_postscript_once, 0, 1 },
|
||||
|
||||
{ DS_SAVEFN, (void *)&sv_preactordatasave, 0, 1 },
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
{ 0, &savegame_bitmap, sizeof(savegame_bitmap), 1 },
|
||||
#endif
|
||||
{ 0, &actor[0], sizeof(actor_t), MAXSPRITES },
|
||||
{ DS_SAVEFN|DS_LOADFN, (void *)&sv_postactordata, 0, 1 },
|
||||
|
||||
|
@ -2306,21 +2228,11 @@ static void sv_postscript_once()
|
|||
static void sv_preactordatasave()
|
||||
{
|
||||
int32_t i;
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
intptr_t j=(intptr_t)&script[0], k=(intptr_t)&script[g_scriptSize];
|
||||
Bmemset(savegame_bitmap, 0, sizeof(savegame_bitmap));
|
||||
#endif
|
||||
|
||||
for (i=0; i<MAXSPRITES; i++)
|
||||
{
|
||||
actor[i].lightptr = NULL;
|
||||
actor[i].lightId = -1;
|
||||
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if (sprite[i].statnum==MAXSTATUS || actorscrptr[PN]==NULL) continue;
|
||||
if (T2 >= j && T2 < k) savegame_bitmap[i>>3][0] |= 1<<(i&7), T2 -= j;
|
||||
if (T5 >= j && T5 < k) savegame_bitmap[i>>3][1] |= 1<<(i&7), T5 -= j;
|
||||
if (T6 >= j && T6 < k) savegame_bitmap[i>>3][2] |= 1<<(i&7), T6 -= j;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2337,13 +2249,6 @@ static void sv_postactordata()
|
|||
{
|
||||
actor[i].lightptr = NULL;
|
||||
actor[i].lightId = -1;
|
||||
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
if (sprite[i].statnum==MAXSTATUS || actorscrptr[PN]==NULL) continue;
|
||||
if (savegame_bitmap[i>>3][0]&(1<<(i&7))) T2 += (intptr_t)script;
|
||||
if (savegame_bitmap[i>>3][1]&(1<<(i&7))) T5 += (intptr_t)script;
|
||||
if (savegame_bitmap[i>>3][2]&(1<<(i&7))) T6 += (intptr_t)script;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,9 +65,7 @@ typedef struct {
|
|||
|
||||
uint8_t g_earthquakeTime;
|
||||
uint8_t g_numPlayerSprites;
|
||||
#if !defined SAMESIZE_ACTOR_T
|
||||
uint8_t scriptptrs[MAXSPRITES];
|
||||
#endif
|
||||
|
||||
uint8_t show2dsector[(MAXSECTORS+7)>>3];
|
||||
|
||||
actor_t actor[MAXSPRITES];
|
||||
|
|
Loading…
Reference in a new issue