- step 1.

This commit is contained in:
Christoph Oelckers 2020-05-14 19:23:36 +02:00
parent 18d6a8e65d
commit 1b135ecb0b
11 changed files with 693 additions and 886 deletions

View file

@ -4181,4 +4181,61 @@ void fall_d(int g_i, int g_p)
fall_common(g_i, g_p, JIBS6, DRONE, BLOODPOOL, SHOTSPARK1, SQUISHED, THUD, nullptr, falladjustz);
}
bool spawnweapondebris_d(int picnum, int dnum)
{
return picnum == BLIMP && dnum == SCRAP1;
}
void respawnhitag_d(spritetype* g_sp)
{
switch (g_sp->picnum)
{
case FEM1:
case FEM2:
case FEM3:
case FEM4:
case FEM5:
case FEM6:
case FEM7:
case FEM8:
case FEM9:
case FEM10:
case PODFEM1:
case NAKED1:
case STATUE:
if (g_sp->yvel) fi.operaterespawns(g_sp->yvel);
break;
default:
if (g_sp->hitag >= 0) fi.operaterespawns(g_sp->hitag);
break;
}
}
void checktimetosleep_d(int g_i)
{
auto g_sp = &sprite[g_i];
if (g_sp->statnum == 6)
{
switch (g_sp->picnum)
{
case RUBBERCAN:
case EXPLODINGBARREL:
case WOODENHORSE:
case HORSEONSIDE:
case CANWITHSOMETHING:
case FIREBARREL:
case NUKEBARREL:
case NUKEBARRELDENTED:
case NUKEBARRELLEAKED:
case TRIPBOMB:
case EGG:
if (hittype[g_i].timetosleep > 1)
hittype[g_i].timetosleep--;
else if (hittype[g_i].timetosleep == 1)
changespritestat(g_i, 2);
break;
}
}
}
END_DUKE_NS

View file

@ -4614,4 +4614,53 @@ void mamaspawn(int g_i)
spawn(g_i, RABBIT);
}
}
bool spawnweapondebris_r(int picnum, int dnum)
{
return dnum == SCRAP1;
}
void respawnhitag_r(spritetype* g_sp)
{
switch (g_sp->picnum)
{
case FEM10:
case NAKED1:
case STATUE:
if (g_sp->yvel) fi.operaterespawns(g_sp->yvel);
break;
default:
if (g_sp->hitag >= 0) fi.operaterespawns(g_sp->hitag);
break;
}
}
void checktimetosleep_r(int g_i)
{
auto g_sp = &sprite[g_i];
if (g_sp->statnum == 6)
{
switch (g_sp->picnum)
{
case RUBBERCAN:
case EXPLODINGBARREL:
case WOODENHORSE:
case HORSEONSIDE:
case CANWITHSOMETHING:
case FIREBARREL:
case NUKEBARREL:
case NUKEBARRELDENTED:
case NUKEBARRELLEAKED:
case TRIPBOMB:
case EGG:
if (hittype[g_i].timetosleep > 1)
hittype[g_i].timetosleep--;
else if (hittype[g_i].timetosleep == 1)
changespritestat(g_i, 2);
break;
}
}
}
END_DUKE_NS

View file

@ -78,6 +78,14 @@ int ifhitbyweapon_r(int sn);
int ifhitbyweapon_d(int sn);
void fall_d(int g_i, int g_p);
void fall_r(int g_i, int g_p);
bool spawnweapondebris_d(int picnum, int dnum);
bool spawnweapondebris_r(int picnum, int dnum);
void respawnhitag_d(spritetype* g_sp);
void respawnhitag_r(spritetype* g_sp);
void checktimetosleep_d(int g_i);
void checktimetosleep_r(int g_i);
void move_d(int g_i, int g_p, int g_x);
void move_r(int g_i, int g_p, int g_x);
Dispatcher fi;
@ -110,7 +118,11 @@ void SetDispatcher()
gutsdir_d,
ifhitsectors_d,
ifhitbyweapon_d,
fall_d
fall_d,
spawnweapondebris_d,
respawnhitag_d,
checktimetosleep_d,
move_d
};
}
else
@ -140,7 +152,11 @@ void SetDispatcher()
gutsdir_r,
ifhitsectors_r,
ifhitbyweapon_r,
fall_r
fall_r,
spawnweapondebris_r,
respawnhitag_r,
checktimetosleep_r,
move_r,
};
}
}

View file

@ -224,6 +224,10 @@ extern int32_t voting;
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
int32_t A_CheckInventorySprite(spritetype *s);
inline int inventory(spritetype* S)
{
return A_CheckInventorySprite(S);
}
int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z, int16_t s_pn, int8_t s_s, uint8_t s_xr,
uint8_t s_yr, int16_t s_a, int16_t s_ve, int16_t s_zv, int16_t s_ow, int16_t s_ss);
#define EGS A_InsertSprite
@ -473,6 +477,12 @@ struct Dispatcher
int (*ifhitsectors)(int sectnum);
int (*ifhitbyweapon)(int sectnum);
void (*fall)(int g_i, int g_p);
bool (*spawnweapondebris)(int picnum, int dnum);
void (*respawnhitag)(spritetype* g_sp);
void (*checktimetosleep)(int g_i);
void (*move)(int g_i, int g_p, int g_x);
};
extern Dispatcher fi;

View file

