This commit is contained in:
Christoph Oelckers 2020-05-14 23:43:14 +02:00
parent 3651ab821e
commit cba4f0616b
2 changed files with 1 additions and 377 deletions

View file

@ -4430,7 +4430,7 @@ static int fallspecial(int g_i, int g_p)
else if (g_sp->picnum != APLAYER)
{
if (!g_spriteExtra[g_i])
killit_flag = 4;
addspritetodelete(g_i);
return 0;
}
hittype[g_i].picnum = SHOTSPARK1;

View file

@ -655,411 +655,35 @@ void VM_Execute(native_t loop)
continue;
case concmd_isdrunk:
insptr++;
{
pPlayer->drink_amt += *insptr;
int newHealth = sprite[pPlayer->i].extra;
if (newHealth > 0)
newHealth += *insptr;
if (newHealth > (max_player_health << 1))
newHealth = (max_player_health << 1);
if (newHealth < 0)
newHealth = 0;
if (ud.god == 0)
{
if (*insptr > 0)
{
if ((newHealth - *insptr) < (max_player_health >> 2) && newHealth >= (max_player_health >> 2))
A_PlaySound(DUKE_GOTHEALTHATLOW, pPlayer->i);
pPlayer->last_extra = newHealth;
}
sprite[pPlayer->i].extra = newHealth;
}
if (pPlayer->drink_amt > 100)
pPlayer->drink_amt = 100;
if (sprite[pPlayer->i].extra >= max_player_health)
{
sprite[pPlayer->i].extra = max_player_health;
pPlayer->last_extra = max_player_health;
}
}
insptr++;
continue;
case concmd_strafeleft:
insptr++;
{
vec3_t const vect = { sintable[(vm.pSprite->ang+1024)&2047]>>10, sintable[(vm.pSprite->ang+512)&2047]>>10, vm.pSprite->zvel };
A_MoveSprite(vm.spriteNum, &vect, CLIPMASK0);
}
continue;
case concmd_straferight:
insptr++;
{
vec3_t const vect = { sintable[(vm.pSprite->ang-0)&2047]>>10, sintable[(vm.pSprite->ang-512)&2047]>>10, vm.pSprite->zvel };
A_MoveSprite(vm.spriteNum, &vect, CLIPMASK0);
}
continue;
case concmd_larrybird:
insptr++;
pPlayer->pos.z = sector[sprite[pPlayer->i].sectnum].ceilingz;
sprite[pPlayer->i].z = pPlayer->pos.z;
continue;
case concmd_destroyit:
insptr++;
{
int16_t hitag, lotag, spr, jj, k, nextk;
hitag = 0;
for (SPRITES_OF_SECT(vm.pSprite->sectnum,k))
{
if (sprite[k].picnum == TILE_RRTILE63)
{
lotag = sprite[k].lotag;
spr = k;
if (sprite[k].hitag)
hitag = sprite[k].hitag;
}
}
for (SPRITES_OF(100, jj))
{
spritetype const *js = &sprite[jj];
if (hitag && hitag == js->hitag)
{
for (SPRITES_OF_SECT(js->sectnum,k))
{
if (sprite[k].picnum == TILE_DESTRUCTO)
{
actor[k].picnum = TILE_SHOTSPARK1;
actor[k].extra = 1;
}
}
}
if (sprite[spr].sectnum != js->sectnum && lotag == js->lotag)
{
int16_t const sectnum = sprite[spr].sectnum;
int16_t const wallstart = sector[sectnum].wallptr;
int16_t const wallend = wallstart + sector[sectnum].wallnum;
int16_t const wallstart2 = sector[js->sectnum].wallptr;
//int16_t const wallend2 = wallstart2 + sector[js->sectnum].wallnum;
for (bssize_t wi = wallstart, wj = wallstart2; wi < wallend; wi++, wj++)
{
wall[wi].picnum = wall[wj].picnum;
wall[wi].overpicnum = wall[wj].overpicnum;
wall[wi].shade = wall[wj].shade;
wall[wi].xrepeat = wall[wj].xrepeat;
wall[wi].yrepeat = wall[wj].yrepeat;
wall[wi].xpanning = wall[wj].xpanning;
wall[wi].ypanning = wall[wj].ypanning;
if (RRRA && wall[wi].nextwall != -1)
{
wall[wi].cstat = 0;
wall[wall[wi].nextwall].cstat = 0;
}
}
sector[sectnum].floorz = sector[js->sectnum].floorz;
sector[sectnum].ceilingz = sector[js->sectnum].ceilingz;
sector[sectnum].ceilingstat = sector[js->sectnum].ceilingstat;
sector[sectnum].floorstat = sector[js->sectnum].floorstat;
sector[sectnum].ceilingpicnum = sector[js->sectnum].ceilingpicnum;
sector[sectnum].ceilingheinum = sector[js->sectnum].ceilingheinum;
sector[sectnum].ceilingshade = sector[js->sectnum].ceilingshade;
sector[sectnum].ceilingpal = sector[js->sectnum].ceilingpal;
sector[sectnum].ceilingxpanning = sector[js->sectnum].ceilingxpanning;
sector[sectnum].ceilingypanning = sector[js->sectnum].ceilingypanning;
sector[sectnum].floorpicnum = sector[js->sectnum].floorpicnum;
sector[sectnum].floorheinum = sector[js->sectnum].floorheinum;
sector[sectnum].floorshade = sector[js->sectnum].floorshade;
sector[sectnum].floorpal = sector[js->sectnum].floorpal;
sector[sectnum].floorxpanning = sector[js->sectnum].floorxpanning;
sector[sectnum].floorypanning = sector[js->sectnum].floorypanning;
sector[sectnum].visibility = sector[js->sectnum].visibility;
g_sectorExtra[sectnum] = g_sectorExtra[js->sectnum];
sector[sectnum].lotag = sector[js->sectnum].lotag;
sector[sectnum].hitag = sector[js->sectnum].hitag;
sector[sectnum].extra = sector[js->sectnum].extra;
}
}
for (SPRITES_OF_SECT_SAFE(vm.pSprite->sectnum, k, nextk))
{
switch (DYNAMICTILEMAP(sprite[k].picnum))
{
case DESTRUCTO__STATICRR:
case RRTILE63__STATICRR:
case TORNADO__STATICRR:
case APLAYER__STATIC:
case COOT__STATICRR:
break;
default:
A_DeleteSprite(k);
break;
}
}
}
continue;
case concmd_iseat:
insptr++;
{
pPlayer->eat += *insptr;
if (pPlayer->eat > 100)
pPlayer->eat = 100;
pPlayer->drink_amt -= *insptr;
if (pPlayer->drink_amt < 0)
pPlayer->drink_amt = 0;
int newHealth = sprite[pPlayer->i].extra;
if (vm.pSprite->picnum != TILE_ATOMICHEALTH)
{
if (newHealth > max_player_health && *insptr > 0)
{
insptr++;
continue;
}
else
{
if (newHealth > 0)
newHealth += (*insptr)*3;
if (newHealth > max_player_health && *insptr > 0)
newHealth = max_player_health;
}
}
else
{
if (newHealth > 0)
newHealth += *insptr;
if (newHealth > (max_player_health << 1))
newHealth = (max_player_health << 1);
}
if (newHealth < 0)
newHealth = 0;
if (ud.god == 0)
{
if (*insptr > 0)
{
if ((newHealth - *insptr) < (max_player_health >> 2) && newHealth >= (max_player_health >> 2))
A_PlaySound(DUKE_GOTHEALTHATLOW, pPlayer->i);
pPlayer->last_extra = newHealth;
}
sprite[pPlayer->i].extra = newHealth;
}
}
insptr++;
continue;
case concmd_newpic:
insptr++;
vm.pSprite->picnum = (int16_t)*insptr++;
continue;
case concmd_ifonmud:
VM_CONDITIONAL(sector[vm.pSprite->sectnum].floorpicnum == TILE_RRTILE3073
&& klabs(vm.pSprite->z - sector[vm.pSprite->sectnum].floorz) < ZOFFSET5);
continue;
case concmd_ifonwater:
if (DEER)
{
VM_CONDITIONAL(sector[vm.pSprite->sectnum].hitag == 2003);
continue;
}
VM_CONDITIONAL(sector[vm.pSprite->sectnum].lotag == ST_1_ABOVE_WATER
&& klabs(vm.pSprite->z - sector[vm.pSprite->sectnum].floorz) < ZOFFSET5);
continue;
case concmd_ifmotofast:
VM_CONDITIONAL(pPlayer->MotoSpeed > 60);
continue;
case concmd_ifonmoto:
VM_CONDITIONAL(pPlayer->OnMotorcycle == 1);
continue;
case concmd_ifonboat:
VM_CONDITIONAL(pPlayer->OnBoat == 1);
continue;
case concmd_ifsizedown:
vm.pSprite->xrepeat--;
vm.pSprite->yrepeat--;
VM_CONDITIONAL(vm.pSprite->xrepeat <= 5);
continue;
case concmd_ifwind:
VM_CONDITIONAL(WindTime > 0);
continue;
case concmd_ifinwater:
if (DEER)
{
VM_CONDITIONAL(sector[vm.pSprite->sectnum].hitag == 2003 && klabs(vm.pSprite->z - sector[vm.pSprite->sectnum].floorz) < ZOFFSET5);
continue;
}
VM_CONDITIONAL(sector[vm.pSprite->sectnum].lotag == ST_2_UNDERWATER);
continue;
case concmd_ifcount:
insptr++;
VM_CONDITIONAL(AC_COUNT(vm.pData) >= *insptr);
continue;
case concmd_ifactor:
insptr++;
VM_CONDITIONAL(vm.pSprite->picnum == *insptr);
continue;
case concmd_resetcount:
insptr++;
AC_COUNT(vm.pData) = 0;
continue;
case concmd_addinventory:
insptr += 2;
VM_AddInventory(pPlayer, *(insptr - 1), *insptr);
insptr++;
continue;
case concmd_hitradius:
fi.hitradius(vm.spriteNum, *(insptr + 1), *(insptr + 2), *(insptr + 3), *(insptr + 4), *(insptr + 5));
insptr += 6;
continue;
case concmd_ifp:
{
int const moveFlags = *(++insptr);
int nResult = 0;
int const playerXVel = sprite[pPlayer->i].xvel;
int const syncBits = g_player[vm.playerNum].input->bits;
if (((moveFlags & pducking) && pPlayer->on_ground && (TEST_SYNC_KEY(syncBits, SK_CROUCH) ^ vm.pPlayer->crouch_toggle))
|| ((moveFlags & pfalling) && pPlayer->jumping_counter == 0 && !pPlayer->on_ground && pPlayer->vel.z > 2048)
|| ((moveFlags & pjumping) && pPlayer->jumping_counter > 348)
|| ((moveFlags & pstanding) && playerXVel >= 0 && playerXVel < 8)
|| ((moveFlags & pwalking) && playerXVel >= 8 && !TEST_SYNC_KEY(syncBits, SK_RUN))
|| ((moveFlags & prunning) && playerXVel >= 8 && TEST_SYNC_KEY(syncBits, SK_RUN))
|| ((moveFlags & phigher) && pPlayer->pos.z < (vm.pSprite->z - (48 << 8)))
|| ((moveFlags & pwalkingback) && playerXVel <= -8 && !TEST_SYNC_KEY(syncBits, SK_RUN))
|| ((moveFlags & prunningback) && playerXVel <= -8 && TEST_SYNC_KEY(syncBits, SK_RUN))
|| ((moveFlags & pkicking)
&& (DEER ? ghsound_pfiredgunnear(vm.pSprite, vm.playerNum) :(pPlayer->quick_kick > 0
|| (pPlayer->curr_weapon == KNEE_WEAPON && pPlayer->kickback_pic > 0))))
|| ((moveFlags & pshrunk) && (DEER ? pPlayer->dhat60f && !sub_535EC() : sprite[pPlayer->i].xrepeat < (RR ? 8 : 32)))
|| ((moveFlags & pjetpack) && pPlayer->jetpack_on)
|| ((moveFlags & ponsteroids) && (DEER ? ghsound_pmadesound(vm.pSprite, vm.playerNum) :
pPlayer->inv_amount[GET_STEROIDS] > 0 && pPlayer->inv_amount[GET_STEROIDS] < 400))
|| ((moveFlags & ponground) && (DEER ? ghsound_pmadecall(vm.pSprite, vm.playerNum) : pPlayer->on_ground))
|| ((moveFlags & palive) && sprite[pPlayer->i].xrepeat > (RR ? 8 : 32) && sprite[pPlayer->i].extra > 0 && pPlayer->timebeforeexit == 0)
|| ((moveFlags & pdead) && sprite[pPlayer->i].extra <= 0))
nResult = 1;
else if ((moveFlags & pfacing))
{
nResult
= (vm.pSprite->picnum == TILE_APLAYER && (g_netServer || ud.multimode > 1))
? getincangle(fix16_to_int(g_player[otherp].ps->q16ang),
getangle(pPlayer->pos.x - g_player[otherp].ps->pos.x, pPlayer->pos.y - g_player[otherp].ps->pos.y))
: getincangle(fix16_to_int(pPlayer->q16ang), getangle(vm.pSprite->x - pPlayer->pos.x, vm.pSprite->y - pPlayer->pos.y));
nResult = (nResult > -128 && nResult < 128);
}
VM_CONDITIONAL(nResult);
}
continue;
case concmd_ifstrength:
insptr++;
VM_CONDITIONAL(vm.pSprite->extra <= *insptr);
continue;
case concmd_guts:
A_DoGuts(vm.spriteNum, *(insptr + 1), *(insptr + 2));
insptr += 3;
continue;
case concmd_slapplayer:
insptr++;
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;
case concmd_wackplayer:
insptr++;
if (RR)
{
pPlayer->vel.x -= sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<7;
pPlayer->vel.y -= sintable[fix16_to_int(pPlayer->q16ang)&2047]<<7;
pPlayer->jumping_counter = 767;
pPlayer->jumping_toggle = 1;
}
else
forceplayerangle(pPlayer);
continue;
case concmd_ifgapzl:
insptr++;
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_ifoutside:
if (DEER)
{
VM_CONDITIONAL(sector[vm.pSprite->sectnum].hitag = 2000);
continue;
}
VM_CONDITIONAL(sector[vm.pSprite->sectnum].ceilingstat & 1);
continue;
case concmd_ifmultiplayer:
VM_CONDITIONAL((g_netServer || g_netClient || ud.multimode > 1)); continue;
case concmd_operate:
insptr++;
if (sector[vm.pSprite->sectnum].lotag == 0)
{
int16_t foundSect, foundWall, foundSprite;
int32_t foundDist;
neartag(vm.pSprite->x, vm.pSprite->y, vm.pSprite->z - ZOFFSET5, vm.pSprite->sectnum, vm.pSprite->ang, &foundSect, &foundWall,
&foundSprite, &foundDist, 768, 4 + 1, NULL);
if (foundSect >= 0 && isanearoperator(sector[foundSect].lotag))
if ((sector[foundSect].lotag & 0xff) == ST_23_SWINGING_DOOR || sector[foundSect].floorz == sector[foundSect].ceilingz)
if ((sector[foundSect].lotag & (16384u | 32768u)) == 0)
{
int32_t j;
for (SPRITES_OF_SECT(foundSect, j))
if (sprite[j].picnum == TILE_ACTIVATOR)
break;
if (j == -1)
operatesectors(foundSect, vm.spriteNum);
}
}
continue;
case concmd_fall:
case concmd_ifpinventory:
case concmd_ifinspace: