EDUKE32_STANDALONE stuff

git-svn-id: https://svn.eduke32.com/eduke32@6942 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-07-21 00:18:03 +00:00
parent 1cfe23b348
commit b2e788b7e9
4 changed files with 72 additions and 40 deletions

View file

@ -3458,12 +3458,13 @@ ACTOR_STATIC void G_MoveTransports(void)
{
if (pPlayer->on_ground && sectLotag == 0 && onFloor && pPlayer->jetpack_on == 0)
{
#ifndef EDUKE32_STANDALONE
if (sprite[spriteNum].pal == 0)
{
A_Spawn(spriteNum, TRANSPORTERBEAM);
A_PlaySound(TELEPORTER, spriteNum);
}
#endif
for (int TRAVERSE_CONNECT(otherPlayer))
{
if (g_player[otherPlayer].ps->cursectnum == sprite[OW(spriteNum)].sectnum)
@ -3490,12 +3491,13 @@ ACTOR_STATIC void G_MoveTransports(void)
changespritesect(sectSprite, sprite[OW(spriteNum)].sectnum);
pPlayer->cursectnum = sprite[sectSprite].sectnum;
#ifndef EDUKE32_STANDALONE
if (sprite[spriteNum].pal == 0)
{
int const newSprite = A_Spawn(OW(spriteNum), TRANSPORTERBEAM);
A_PlaySound(TELEPORTER, newSprite);
}
#endif
break;
}
@ -3624,7 +3626,7 @@ ACTOR_STATIC void G_MoveTransports(void)
int const osect = sprite[OW(spriteNum)].sectnum;
Bassert(sectLotag == ST_1_ABOVE_WATER || sectLotag == ST_2_UNDERWATER);
#ifndef EDUKE32_STANDALONE
int const newSprite = A_Spawn(sectSprite, WATERSPLASH2);
if (sectLotag == ST_1_ABOVE_WATER && sprite[sectSprite].statnum == STAT_PROJECTILE)
@ -3633,7 +3635,7 @@ ACTOR_STATIC void G_MoveTransports(void)
sprite[newSprite].ang = sprite[sectSprite].ang;
A_SetSprite(newSprite, CLIPMASK0);
}
#endif
actor[sectSprite].lasttransport = (totalclock & UINT8_MAX);
sprite[sectSprite].x += sprite[OW(spriteNum)].x - SX(spriteNum);
@ -3660,7 +3662,7 @@ ACTOR_STATIC void G_MoveTransports(void)
sprite[sectSprite].ang = sprite[OW(spriteNum)].ang;
actor[sectSprite].bpos = *(vec3_t *)&sprite[sectSprite];
#ifndef EDUKE32_STANDALONE
if (sprite[spriteNum].pal == 0)
{
int newSprite = A_Spawn(spriteNum, TRANSPORTERBEAM);
@ -3669,7 +3671,7 @@ ACTOR_STATIC void G_MoveTransports(void)
newSprite = A_Spawn(OW(spriteNum), TRANSPORTERBEAM);
A_PlaySound(TELEPORTER, newSprite);
}
#endif
if (sprite[OW(spriteNum)].owner != OW(spriteNum))
{
T1(spriteNum) = 13;

View file

@ -1544,6 +1544,7 @@ int A_Spawn(int spriteNum, int tileNum)
changespritestat(newSprite, STAT_ACTOR);
}
break;
#ifndef EDUKE32_STANDALONE
case CAMERAPOLE__STATIC:
pSprite->extra = 1;
pSprite->cstat &= 32768;
@ -1561,7 +1562,6 @@ int A_Spawn(int spriteNum, int tileNum)
pSprite->pal = 0;
break;
#ifndef EDUKE32_STANDALONE
case BOLT1__STATIC:
case SIDEBOLT1__STATIC:
T1(newSprite) = pSprite->xrepeat;
@ -2647,13 +2647,14 @@ int A_Spawn(int spriteNum, int tileNum)
}
fallthrough__;
#endif
#ifndef EDUKE32_STANDALONE
case EXPLOSION2BOT__STATIC:
case BURNING__STATIC:
case BURNING2__STATIC:
case SMALLSMOKE__STATIC:
case SHRINKEREXPLOSION__STATIC:
case COOLEXPLOSION1__STATIC:
#endif
if (spriteNum >= 0)
{
pSprite->ang = sprite[spriteNum].ang;
@ -3447,10 +3448,10 @@ static int getofs_viewtype_mirrored(uint16_t & cstat, int angDiff)
}
// XXX: this fucking sucks and needs to be replaced with a SFLAG
#ifndef EDUKE32_STANDALONE
static int G_CheckAdultTile(int tileNum)
{
UNREFERENCED_PARAMETER(tileNum);
#ifndef EDUKE32_STANDALONE
switch (tileNum)
{
case FEM1__STATIC:
@ -3515,9 +3516,9 @@ static int G_CheckAdultTile(int tileNum)
case 4957:
return 1;
}
#endif
return 0;
}
#endif
static inline void G_DoEventAnimSprites(int tspriteNum)
{
@ -3675,6 +3676,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
// NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below).
uspritetype *const pSprite = (i < 0) ? &tsprite[j] : (uspritetype *)&sprite[i];
#ifndef EDUKE32_STANDALONE
if (ud.lockout && G_CheckAdultTile(DYNAMICTILEMAP(pSprite->picnum)))
{
t->xrepeat = t->yrepeat = 0;
@ -3686,7 +3688,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
t->shade = -127;
t->cstat |= 8192;
}
#endif
if (t->statnum == TSPR_TEMP)
continue;
@ -3729,6 +3731,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
switch (DYNAMICTILEMAP(switchpic))
{
#ifndef EDUKE32_STANDALONE
case DUKELYINGDEAD__STATIC:
t->z += (24<<8);
break;
@ -3790,6 +3793,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
case CRYSTALAMMO__STATIC:
t->shade = (sintable[(totalclock<<4)&2047]>>10);
continue;
#endif
case VIEWSCREEN__STATIC:
case VIEWSCREEN2__STATIC:
{
@ -3828,7 +3832,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
break;
}
#ifndef EDUKE32_STANDALONE
case SHRINKSPARK__STATIC:
t->picnum = SHRINKSPARK+((totalclock>>4)&3);
break;
@ -3868,7 +3872,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
t->picnum = RECON+frameOffset;
break;
#endif
case APLAYER__STATIC:
playerNum = P_GetP(pSprite);
@ -4033,7 +4037,7 @@ PALONLY:
t->z = actor[i].floorz;
break;
#ifndef EDUKE32_STANDALONE
case JIBS1__STATIC:
case JIBS2__STATIC:
case JIBS3__STATIC:
@ -4069,7 +4073,6 @@ PALONLY:
G_MaybeTakeOnFloorPal(t, sect);
break;
case WATERBUBBLE__STATIC:
if (sector[t->sectnum].floorpicnum == FLOORSLIME)
{
@ -4077,6 +4080,7 @@ PALONLY:
break;
}
fallthrough__;
#endif
default:
G_MaybeTakeOnFloorPal(t, sect);
break;
@ -4255,13 +4259,13 @@ skip:
switch (DYNAMICTILEMAP(pSprite->picnum))
{
#ifndef EDUKE32_STANDALONE
case LASERLINE__STATIC:
if (sector[t->sectnum].lotag == ST_2_UNDERWATER) t->pal = 8;
t->z = sprite[pSprite->owner].z-(3<<8);
if (g_tripbombLaserMode == 2 && g_player[screenpeek].ps->heat_on == 0)
t->yrepeat = 0;
fallthrough__;
case EXPLOSION2__STATIC:
case EXPLOSION2BOT__STATIC:
case FREEZEBLAST__STATIC:
case ATOMICHEALTH__STATIC:
@ -4272,6 +4276,8 @@ skip:
case SHRINKEREXPLOSION__STATIC:
case RPG__STATIC:
case FLOORFLAME__STATIC:
#endif
case EXPLOSION2__STATIC:
if (t->picnum == EXPLOSION2)
{
g_player[screenpeek].ps->visibility = -127;
@ -4280,6 +4286,7 @@ skip:
t->shade = -127;
t->cstat |= 8192+1024;
break;
#ifndef EDUKE32_STANDALONE
case FIRE__STATIC:
case FIRE2__STATIC:
t->cstat |= 128;
@ -4329,6 +4336,7 @@ skip:
case FRAMEEFFECT1_13__STATIC:
if (PLUTOPAK) break;
fallthrough__;
#endif
case FRAMEEFFECT1__STATIC:
if (pSprite->owner >= 0 && sprite[pSprite->owner].statnum < MAXSTATUS)
{

View file

@ -53,7 +53,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define TEST_SYNC_KEY(bits, sync_num) (!!TEST((bits), BIT(sync_num)))
#ifndef EDUKE32_STANDALONE
#define AFLAMABLE(X) (X==BOX||X==TREE1||X==TREE2||X==TIRE||X==CONE)
#else
#define AFLAMABLE(X) (0)
#endif
#define rnd(X) ((krand()>>8)>=(255-(X)))
//

View file

@ -211,7 +211,7 @@ static int A_FindTargetSprite(const spritetype *pSprite, int projAng, int projec
int const playerNum = pSprite->picnum == APLAYER ? P_GetP(pSprite) : -1;
if (pSprite->picnum == APLAYER)
if (playerNum != -1)
{
if (!g_player[playerNum].ps->auto_aim)
return -1;
@ -221,6 +221,7 @@ static int A_FindTargetSprite(const spritetype *pSprite, int projAng, int projec
if (A_CheckSpriteTileFlags(projecTile,SFLAG_PROJECTILE) && (Proj_GetProjectile(projecTile)->workslike & PROJECTILE_RPG))
return -1;
#ifndef EDUKE32_STANDALONE
switch (DYNAMICTILEMAP(projecTile))
{
case TONGUE__STATIC:
@ -235,26 +236,27 @@ static int A_FindTargetSprite(const spritetype *pSprite, int projAng, int projec
default:
break;
}
#endif
}
}
int const spriteAng = pSprite->ang;
int const gotShrinker =
(pSprite->picnum == APLAYER && PWEAPON(playerNum, g_player[playerNum].ps->curr_weapon, WorksLike) == SHRINKER_WEAPON);
int const gotFreezer =
(pSprite->picnum == APLAYER && PWEAPON(playerNum, g_player[playerNum].ps->curr_weapon, WorksLike) == FREEZE_WEAPON);
#ifndef EDUKE32_STANDALONE
int const isShrinker = (pSprite->picnum == APLAYER && PWEAPON(playerNum, g_player[playerNum].ps->curr_weapon, WorksLike) == SHRINKER_WEAPON);
int const isFreezer = (pSprite->picnum == APLAYER && PWEAPON(playerNum, g_player[playerNum].ps->curr_weapon, WorksLike) == FREEZE_WEAPON);
#endif
vec2_t const d1 = { sintable[(spriteAng + 512 - projAng) & 2047], sintable[(spriteAng - projAng) & 2047] };
vec2_t const d2 = { sintable[(spriteAng + 512 + projAng) & 2047], sintable[(spriteAng + projAng) & 2047] };
vec2_t const d3 = { sintable[(spriteAng + 512) & 2047], sintable[spriteAng & 2047] };
int lastDist = INT32_MAX;
int returnSprite = -1;
int lastDist = INT32_MAX;
int bestSprite = -1;
for (bssize_t k=0; k<4; k++)
{
if (returnSprite >= 0)
if (bestSprite >= 0)
break;
for (bssize_t spriteNum=headspritestat[aimstats[k]]; spriteNum >= 0; spriteNum=nextspritestat[spriteNum])
@ -263,20 +265,22 @@ static int A_FindTargetSprite(const spritetype *pSprite, int projAng, int projec
(sprite[spriteNum].cstat & (257 + 32768)) == 257) &&
(A_CheckEnemySprite(&sprite[spriteNum]) || k < 2))
{
if (A_CheckEnemySprite(&sprite[spriteNum]) || PN(spriteNum) == APLAYER || PN(spriteNum) == SHARK)
if (A_CheckEnemySprite(&sprite[spriteNum]) || PN(spriteNum) == APLAYER)
{
if (PN(spriteNum) == APLAYER && pSprite->picnum == APLAYER && pSprite != &sprite[spriteNum] &&
(GTFLAGS(GAMETYPE_PLAYERSFRIENDLY) ||
(GTFLAGS(GAMETYPE_TDM) && g_player[P_Get(spriteNum)].ps->team == g_player[playerNum].ps->team)))
continue;
if ((gotShrinker && sprite[spriteNum].xrepeat < 30
#ifndef EDUKE32_STANDALONE
if ((isShrinker && sprite[spriteNum].xrepeat < 30
&& (PN(spriteNum) == SHARK || !(PN(spriteNum) >= GREENSLIME && PN(spriteNum) <= GREENSLIME + 7)))
|| (gotFreezer && sprite[spriteNum].pal == 1))
|| (isFreezer && sprite[spriteNum].pal == 1))
continue;
#endif
}
vec2_t vd = { (SX(spriteNum) - pSprite->x), (SY(spriteNum) - pSprite->y) };
vec2_t const vd = { (SX(spriteNum) - pSprite->x), (SY(spriteNum) - pSprite->y) };
if ((d1.y * vd.x <= d1.x * vd.y) && (d2.y * vd.x >= d2.x * vd.y))
{
@ -292,16 +296,18 @@ static int A_FindTargetSprite(const spritetype *pSprite, int projAng, int projec
onScreen = (klabs(scale(SZ(spriteNum)-pSprite->z,10,spriteDist)-fix16_to_int(ps->q16horiz+ps->q16horizoff-F16(100))) < 100);
}
int const canSee = (PN(spriteNum) == ORGANTIC || PN(spriteNum) == ROTATEGUN)
? cansee(SX(spriteNum), SY(spriteNum), SZ(spriteNum), SECT(spriteNum), pSprite->x, pSprite->y,
pSprite->z - ZOFFSET5, pSprite->sectnum)
: cansee(SX(spriteNum), SY(spriteNum), SZ(spriteNum) - ZOFFSET5, SECT(spriteNum), pSprite->x, pSprite->y,
pSprite->z - ZOFFSET5, pSprite->sectnum);
#ifndef EDUKE32_STANDALONE
int const zOffset = (PN(spriteNum) == ORGANTIC || PN(spriteNum) == ROTATEGUN) ? ZOFFSET5 : 0;
#else
int const zOffset = 0;
#endif
int const canSee = cansee(SX(spriteNum), SY(spriteNum), SZ(spriteNum) - zOffset, SECT(spriteNum),
pSprite->x, pSprite->y, pSprite->z - ZOFFSET5, pSprite->sectnum);
if (onScreen && canSee)
{
lastDist = spriteDist;
returnSprite = spriteNum;
lastDist = spriteDist;
bestSprite = spriteNum;
}
}
}
@ -309,7 +315,7 @@ static int A_FindTargetSprite(const spritetype *pSprite, int projAng, int projec
}
}
return returnSprite;
return bestSprite;
}
static void A_SetHitData(int spriteNum, const hitdata_t *hitData)
@ -319,11 +325,13 @@ static void A_SetHitData(int spriteNum, const hitdata_t *hitData)
actor[spriteNum].t_data[8] = hitData->sprite;
}
#ifndef EDUKE32_STANDALONE
static int CheckShootSwitchTile(int tileNum)
{
return tileNum == DIPSWITCH || tileNum == DIPSWITCH + 1 || tileNum == DIPSWITCH2 || tileNum == DIPSWITCH2 + 1 ||
tileNum == DIPSWITCH3 || tileNum == DIPSWITCH3 + 1 || tileNum == HANDSWITCH || tileNum == HANDSWITCH + 1;
}
#endif
static int32_t safeldist(int32_t spriteNum, const void *pSprite)
{
@ -362,9 +370,11 @@ static int GetAutoAimAng(int spriteNum, int playerNum, int projecTile, int zAdju
const uspritetype *const pSprite = (uspritetype *)&sprite[returnSprite];
int zCenter = 2 * (pSprite->yrepeat * tilesiz[pSprite->picnum].y) + zAdjust;
#ifndef EDUKE32_STANDALONE
if (aimFlags &&
((pSprite->picnum >= GREENSLIME && pSprite->picnum <= GREENSLIME + 7) || pSprite->picnum == ROTATEGUN))
zCenter -= ZOFFSET3;
#endif
int spriteDist = safeldist(g_player[playerNum].ps->i, &sprite[returnSprite]);
*pZvel = tabledivide32_noinline((pSprite->z - startPos->z - zCenter) * projVel, spriteDist);
@ -460,8 +470,8 @@ static void P_PreFireHitscan(int spriteNum, int playerNum, int projecTile, vec3_
pPlayer->angrange = angRange;
pPlayer->zrange = zRange;
#else
Gv_SetVar(g_angRangeVarID,angRange, spriteNum,playerNum);
Gv_SetVar(g_zRangeVarID,zRange,spriteNum,playerNum);
Gv_SetVar(g_angRangeVarID, angRange, spriteNum, playerNum);
Gv_SetVar(g_zRangeVarID, zRange, spriteNum, playerNum);
#endif
VM_OnEvent(EVENT_GETSHOTRANGE, spriteNum, playerNum);
@ -616,10 +626,13 @@ static int Proj_MaybeDamageCF2(int const spriteNum, int const zvel, int const hi
// 2: set cstat to wall-aligned + random x/y flip
//
// TODO: maybe split into 3 cases (hit neither wall nor sprite, hit sprite, hit wall)?
static int P_PostFireHitscan(int const playerNum, int const spriteNum, hitdata_t *const hitData, int const spriteOwner,
static int P_PostFireHitscan(int playerNum, int const spriteNum, hitdata_t *const hitData, int const spriteOwner,
int const projecTile, int const zvel, int const spawnTile, int const decalTile, int const wallDamage,
int const decalFlags)
{
#ifdef EDUKE32_STANDALONE
UNREFERENCED_PARAMETER(playerNum);
#endif
if (hitData->wall == -1 && hitData->sprite == -1)
{
if (Proj_MaybeDamageCF2(spriteNum, zvel, hitData->sect))
@ -639,6 +652,7 @@ static int P_PostFireHitscan(int const playerNum, int const spriteNum, hitdata_t
(ud.ffire == 1 || (!GTFLAGS(GAMETYPE_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_TDM) &&
g_player[P_Get(hitData->sprite)].ps->team != g_player[P_Get(spriteOwner)].ps->team)))
{
#ifndef EDUKE32_STANDALONE
int jibSprite = A_Spawn(spriteNum, JIBS6);
sprite[spriteNum].xrepeat = sprite[spriteNum].yrepeat = 0;
@ -646,17 +660,19 @@ static int P_PostFireHitscan(int const playerNum, int const spriteNum, hitdata_t
sprite[jibSprite].xvel = 16;
sprite[jibSprite].xrepeat = sprite[jibSprite].yrepeat = 24;
sprite[jibSprite].ang += 64 - (krand() & 127);
#endif
}
else
{
Proj_MaybeSpawn(spriteNum, spawnTile, hitData);
}
#ifndef EDUKE32_STANDALONE
if (playerNum >= 0 && CheckShootSwitchTile(sprite[hitData->sprite].picnum))
{
P_ActivateSwitch(playerNum, hitData->sprite, 1);
return -1;
}
#endif
}
else if (hitData->wall >= 0)
{
@ -667,11 +683,13 @@ static int P_PostFireHitscan(int const playerNum, int const spriteNum, hitdata_t
if (CheckDoorTile(hitWall->picnum) == 1)
goto SKIPBULLETHOLE;
#ifndef EDUKE32_STANDALONE
if (playerNum >= 0 && CheckShootSwitchTile(hitWall->picnum))
{
P_ActivateSwitch(playerNum, hitData->wall, 0);
return -1;
}
#endif
if (hitWall->hitag != 0 || (hitWall->nextwall >= 0 && wall[hitWall->nextwall].hitag != 0))
goto SKIPBULLETHOLE;