@ -47,19 +47,21 @@ int* g_t;
uint8_t killit_flag;
spritetype* g_sp;
char parse(void);
int parse(void);
int furthestcanseepoint(int i, spritetype* ts, int* dax, int* day);
bool ifsquished(int i, int p);
void fakebubbaspawn(int g_i, int g_p);
void tearitup(int sect);
void destroyit(int g_i);
void mamaspawn(int g_i);
void forceplayerangle(DukePlayer_t* p);
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void VM_Execute(native_t loop);
void parseifelse(int condition)
{
@ -67,7 +69,11 @@ void parseifelse(int condition)
{
// skip 'else' pointer.. and...
insptr+=2;
#if 0
parse();
#else
VM_Execute(0);
#endif
}
else
{
@ -79,7 +85,11 @@ void parseifelse(int condition)
// skip 'else' and...
insptr+=2;
#if 0
parse();
#else
VM_Execute(0);
#endif
}
}
}
@ -220,7 +230,7 @@ static bool ifcansee(int g_i, int g_p)
// int *it = 0x00589a04;
char parse(void)
int parse(void)
{
int j, l, s;
@ -827,7 +837,11 @@ char parse(void)
break;
case concmd_leftbrace:
insptr++;
#if 0
while (1) if (parse()) break;
#else
VM_Execute(1);
#endif
break;
case concmd_move:
g_t[0]=0;
@ -866,7 +880,6 @@ char parse(void)
insptr++;
g_t[2] = 0;
break;
#if 0
case concmd_debris:
{
short dnum;
@ -874,20 +887,20 @@ char parse(void)
insptr++;
dnum = *insptr;
insptr++;
bool weap = fi.spawnweapondebris(g_sp->picnum, dnum);
if(g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS)
for(j=(*insptr)-1;j>=0;j--)
{
if(g_sp->picnum == BLIMP && dnum == SCRAP1)
if(weap)
s = 0;
else s = (krand()%3);
l = EGS(g_sp->sectnum,
g_sp->x + (krand() & 255) - 128, g_sp->y + (krand() & 255) - 128, g_sp->z - (8 << 8) - (krand() & 8191),
dnum + s, g_sp->shade, 32 + (krand() & 15), 32 + (krand() & 15),
krand()&2047,(krand()&127)+32,
-(krand()&2047),g_i,5);
if(g_sp->picnum == BLIMP && dnum == SCRAP1)
krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), g_i, 5);
if(weap)
sprite[l].yvel = weaponsandammosprites[j%14];
else sprite[l].yvel = -1;
sprite[l].pal = g_sp->pal;
@ -895,147 +908,103 @@ char parse(void)
insptr++;
}
break;
case 52:
case concmd_count:
insptr++;
g_t[0] = (short) *insptr;
insptr++;
break;
case 101:
case concmd_cstator:
insptr++;
g_sp->cstat |= (short)*insptr;
insptr++;
break;
case 110:
case concmd_clipdist:
insptr++;
g_sp->clipdist = (short) *insptr;
insptr++;
break;
case 40:
case concmd_cstat:
insptr++;
g_sp->cstat = (short) *insptr;
insptr++;
break;
case 41:
case concmd_newpic:
insptr++;
g_sp->picnum = (short)*insptr;
insptr++;
break;
case concmd_ifmove:
insptr++;
parseifelse(g_t[1] == *insptr);
break;
case 42:
case concmd_resetplayer:
insptr++;
//AddLog("resetplayer");
if(ud.multimode < 2)
{
#if 0
if( lastsavedpos >= 0 && ud.recstat != 2 )
{
ps[g_p].gm = MODE_MENU;
KB_ClearKeyDown(sc_Space);
cmenu(15000);
}
else ps[g_p].gm = MODE_RESTART;
else
#endif
ps[g_p].gm = MODE_RESTART;
killit_flag = 2;
}
else
{
pickrandomspot(g_p);
g_sp->x = hittype[g_i].bposx = ps[g_p].bobposx = ps[g_p].oposx = ps[g_p].posx;
g_sp->y = hittype[g_i].bposy = ps[g_p].bobposy = ps[g_p].oposy =ps[g_p].posy;
g_sp->z = hittype[g_i].bposy = ps[g_p].oposz =ps[g_p].posz;
updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum);
setsprite(ps[g_p].i,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+PHEIGHT);
g_sp->cstat = 257;
g_sp->shade = -12;
g_sp->clipdist = 64;
g_sp->xrepeat = 42;
g_sp->yrepeat = 36;
g_sp->owner = g_i;
g_sp->xoffset = 0;
g_sp->pal = ps[g_p].palookup;
ps[g_p].last_extra = g_sp->extra = max_player_health;
ps[g_p].wantweaponfire = -1;
ps[g_p].horiz = 100;
ps[g_p].on_crane = -1;
ps[g_p].frag_ps = g_p;
ps[g_p].horizoff = 0;
ps[g_p].opyoff = 0;
ps[g_p].wackedbyactor = -1;
ps[g_p].shield_amount = max_armour_amount;
ps[g_p].dead_flag = 0;
ps[g_p].pals_time = 0;
ps[g_p].footprintcount = 0;
ps[g_p].weapreccnt = 0;
ps[g_p].fta = 0;
ps[g_p].ftq = 0;
ps[g_p].posxv = ps[g_p].posyv = 0;
ps[g_p].rotscrnang = 0;
ps[g_p].falling_counter = 0;
hittype[g_i].extra = -1;
hittype[g_i].owner = g_i;
hittype[g_i].cgg = 0;
hittype[g_i].movflag = 0;
hittype[g_i].tempang = 0;
hittype[g_i].actorstayput = -1;
hittype[g_i].dispicnum = 0;
hittype[g_i].owner = ps[g_p].i;
resetinventory(g_p);
resetweapons(g_p);
cameradist = 0;
cameraclock = totalclock;
// I am not convinced this is even remotely smart to be executed from here...
P_ResetPlayer(g_p);
}
setpal(&ps[g_p]);
//AddLog("EOF: resetplayer");
break;
case 130:
case concmd_ifcoop:
parseifelse(ud.coop || numplayers > 2);
break;
case 129:
parseifelse(abs(g_sp->z - sector[g_sp->sectnum].floorz) < (32 << 8) && sector[g_sp->sectnum].floorpicnum == 3073);
case concmd_ifonmud:
parseifelse(abs(g_sp->z - sector[g_sp->sectnum].floorz) < (32 << 8) && sector[g_sp->sectnum].floorpicnum == 3073); // eew, hard coded tile numbers... :?
break;
case 43:
parseifelse( abs(g_sp->z-sector[g_sp->sectnum].floorz) < (32<<8) && sector[g_sp->sectnum].lotag == 1);
case concmd_ifonwater:
parseifelse( abs(g_sp->z-sector[g_sp->sectnum].floorz) < (32<<8) && sector[g_sp->sectnum].lotag == ST_1_ABOVE_WATER);
break;
#ifdef RRRA
case 131:
case concmd_ifmotofast:
parseifelse(ps[g_p].MotoSpeed > 60);
break;
case 134:
case concmd_ifonmoto:
parseifelse(ps[g_p].OnMotorcycle == 1);
break;
case 135:
case concmd_ifonboat:
parseifelse(ps[g_p].OnBoat == 1);
break;
case 145:
case concmd_ifsizedown:
g_sp->xrepeat--;
g_sp->yrepeat--;
parseifelse(g_sp->xrepeat <= 5);
break;
case 132:
case concmd_ifwind:
parseifelse(WindTime > 0);
break;
#endif
case 44:
case concmd_ifinwater:
parseifelse( sector[g_sp->sectnum].lotag == 2);
break;
case 46:
case concmd_ifcount:
insptr++;
parseifelse(g_t[0] >= *insptr);
break;
case 53:
case concmd_ifactor:
insptr++;
parseifelse(g_sp->picnum == *insptr);
break;
case 47:
case concmd_resetcount:
insptr++;
g_t[0] = 0;
break;
case 48:
case concmd_addinventory:
insptr+=2;
switch(*(insptr-1))
{
@ -1061,12 +1030,25 @@ char parse(void)
ps[g_p].inven_icon = 4;
break;
case 6:
if (isRR())
{
switch (g_sp->lotag)
{
case 100: ps[g_p].keys[1] = 1; break;
case 101: ps[g_p].keys[2] = 1; break;
case 102: ps[g_p].keys[3] = 1; break;
case 103: ps[g_p].keys[4] = 1; break;
}
}
else
{
switch (g_sp->pal)
{
case 0: ps[g_p].got_access |= 1; break;
case 21: ps[g_p].got_access |= 2; break;
case 23: ps[g_p].got_access |= 4; break;
}
}
break;
case 7:
ps[g_p].heat_amount = *insptr;
@ -1083,11 +1065,11 @@ char parse(void)
}
insptr++;
break;
case 50:
case concmd_hitradius:
fi.hitradius(g_i,*(insptr+1),*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5));
insptr+=6;
break;
case 51:
case concmd_ifp:
{
insptr++;
@ -1096,45 +1078,45 @@ char parse(void)
s = g_sp->xvel;
if( (l&8) && ps[g_p].on_ground && (sync[g_p].bits&2) )
// sigh... this was yet another place where number literals were used as bit masks for every single value, making the code totally unreadable.
if( (l& pducking) && ps[g_p].on_ground && (PlayerInput(g_p, SK_CROUCH) ^ !!(ps[g_p].crouch_toggle) ))
j = 1;
else if( (l&16) && ps[g_p].jumping_counter == 0 && !ps[g_p].on_ground &&
ps[g_p].poszv > 2048 )
else if( (l& pfalling) && ps[g_p].jumping_counter == 0 && !ps[g_p].on_ground && ps[g_p].poszv > 2048 )
j = 1;
else if( (l&32) && ps[g_p].jumping_counter > 348 )
else if( (l& pjumping) && ps[g_p].jumping_counter > 348 )
j = 1;
else if( (l&1) && s >= 0 && s < 8)
else if( (l& pstanding) && s >= 0 && s < 8)
j = 1;
else if( (l&2) && s >= 8 && !(sync[g_p].bits&(1<<5)) )
else if( (l& pwalking) && s >= 8 && !(PlayerInput(g_p, SK_RUN)) )
j = 1;
else if( (l&4) && s >= 8 && sync[g_p].bits&(1<<5) )
else if( (l& prunning) && s >= 8 && PlayerInput(g_p, SK_RUN) )
j = 1;
else if( (l&64) && ps[g_p].posz < (g_sp->z-(48<<8)) )
else if( (l& phigher) && ps[g_p].posz < (g_sp->z-(48<<8)) )
j = 1;
else if( (l&128) && s <= -8 && !(sync[g_p].bits&(1<<5)) )
else if( (l& pwalkingback) && s <= -8 && !(PlayerInput(g_p, SK_RUN)) )
j = 1;
else if( (l&256) && s <= -8 && (sync[g_p].bits&(1<<5)) )
else if( (l& prunningback) && s <= -8 && (PlayerInput(g_p, SK_RUN)) )
j = 1;
else if( (l&512) && ( ps[g_p].quick_kick > 0 || ( ps[g_p].curr_weapon == KNEE_WEAPON && ps[g_p].kickback_pic > 0 ) ) )
else if( (l& pkicking) && ( ps[g_p].quick_kick > 0 || ( ps[g_p].curr_weapon == KNEE_WEAPON && ps[g_p].kickback_pic > 0 ) ) )
j = 1;
else if( (l&1024) && sprite[ps[g_p].i].xrepeat < 32 )
else if( (l& pshrunk) && sprite[ps[g_p].i].xrepeat < (isRR() ? 8 : 32))
j = 1;
else if( (l&2048) && ps[g_p].jetpack_on )
else if( (l& pjetpack) && ps[g_p].jetpack_on )
j = 1;
else if( (l&4096) && ps[g_p].steroids_amount > 0 && ps[g_p].steroids_amount < 400 )
else if( (l& ponsteroids) && ps[g_p].steroids_amount > 0 && ps[g_p].steroids_amount < 400 )
j = 1;
else if( (l&8192) && ps[g_p].on_ground)
else if( (l& ponground) && ps[g_p].on_ground)
j = 1;
else if( (l&16384) && sprite[ps[g_p].i].xrepeat > 32 && sprite[ps[g_p].i].extra > 0 && ps[g_p].timebeforeexit == 0 )
else if( (l& palive) && sprite[ps[g_p].i].xrepeat > (isRR() ? 8 : 32) && sprite[ps[g_p].i].extra > 0 && ps[g_p].timebeforeexit == 0 )
j = 1;
else if( (l&32768) && sprite[ps[g_p].i].extra <= 0)
else if( (l& pdead) && sprite[ps[g_p].i].extra <= 0)
j = 1;
else if( (l&65536L) )
else if( (l& pfacing) )
{
if (g_sp->picnum == APLAYER && ud.multimode > 1)
j = getincangle(ps[otherp].ang,getangle(ps[g_p].posx-ps[otherp].posx,ps[g_p].posy-ps[otherp].posy));
j = getincangle(ps[otherp].getang(), getangle(ps[g_p].posx - ps[otherp].posx, ps[g_p].posy - ps[otherp].posy));
else
j = getincangle(ps[g_p].ang,getangle(g_sp->x-ps[g_p].posx,g_sp->y-ps[g_p].posy));
j = getincangle(ps[g_p].getang(), getangle(g_sp->x - ps[g_p].posx, g_sp->y - ps[g_p].posy));
if( j > -128 && j < 128 )
j = 1;
@ -1146,53 +1128,55 @@ char parse(void)
}
break;
case 56:
case concmd_ifstrength:
insptr++;
parseifelse(g_sp->extra <= *insptr);
break;
case 58:
case concmd_guts:
insptr += 2;
fi.guts(g_sp,*(insptr-1),*insptr,g_p);
insptr++;
break;
case 121:
case concmd_slapplayer:
insptr++;
forceplayerangle(&ps[g_p]);
ps[g_p].posxv -= sintable[(ps[g_p].ang + 512) & 2047] << 7;
ps[g_p].posyv -= sintable[ps[g_p].ang & 2047] << 7;
ps[g_p].posxv -= sintable[(ps[g_p].getang() + 512) & 2047] << 7;
ps[g_p].posyv -= sintable[ps[g_p].getang() & 2047] << 7;
return 0;
case 61:
case concmd_wackplayer:
insptr++;
if (!isRR())
forceplayerangle(&ps[g_p]);
else
{
ps[g_p].posxv -= sintable[(ps[g_p].ang + 512) & 2047] << 10;
ps[g_p].posyv -= sintable[ps[g_p].ang & 2047] << 10;
ps[g_p].posxv -= sintable[(ps[g_p].getang() + 512) & 2047] << 10;
ps[g_p].posyv -= sintable[ps[g_p].getang() & 2047] << 10;
ps[g_p].jumping_counter = 767;
ps[g_p].jumping_toggle = 1;
}
return 0;
case 62:
case concmd_ifgapzl:
insptr++;
parseifelse( (( hittype[g_i].floorz - hittype[g_i].ceilingz ) >> 8 ) < *insptr);
break;
case 63:
parseifelse( sync[g_p].bits&(1<<29));
case concmd_ifhitspace:
parseifelse(PlayerInput(g_p, SK_OPEN));
break;
case 64:
case concmd_ifoutside:
parseifelse(sector[g_sp->sectnum].ceilingstat & 1);
break;
case 65:
case concmd_ifmultiplayer:
parseifelse(ud.multimode > 1);
break;
case 66:
case concmd_operate:
insptr++;
if( sector[g_sp->sectnum].lotag == 0 )
{
int16_t neartagsector, neartagwall, neartagsprite;
int32_t neartaghitdist;
neartag(g_sp->x,g_sp->y,g_sp->z-(32<<8),g_sp->sectnum,g_sp->ang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,768L,1);
if( neartagsector >= 0 && isanearoperator(sector[neartagsector].lotag) )
if( (sector[neartagsector].lotag&0xff) == 23 || sector[neartagsector].floorz == sector[neartagsector].ceilingz )
if( (sector[neartagsector].lotag&0xff) == ST_23_SWINGING_DOOR || sector[neartagsector].floorz == sector[neartagsector].ceilingz )
if( (sector[neartagsector].lotag&16384) == 0 )
if( (sector[neartagsector].lotag&32768) == 0 )
{
@ -1208,11 +1192,11 @@ char parse(void)
}
}
break;
case 67:
case concmd_ifinspace:
parseifelse(fi.ceilingspace(g_sp->sectnum));
break;
case 74:
case concmd_spritepal:
insptr++;
if(g_sp->picnum != APLAYER)
hittype[g_i].tempang = g_sp->pal;
@ -1220,16 +1204,16 @@ char parse(void)
insptr++;
break;
case 77:
case concmd_cactor:
insptr++;
g_sp->picnum = *insptr;
insptr++;
break;
case 70:
case concmd_ifbulletnear:
parseifelse( dodge(g_sp) == 1);
break;
case 71:
case concmd_ifrespawn:
if( badguy(g_sp) )
parseifelse( ud.respawn_monsters );
else if( inventory(g_sp) )
@ -1237,26 +1221,18 @@ char parse(void)
else
parseifelse( ud.respawn_items );
break;
case 72:
case concmd_iffloordistl:
insptr++;
// getglobalz(g_i);
parseifelse( (hittype[g_i].floorz - g_sp->z) <= ((*insptr)<<8));
break;
case 73:
case concmd_ifceilingdistl:
insptr++;
// getglobalz(g_i);
parseifelse( ( g_sp->z - hittype[g_i].ceilingz ) <= ((*insptr)<<8));
break;
case 14:
case concmd_palfrom:
insptr++;
ps[g_p].pals_time = *insptr;
insptr++;
for(j=0;j<3;j++)
{
ps[g_p].pals[j] = *insptr;
insptr++;
}
SetPlayerPal(&ps[g_p], PalEntry(insptr[0], insptr[1], insptr[2], insptr[3]));
insptr += 4;
break;
/* case 74:
@ -1265,19 +1241,17 @@ char parse(void)
parseifelse( (( hittype[g_i].floorz - hittype[g_i].ceilingz ) >> 8 ) >= *insptr);
break;
*/
case CON_ADDLOG:
case concmd_addlog:
{ int l;
int lFile;
insptr++;
lFile=*(insptr++); // file
l=*(insptr++); // line
sprintf(g_szBuf,"ADDLOG: %s L=%ld",g_achSourceFiles[lFile],l);
AddLog(g_szBuf);
// this was only printing file name and line number as debug output.
break;
}
case CON_ADDLOGVAR:
case concmd_addlogvar:
{ int l;
char szBuf[256];
int lFile;
insptr++;
lFile=*(insptr++); // file
@ -1290,34 +1264,29 @@ char parse(void)
insptr++;
break; // out of switch
}
sprintf(szBuf,"ADDLOGVAR: %s L=%ld %s ",g_achSourceFiles[lFile],l, aGameVars[*insptr].szLabel);
strcpy(g_szBuf,szBuf);
DPrintf(DMSG_NOTIFY, "ADDLOGVAR: ");
if( aGameVars[*insptr].dwFlags & GAMEVAR_FLAG_READONLY)
{
sprintf(szBuf," (read-only)");
strcat(g_szBuf,szBuf);
DPrintf(DMSG_NOTIFY, " (read-only)");
}
if( aGameVars[*insptr].dwFlags & GAMEVAR_FLAG_PERPLAYER)
{
sprintf(szBuf," (Per Player. Player=%d)",g_p);
DPrintf(DMSG_NOTIFY, " (Per Player. Player=%d)",g_p);
}
else if( aGameVars[*insptr].dwFlags & GAMEVAR_FLAG_PERACTOR)
{
sprintf(szBuf," (Per Actor. Actor=%d)",g_i);
DPrintf(DMSG_NOTIFY, " (Per Actor. Actor=%d)",g_i);
}
else
{
sprintf(szBuf," (Global)");
DPrintf(DMSG_NOTIFY, " (Global)");
}
strcat(g_szBuf,szBuf);
sprintf(szBuf," =%ld", GetGameVarID(*insptr, g_i, g_p));
strcat(g_szBuf,szBuf);
AddLog(g_szBuf);
DPrintf(DMSG_NOTIFY, " =%ld", GetGameVarID(*insptr, g_i, g_p));
insptr++;
break;
}
case CON_SETVAR:
case concmd_setvar:
{ int i;
insptr++;
i=*(insptr++); // ID of def
@ -1325,7 +1294,7 @@ char parse(void)
insptr++;
break;
}
case CON_SETVARVAR:
case concmd_setvarvar:
{ int i;
insptr++;
i=*(insptr++); // ID of def
@ -1334,7 +1303,7 @@ char parse(void)
insptr++;
break;
}
case CON_ADDVAR:
case concmd_addvar:
{ int i;
insptr++;
i=*(insptr++); // ID of def
@ -1345,7 +1314,7 @@ char parse(void)
break;
}
case CON_ADDVARVAR:
case concmd_addvarvar:
{ int i;
insptr++;
i=*(insptr++); // ID of def
@ -1353,7 +1322,7 @@ char parse(void)
insptr++;
break;
}
case CON_IFVARVARE:
case concmd_ifvarvare:
{
int i;
insptr++;
@ -1366,7 +1335,7 @@ char parse(void)
parseifelse( j );
break;
}
case CON_IFVARVARG:
case concmd_ifvarvarg:
{
int i;
insptr++;
@ -1379,7 +1348,7 @@ char parse(void)
parseifelse( j );
break;
}
case CON_IFVARVARL:
case concmd_ifvarvarl:
{
int i;
insptr++;
@ -1392,7 +1361,7 @@ char parse(void)
parseifelse( j );
break;
}
case CON_IFVARE:
case concmd_ifvare:
{
int i;
insptr++;
@ -1405,7 +1374,7 @@ char parse(void)
parseifelse( j );
break;
}
case CON_IFVARG:
case concmd_ifvarg:
{
int i;
insptr++;
@ -1418,7 +1387,7 @@ char parse(void)
parseifelse( j );
break;
}
case CON_IFVARL:
case concmd_ifvarl:
{
int i;
insptr++;
@ -1431,12 +1400,12 @@ char parse(void)
parseifelse( j );
break;
}
case 78:
case concmd_ifphealthl:
insptr++;
parseifelse( sprite[ps[g_p].i].extra < *insptr);
break;
case 75:
case concmd_ifpinventory:
{
insptr++;
j = 0;
@ -1452,12 +1421,25 @@ char parse(void)
case 3:if(ps[g_p].holoduke_amount != *insptr) j = 1;break;
case 4:if(ps[g_p].jetpack_amount != *insptr) j = 1;break;
case 6:
if (isRR())
{
switch (g_sp->lotag)
{
case 100: if (ps[g_p].keys[1]) j = 1; break;
case 101: if (ps[g_p].keys[2]) j = 1; break;
case 102: if (ps[g_p].keys[3]) j = 1; break;
case 103: if (ps[g_p].keys[4]) j = 1; break;
}
}
else
{
switch (g_sp->pal)
{
case 0: if (ps[g_p].got_access & 1) j = 1; break;
case 21: if (ps[g_p].got_access & 2) j = 1; break;
case 23: if (ps[g_p].got_access & 4) j = 1; break;
}
}
break;
case 7:if(ps[g_p].heat_amount != *insptr) j = 1;break;
case 9:
@ -1469,9 +1451,9 @@ char parse(void)
parseifelse(j);
break;
}
case 38:
case concmd_pstomp:
insptr++;
if( ps[g_p].knee_incs == 0 && sprite[ps[g_p].i].xrepeat >= 40 )
if( ps[g_p].knee_incs == 0 && sprite[ps[g_p].i].xrepeat >= (isRR()? 9: 40) )
if( cansee(g_sp->x,g_sp->y,g_sp->z-(4<<8),g_sp->sectnum,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+(16<<8),sprite[ps[g_p].i].sectnum) )
{
ps[g_p].knee_incs = 1;
@ -1480,7 +1462,7 @@ char parse(void)
ps[g_p].actorsqu = g_i;
}
break;
case 90:
case concmd_ifawayfromwall:
{
short s1;
@ -1504,164 +1486,55 @@ char parse(void)
}
}
parseifelse(j);
break;
}
break;
case 80:
case concmd_quote:
insptr++;
FTA(*insptr,&ps[g_p]);
insptr++;
break;
case 81:
case concmd_ifinouterspace:
parseifelse( fi.floorspace(g_sp->sectnum));
break;
case 82:
case concmd_ifnotmoving:
parseifelse( (hittype[g_i].movflag&49152) > 16384 );
break;
case 83:
case concmd_respawnhitag:
insptr++;
switch(g_sp->picnum)
{
case FEM1:
case FEM2:
case FEM3:
case FEM4:
case FEM5:
case FEM6:
case FEM7:
case FEM8:
case FEM9:
case FEM10:
case PODFEM1:
case NAKED1:
case STATUE:
if(g_sp->yvel) fi.operaterespawns(g_sp->yvel);
fi.respawnhitag(g_sp);
break;
default:
if(g_sp->hitag >= 0) fi.operaterespawns(g_sp->hitag);
break;
}
break;
case 85:
case concmd_ifspritepal:
insptr++;
parseifelse( g_sp->pal == *insptr);
break;
case 111:
case concmd_ifangdiffl:
insptr++;
j = abs(getincangle(ps[g_p].ang,g_sp->ang));
j = abs(getincangle(ps[g_p].getang(),g_sp->ang));
parseifelse( j <= *insptr);
break;
case 109:
for(j=1;j<NUM_SOUNDS;j++)
if( SoundOwner[j][0].i == g_i )
case concmd_ifnosounds:
parseifelse(!A_CheckAnySoundPlaying(vm.spriteNum) );
break;
parseifelse( j == NUM_SOUNDS );
case concmd_ifplaybackon: //Twentieth Anniversary World Tour
parseifelse(false);
break;
#endif
default:
#ifdef WW2
sprintf(g_szBuf,"Unrecognized PCode of %ld in parse. Killing current sprite.",*insptr);
AddLog(g_szBuf);
sprintf(g_szBuf,"Offset=%0lX",scriptptr-script);
AddLog(g_szBuf);
#endif
Printf(TEXTCOLOR_RED "Unrecognized PCode of %ld in parse. Killing current sprite.\n",*insptr);
Printf(TEXTCOLOR_RED "Offset=%0lX\n",scriptptr-apScript);
killit_flag = 1;
break;
}
return 0;
}
void LoadActor(short i,short p,int x)
{
#if 0
char done;
g_i = i; // Sprite ID
g_p = p; // Player ID
g_x = x; // ??
g_sp = &sprite[g_i]; // Pointer to sprite structure
g_t = &hittype[g_i].temp_data[0]; // Sprite's 'extra' data
if( actorLoadEventScrptr[g_sp->picnum] == 0 ) return;
insptr = 4 + (actorLoadEventScrptr[g_sp->picnum]);
killit_flag = 0;
if(g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS)
{
// if(badguy(g_sp))
// ps[g_p].actors_killed++;
deletesprite(g_i);
return;
}
do
done = parse();
while( done == 0 );
if(killit_flag == 1)
{
// if player was set to squish, first stop that...
if (g_p >= 0 )
{
if(ps[g_p].actorsqu == g_i)
ps[g_p].actorsqu = -1;
}
deletesprite(g_i);
}
else
{
move();
if( g_sp->statnum == 1)
{
if( badguy(g_sp) )
{
if( g_sp->xrepeat > 60 ) return;
if( ud.respawn_monsters == 1 && g_sp->extra <= 0 ) return;
}
else if( ud.respawn_items == 1 && (g_sp->cstat&32768) ) return;
if(hittype[g_i].timetosleep > 1)
hittype[g_i].timetosleep--;
else if(hittype[g_i].timetosleep == 1)
changespritestat(g_i,2);
}
else if(g_sp->statnum == 6)
{
switch(g_sp->picnum)
{
case RUBBERCAN:
case EXPLODINGBARREL:
case WOODENHORSE:
case HORSEONSIDE:
case CANWITHSOMETHING:
case FIREBARREL:
case NUKEBARREL:
case NUKEBARRELDENTED:
case NUKEBARRELLEAKED:
case TRIPBOMB:
case EGG:
if(hittype[g_i].timetosleep > 1)
hittype[g_i].timetosleep--;
else if(hittype[g_i].timetosleep == 1)
changespritestat(g_i,2);
break;
}
}
}
#endif
}
void execute(short i,short p,int x)
{
#if 0
char done;
int done;
g_i = i; // Sprite ID
g_p = p; // Player ID
@ -1669,9 +1542,13 @@ void execute(short i,short p,int x)
g_sp = &sprite[g_i]; // Pointer to sprite structure
g_t = &hittype[g_i].temp_data[0]; // Sprite's 'extra' data
#if 1
if (!g_tile[vm.pSprite->picnum].execPtr) return;
insptr = 4 + (g_tile[vm.pSprite->picnum].execPtr);
#else
if( actorscrptr[g_sp->picnum] == 0 ) return;
insptr = 4 + (actorscrptr[g_sp->picnum]);
#endif
killit_flag = 0;
@ -1685,14 +1562,20 @@ void execute(short i,short p,int x)
if (g_t[4])
{
// This code was utterly cryptic in the original source.
auto ptr = apScript + g_t[4];
int numframes = ptr[1];
int increment = ptr[3];
int delay = ptr[4];
g_sp->lotag += TICSPERFRAME;
if(g_sp->lotag > *(int *)(g_t[4]+16) )
if (g_sp->lotag > delay)
{
g_t[2]++;
g_sp->lotag = 0;
g_t[3] += *(int *)( g_t[4]+12 );
g_t[3] += increment;
}
if( abs(g_t[3]) >= abs( *(int *)(g_t[4]+4) * *(int *)(g_t[4]+12) ) )
if (abs(g_t[3]) >= abs(numframes * delay))
g_t[3] = 0;
}
@ -1709,7 +1592,7 @@ void execute(short i,short p,int x)
}
else
{
move();
fi.move(g_i, g_p, g_x);
if (g_sp->statnum == 1)
{
@ -1726,29 +1609,10 @@ void execute(short i,short p,int x)
changespritestat(g_i, 2);
}
else if(g_sp->statnum == 6)
switch(g_sp->picnum)
{
case RUBBERCAN:
case EXPLODINGBARREL:
case WOODENHORSE:
case HORSEONSIDE:
case CANWITHSOMETHING:
case FIREBARREL:
case NUKEBARREL:
case NUKEBARRELDENTED:
case NUKEBARRELLEAKED:
case TRIPBOMB:
case EGG:
if(hittype[g_i].timetosleep > 1)
hittype[g_i].timetosleep--;
else if(hittype[g_i].timetosleep == 1)
changespritestat(g_i,2);
break;
else if (g_sp->statnum == STAT_STANDABLE)
fi.checktimetosleep(g_i);
}
}
#endif
}
END_DUKE_NS

View file

@ -216,7 +216,7 @@ struct msy_
G_EXTERN msx_ msx;
G_EXTERN msy_ msy;
G_EXTERN int32_t g_windTime, WindDir;
G_EXTERN int32_t WindTime, WindDir;
G_EXTERN int16_t fakebubba_spawn, mamaspawn_count, banjosound, g_bellTime, g_bellSprite;
#define BellTime g_bellTime
#define word_119BE0 g_bellSprite

View file

@ -278,6 +278,7 @@ typedef struct player_struct {
#define heat_amount inv_amount[GET_HEATS]
#define scuba_amount inv_amount[GET_SCUBA]
#define boot_amount inv_amount[GET_BOOTS]
#define shield_amount inv_amount[GET_SHIELD]
#define raat609 MamaEnd
#define raat5dd sea_sick_stat

View file

@ -74,7 +74,8 @@ int32_t g_aimAngleVarID = -1; // var ID of "AUTOAIMANGLE"
uint32_t g_actorCalls[MAXTILES];
double g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILES], g_actorMaxMs[MAXTILES];
GAMEEXEC_STATIC void VM_Execute(native_t loop);
void VM_Execute(native_t loop);
int parse();
#define VM_CONDITIONAL(xxx) \
{ \
@ -191,7 +192,7 @@ static int32_t VM_CheckSquished(void)
return ifsquished(vm.spriteNum, vm.playerNum);
}
GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *pPlayer)
void forceplayerangle(DukePlayer_t *pPlayer)
{
int const nAngle = 128-(krand2()&255);
@ -268,12 +269,10 @@ static int32_t VM_GetFlorZOfSlope(void)
////////////////////
static int32_t A_GetWaterZOffset(int spritenum);
void move_d(int g_i, int g_p, int g_x);
void move_r(int g_i, int g_p, int g_x);
GAMEEXEC_STATIC void VM_Move(void)
{
if (isRR()) move_r(vm.spriteNum, vm.playerNum, vm.playerDist); else move_d(vm.spriteNum, vm.playerNum, vm.playerDist);
fi.move(vm.spriteNum, vm.playerNum, vm.playerDist);
}
static void VM_AddWeapon(DukePlayer_t * const pPlayer, int const weaponNum, int const nAmount)
@ -337,8 +336,8 @@ static void VM_AddInventory(DukePlayer_t * const pPlayer, int const itemNum, int
case GET_SHIELD:
{
int16_t & shield_amount = pPlayer->inv_amount[GET_SHIELD];
shield_amount = min(shield_amount + nAmount, max_player_health);
int16_t & shieldamount = pPlayer->inv_amount[GET_SHIELD];
shieldamount = min(shieldamount + nAmount, max_player_health);
break;
}
@ -628,7 +627,9 @@ void Screen_Play(void)
} while (running);
}
GAMEEXEC_STATIC void VM_Execute(native_t loop)
extern uint8_t killit_flag;
void VM_Execute(native_t loop)
{
native_t tw = *insptr;
DukePlayer_t *const pPlayer = vm.pPlayer;
@ -650,192 +651,10 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
g_errorLineNum = tw >> 12;
g_tw = tw &= VM_INSTMASK;
if (tw == concmd_leftbrace)
{
insptr++, loop++;
continue;
}
else if (tw == concmd_rightbrace)
{
insptr++, loop--;
continue;
}
else if (tw == concmd_else)
{
insptr = apScript + *(insptr + 1);
continue;
}
else if (tw == concmd_state)
{
intptr_t const *const tempscrptr = insptr + 2;
insptr = apScript + *(insptr + 1);
VM_Execute(1);
insptr = tempscrptr;
continue;
}
switch (tw)
{
case concmd_enda:
case concmd_break:
case concmd_ends:
case concmd_endevent: return;
case concmd_ifrnd: VM_CONDITIONAL(rnd(*(++insptr))); continue;
case concmd_ifcanshoottarget:
{
if (vm.playerDist > 1024)
{
int16_t temphit;
if ((tw = hitasprite(vm.spriteNum, &temphit)) == (1 << 30))
{
VM_CONDITIONAL(1);
continue;
}
int dist = 768;
int angDiff = 16;
if (A_CheckEnemySprite(vm.pSprite) && vm.pSprite->xrepeat > 56)
{
dist = 3084;
angDiff = 48;
}
#define CHECK(x) \
if (x >= 0 && sprite[x].picnum == vm.pSprite->picnum) \
{ \
VM_CONDITIONAL(0); \
continue; \
}
#define CHECK2(x) \
do \
{ \
vm.pSprite->ang += x; \
tw = hitasprite(vm.spriteNum, &temphit); \
vm.pSprite->ang -= x; \
} while (0)
if (tw > dist)
{
CHECK(temphit);
CHECK2(angDiff);
if (tw > dist)
{
CHECK(temphit);
CHECK2(-angDiff);
if (tw > 768)
{
CHECK(temphit);
VM_CONDITIONAL(1);
continue;
}
}
}
VM_CONDITIONAL(0);
continue;
}
VM_CONDITIONAL(1);
}
continue;
case concmd_ifcanseetarget:
tw = cansee(vm.pSprite->x, vm.pSprite->y, vm.pSprite->z - ((krand2() & 41) << 8), vm.pSprite->sectnum, pPlayer->pos.x, pPlayer->pos.y,
pPlayer->pos.z /*-((krand2()&41)<<8)*/, sprite[pPlayer->i].sectnum);
VM_CONDITIONAL(tw);
if (tw)
vm.pActor->timetosleep = SLEEPTIME;
continue;
case concmd_ifnocover:
tw = cansee(vm.pSprite->x, vm.pSprite->y, vm.pSprite->z, vm.pSprite->sectnum, pPlayer->pos.x, pPlayer->pos.y,
pPlayer->pos.z, sprite[pPlayer->i].sectnum);
VM_CONDITIONAL(tw);
if (tw)
vm.pActor->timetosleep = SLEEPTIME;
continue;
case concmd_ifactornotstayput: VM_CONDITIONAL(vm.pActor->actorstayput == -1); continue;
case concmd_ifcansee:
{
uspritetype *pSprite = (uspritetype *)&sprite[pPlayer->i];
if (DEER)
{
if (sintable[vm.pSprite->ang&2047] * (pSprite->y - vm.pSprite->y) + sintable[(vm.pSprite->ang+512)&2047] * (pSprite->x - vm.pSprite->x) >= 0)
tw = cansee(vm.pSprite->x, vm.pSprite->y, vm.pSprite->z - (krand2() % 13312), vm.pSprite->sectnum,
pSprite->x, pSprite->y, pPlayer->opos.z-(krand2() % 8192), pPlayer->cursectnum);
else
tw = 0;
VM_CONDITIONAL(tw);
continue;
}
// select sprite for monster to target
// if holoduke is on, let them target holoduke first.
//
if (!RR && pPlayer->holoduke_on >= 0)
{
pSprite = (uspritetype *)&sprite[pPlayer->holoduke_on];
tw = cansee(vm.pSprite->x, vm.pSprite->y, vm.pSprite->z - (krand2() & (ZOFFSET5 - 1)), vm.pSprite->sectnum, pSprite->x, pSprite->y,
pSprite->z, pSprite->sectnum);
if (tw == 0)
{
// they can't see player's holoduke
// check for player...
pSprite = (uspritetype *)&sprite[pPlayer->i];
}
}
// can they see player, (or player's holoduke)
tw = cansee(vm.pSprite->x, vm.pSprite->y, vm.pSprite->z - (krand2() & ((47 << 8))), vm.pSprite->sectnum, pSprite->x, pSprite->y,
pSprite->z - (RR ? (28 << 8) : (24 << 8)), pSprite->sectnum);
if (tw == 0)
{
// search around for target player
// also modifies 'target' x&y if found..
tw = 1;
if (furthestcanseepoint(vm.spriteNum, (spritetype*)pSprite, &vm.pActor->lastv.x, &vm.pActor->lastv.y) == -1)
tw = 0;
}
else
{
// else, they did see it.
// save where we were looking...
vm.pActor->lastv.x = pSprite->x;
vm.pActor->lastv.y = pSprite->y;
}
if (tw && (vm.pSprite->statnum == STAT_ACTOR || vm.pSprite->statnum == STAT_STANDABLE))
vm.pActor->timetosleep = SLEEPTIME;
VM_CONDITIONAL(tw);
continue;
}
case concmd_ifhitweapon:
if (DEER)
{
VM_CONDITIONAL(ghtrophy_isakill(vm.spriteNum));
}
else
{
VM_CONDITIONAL(fi.ifhitbyweapon(vm.spriteNum) >= 0);
}
continue;
case concmd_ifsquished: VM_CONDITIONAL(VM_CheckSquished()); continue;
case concmd_ifdead: VM_CONDITIONAL(vm.pSprite->extra - (vm.pSprite->picnum == TILE_APLAYER) < 0); continue;
case concmd_ai:
insptr++;
@ -874,15 +693,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
vm.pActor->timetosleep = SLEEPTIME;
continue;
case concmd_addstrength:
insptr++;
vm.pSprite->extra += *insptr++;
continue;
case concmd_strength:
insptr++;
vm.pSprite->extra = *insptr++;
continue;
case concmd_smacksprite:
insptr++;
@ -912,12 +722,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
}
continue;
case concmd_rndmove:
insptr++;
vm.pSprite->ang = krand2()&2047;
vm.pSprite->xvel = 25;
continue;
case concmd_mamatrigger:
insptr++;
operateactivators(667, vm.playerNum);
@ -1181,11 +985,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
A_PlaySound(*insptr++, vm.spriteNum);
continue;
case concmd_tip:
insptr++;
pPlayer->tipincs = GAMETICSPERSEC;
continue;
case concmd_iftipcow:
if (g_spriteExtra[vm.spriteNum] == 1)
{
@ -1206,16 +1005,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
VM_CONDITIONAL(0);
continue;
#if 0 // RRDH only
case concmd_iffindnewspot:
VM_CONDITIONAL(ghcons_findnewspot(vm.spriteNum));
continue;
case concmd_leavedroppings:
insptr++;
ghtrax_leavedroppings(vm.spriteNum);
continue;
#endif
case concmd_tearitup:
insptr++;
@ -1234,8 +1023,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
VM_Fall(vm.spriteNum, vm.pSprite);
continue;
case concmd_nullop: insptr++; continue;
case concmd_addammo:
insptr++;
{
@ -1247,26 +1034,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
continue;
}
case concmd_money:
insptr++;
A_SpawnMultiple(vm.spriteNum, TILE_MONEY, *insptr++);
continue;
case concmd_mail:
insptr++;
A_SpawnMultiple(vm.spriteNum, RR ? TILE_MONEY : TILE_MAIL, *insptr++);
continue;
case concmd_sleeptime:
insptr++;
vm.pActor->timetosleep = (int16_t)*insptr++;
continue;
case concmd_paper:
insptr++;
A_SpawnMultiple(vm.spriteNum, RR ? TILE_MONEY : TILE_PAPER, *insptr++);
continue;
case concmd_addkills:
if (DEER)
{
@ -1288,15 +1055,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
vm.pActor->actorstayput = -1;
continue;
case concmd_lotsofglass:
insptr++;
spriteglass(vm.spriteNum, *insptr++);
continue;
case concmd_killit:
insptr++;
vm.flags |= VM_KILL;
return;
case concmd_addweapon:
insptr++;
@ -1377,12 +1135,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
sprite[pPlayer->i].z = pPlayer->pos.z;
continue;
#if 0 // RRDH only
case concmd_leavetrax:
insptr++;
ghtrax_leavetrax(vm.spriteNum);
continue;
#endif
case concmd_destroyit:
insptr++;
@ -1725,7 +1477,7 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
continue;
case concmd_ifwind:
VM_CONDITIONAL(g_windTime > 0);
VM_CONDITIONAL(WindTime > 0);
continue;
#if 0 // RRDH only
case concmd_ifpupwind:
@ -1823,7 +1575,7 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
case concmd_slapplayer:
insptr++;
P_ForceAngle(pPlayer);
forceplayerangle(pPlayer);
pPlayer->vel.x -= sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<7;
pPlayer->vel.y -= sintable[fix16_to_int(pPlayer->q16ang)&2047]<<7;
continue;
@ -1838,7 +1590,7 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
pPlayer->jumping_toggle = 1;
}
else
P_ForceAngle(pPlayer);
forceplayerangle(pPlayer);
continue;
case concmd_ifgapzl:
@ -1846,7 +1598,8 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
VM_CONDITIONAL(((vm.pActor->floorz - vm.pActor->ceilingz) >> 8) < *insptr);
continue;
case concmd_ifhitspace: VM_CONDITIONAL(TEST_SYNC_KEY(g_player[vm.playerNum].input->bits, SK_OPEN)); continue;
case concmd_ifhitspace:
VM_CONDITIONAL(TEST_SYNC_KEY(g_player[vm.playerNum].input->bits, SK_OPEN)); continue;
case concmd_ifoutside:
if (DEER)
@ -1857,7 +1610,8 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
VM_CONDITIONAL(sector[vm.pSprite->sectnum].ceilingstat & 1);
continue;
case concmd_ifmultiplayer: VM_CONDITIONAL((g_netServer || g_netClient || ud.multimode > 1)); continue;
case concmd_ifmultiplayer:
VM_CONDITIONAL((g_netServer || g_netClient || ud.multimode > 1)); continue;
case concmd_operate:
insptr++;
@ -1885,7 +1639,8 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
}
continue;
case concmd_ifinspace: VM_CONDITIONAL(fi.ceilingspace(vm.pSprite->sectnum)); continue;
case concmd_ifinspace:
VM_CONDITIONAL(fi.ceilingspace(vm.pSprite->sectnum)); continue;
case concmd_spritepal:
insptr++;
@ -1899,7 +1654,8 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
vm.pSprite->picnum = *insptr++;
continue;
case concmd_ifbulletnear: VM_CONDITIONAL(dodge(vm.pSprite) == 1); continue;
case concmd_ifbulletnear:
VM_CONDITIONAL(dodge(vm.pSprite) == 1); continue;
case concmd_ifrespawn:
if (A_CheckEnemySprite(vm.pSprite))
@ -2045,9 +1801,11 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
P_DoQuote(*(insptr++) | MAXQUOTES, pPlayer);
continue;
case concmd_ifinouterspace: VM_CONDITIONAL(fi.floorspace(vm.pSprite->sectnum)); continue;
case concmd_ifinouterspace:
VM_CONDITIONAL(fi.floorspace(vm.pSprite->sectnum)); continue;
case concmd_ifnotmoving: VM_CONDITIONAL((vm.pActor->movflag & 49152) > 16384); continue;
case concmd_ifnotmoving:
VM_CONDITIONAL((vm.pActor->movflag & 49152) > 16384); continue;
case concmd_respawnhitag:
insptr++;
@ -2163,6 +1921,41 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
VM_CONDITIONAL(tw);
continue;
case concmd_enda:
case concmd_break:
case concmd_ends:
case concmd_endevent:
case concmd_ifrnd:
case concmd_ifactornotstayput:
case concmd_ifsquished:
case concmd_ifdead:
case concmd_ifhitweapon:
case concmd_addstrength:
case concmd_strength:
case concmd_rndmove:
case concmd_tip:
case concmd_nullop:
case concmd_money:
case concmd_mail:
case concmd_sleeptime:
case concmd_paper:
case concmd_lotsofglass:
case concmd_killit:
case concmd_leftbrace:
case concmd_rightbrace:
case concmd_else:
case concmd_state:
case concmd_ifcanshoottarget:
case concmd_ifcanseetarget:
case concmd_ifnocover:
case concmd_ifcansee:
if (parse()) goto out;
if (killit_flag & 1) vm.flags |= VM_KILL;
if (killit_flag & 2) vm.flags |= VM_NOEXECUTE;
killit_flag = 0;
continue;
default: // you aren't supposed to be here!
if (RR && ud.recstat == 2)
{
@ -2175,6 +1968,10 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop)
break;
}
}
out:
if (killit_flag & 1) vm.flags |= VM_KILL;
if (killit_flag & 2) vm.flags |= VM_NOEXECUTE;
killit_flag = 0;
}
void VM_UpdateAnim(int spriteNum, int32_t *pData)
@ -2202,6 +1999,12 @@ void VM_UpdateAnim(int spriteNum, int32_t *pData)
}
}
extern int g_i, g_p;
extern int g_x;
extern int* g_t;
extern uint8_t killit_flag;
extern spritetype* g_sp;
// NORECURSE
void A_Execute(int spriteNum, int playerNum, int playerDist)
{
@ -2211,6 +2014,13 @@ void A_Execute(int spriteNum, int playerNum, int playerDist)
= { spriteNum, playerNum, playerDist, 0, &sprite[spriteNum], &actor[spriteNum].t_data[0], g_player[playerNum].ps, &actor[spriteNum] };
vm = tempvm;
g_i = spriteNum;
g_p = playerNum;
g_x = playerDist;
g_sp = &sprite[spriteNum];
g_t = &actor[spriteNum].t_data[0];
killit_flag = 0;
/*
if (g_netClient && A_CheckSpriteFlags(spriteNum, SFLAG_NULL))
{

View file

@ -4202,11 +4202,11 @@ static int32_t P_DoCounters(int playerNum)
if (RRRA)
{
if (g_windTime > 0)
g_windTime--;
if (WindTime > 0)
WindTime--;
else if ((krand2() & 127) == 8)
{
g_windTime = 120+((krand2()&63)<<2);
WindTime = 120+((krand2()&63)<<2);
WindDir = krand2()&2047;
}

View file

@ -1163,7 +1163,7 @@ static void resetprestat(int playerNum, int gameMode)
if (RRRA)
{
g_windTime = 0;
WindTime = 0;
WindDir = 0;
fakebubba_spawn = 0;
RRRA_ExitedLevel = 0;
@ -1322,7 +1322,7 @@ static void prelevel(char g)
g_chickenPlant = 0;
if (RRRA)
{
g_windTime = 0;
WindTime = 0;
WindDir = 0;
fakebubba_spawn = 0;
RRRA_ExitedLevel = 0;

View file

@ -894,7 +894,7 @@ static const dataspec_t svgm_anmisc[] =
{ 0, &g_geoSectorY2[0], sizeof(g_geoSectorY2[0]), ARRAY_SIZE(g_geoSectorY2) },
{ 0, &g_geoSectorCnt, sizeof(g_geoSectorCnt), 1 },
{ 0, &g_windTime, sizeof(g_windTime), 1 },
{ 0, &WindTime, sizeof(WindTime), 1 },
{ 0, &WindDir, sizeof(WindDir), 1 },
{ 0, &fakebubba_spawn, sizeof(fakebubba_spawn), 1 },
{ 0, &mamaspawn_count, sizeof(mamaspawn_count), 1 },