mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-26 00:40:56 +00:00
- It's possible now to change posture settings for each player
- Touch trigger for walls fix - It's possible to set custom clipdist for things (gModernMap only) - Few tweaks for Custom Dude - Player Control type fixes and updates # Conflicts: # platform/Windows/nblood.vcxproj # source/blood/src/player.h
This commit is contained in:
parent
5bcfcc1b55
commit
afb8c11683
8 changed files with 248 additions and 446 deletions
|
@ -4515,6 +4515,9 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// enough to reset gSpriteHit values
|
||||||
|
if (nHWall != -1 || nHSprite != -1) xvel[nSprite] += 5;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7526,7 +7529,7 @@ spritetype* actSpawnCustomDude(spritetype* pSprite, int nDist) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int getSpriteMassBySize(spritetype* pSprite) {
|
int getSpriteMassBySize(spritetype* pSprite) {
|
||||||
int mass = 0; int seqId = -1; Seq* pSeq = NULL;
|
int mass = 0; int seqId = -1; int clipDist = pSprite->clipdist; Seq* pSeq = NULL;
|
||||||
if (IsDudeSprite(pSprite)) {
|
if (IsDudeSprite(pSprite)) {
|
||||||
|
|
||||||
switch (pSprite->type) {
|
switch (pSprite->type) {
|
||||||
|
@ -7535,6 +7538,7 @@ int getSpriteMassBySize(spritetype* pSprite) {
|
||||||
case kDudeModernCustom:
|
case kDudeModernCustom:
|
||||||
case kDudeModernCustomBurning:
|
case kDudeModernCustomBurning:
|
||||||
seqId = xsprite[pSprite->extra].data2;
|
seqId = xsprite[pSprite->extra].data2;
|
||||||
|
clipDist = gGenDudeExtra[pSprite->index].initVals[2];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
seqId = dudeInfo[pSprite->type - kDudeBase].seqStartID;
|
seqId = dudeInfo[pSprite->type - kDudeBase].seqStartID;
|
||||||
|
@ -7549,7 +7553,7 @@ int getSpriteMassBySize(spritetype* pSprite) {
|
||||||
|
|
||||||
SPRITEMASS* cached = &gSpriteMass[pSprite->extra];
|
SPRITEMASS* cached = &gSpriteMass[pSprite->extra];
|
||||||
if (((seqId >= 0 && seqId == cached->seqId) || pSprite->picnum == cached->picnum) && pSprite->xrepeat == cached->xrepeat &&
|
if (((seqId >= 0 && seqId == cached->seqId) || pSprite->picnum == cached->picnum) && pSprite->xrepeat == cached->xrepeat &&
|
||||||
pSprite->yrepeat == cached->yrepeat && pSprite->clipdist == cached->clipdist) {
|
pSprite->yrepeat == cached->yrepeat && clipDist == cached->clipdist) {
|
||||||
return cached->mass;
|
return cached->mass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7567,7 +7571,7 @@ int getSpriteMassBySize(spritetype* pSprite) {
|
||||||
picnum = pSprite->picnum;
|
picnum = pSprite->picnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
int clipDist = ClipRange(pSprite->clipdist, 1, 255);
|
clipDist = ClipLow(pSprite->clipdist, 1);
|
||||||
short x = tilesiz[picnum].x; short y = tilesiz[picnum].y;
|
short x = tilesiz[picnum].x; short y = tilesiz[picnum].y;
|
||||||
short xrepeat = pSprite->xrepeat; short yrepeat = pSprite->yrepeat;
|
short xrepeat = pSprite->xrepeat; short yrepeat = pSprite->yrepeat;
|
||||||
|
|
||||||
|
|
|
@ -1058,6 +1058,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
|
||||||
actKillDude(nSource, pSprite, DAMAGE_TYPE_0, 65535);
|
actKillDude(nSource, pSprite, DAMAGE_TYPE_0, 65535);
|
||||||
}
|
}
|
||||||
} else if (canWalk(pSprite) && !inDodge(pXSprite->aiState) && !inRecoil(pXSprite->aiState)) {
|
} else if (canWalk(pSprite) && !inDodge(pXSprite->aiState) && !inRecoil(pXSprite->aiState)) {
|
||||||
|
if (!dudeIsMelee(pXSprite)) {
|
||||||
if (inIdle(pXSprite->aiState) || Chance(getDodgeChance(pSprite))) {
|
if (inIdle(pXSprite->aiState) || Chance(getDodgeChance(pSprite))) {
|
||||||
if (!spriteIsUnderwater(pSprite, false)) {
|
if (!spriteIsUnderwater(pSprite, false)) {
|
||||||
if (!canDuck(pSprite) || !sub_5BDA8(pSprite, 14)) aiGenDudeNewState(pSprite, &genDudeDodgeShortL);
|
if (!canDuck(pSprite) || !sub_5BDA8(pSprite, 14)) aiGenDudeNewState(pSprite, &genDudeDodgeShortL);
|
||||||
|
@ -1070,6 +1071,9 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
|
||||||
aiGenDudeNewState(pSprite, &genDudeDodgeShortW);
|
aiGenDudeNewState(pSprite, &genDudeDodgeShortW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (Chance(0x0200)) {
|
||||||
|
playGenDudeSound(pSprite, kGenDudeSndGotHit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1985,11 +1985,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||||
if (!(sector[pSprite->sectnum].floorstat & 0x0001))
|
if (!(sector[pSprite->sectnum].floorstat & 0x0001))
|
||||||
pSprite->z += ClipHigh(sector[pSprite->sectnum].floorz - zBot, 0);
|
pSprite->z += ClipHigh(sector[pSprite->sectnum].floorz - zBot, 0);
|
||||||
|
|
||||||
int curSumm = pSprite->xrepeat + pSprite->yrepeat; int defSumm = pExtra->initVals[0] + pExtra->initVals[1];
|
pSprite->clipdist = ClipRange((pSprite->xrepeat + pSprite->yrepeat) >> 1, 4, 120);
|
||||||
if (curSumm < defSumm) pSprite->clipdist = ClipLow(curSumm >> 1, 4);
|
|
||||||
else if (curSumm > defSumm) pSprite->clipdist = ClipHigh(curSumm >> 1, 255);
|
|
||||||
else pSprite->clipdist = pExtra->initVals[2];
|
|
||||||
|
|
||||||
if (propId) break;
|
if (propId) break;
|
||||||
fallthrough__;
|
fallthrough__;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ int Handicap[] = {
|
||||||
144, 208, 256, 304, 368
|
144, 208, 256, 304, 368
|
||||||
};
|
};
|
||||||
|
|
||||||
int gDefaultAccel[] = {
|
/*int gDefaultAccel[] = {
|
||||||
|
|
||||||
// normal human
|
// normal human
|
||||||
0x4000, 0x1200, 0x2000, // stand (front, side, back) / swim (front, side, back) / crouch (front, side, back)
|
0x4000, 0x1200, 0x2000, // stand (front, side, back) / swim (front, side, back) / crouch (front, side, back)
|
||||||
|
@ -148,229 +148,37 @@ int gDefaultJumpZ[] = {
|
||||||
// grown human
|
// grown human
|
||||||
-1014586, -1779173, 0x5b05, 0, 0, 0, // stand (normal jump, pwup jump) / swim (normal jump, pwup jump) / crouch (normal jump, pwup jump)
|
-1014586, -1779173, 0x5b05, 0, 0, 0, // stand (normal jump, pwup jump) / swim (normal jump, pwup jump) / crouch (normal jump, pwup jump)
|
||||||
|
|
||||||
};
|
};*/
|
||||||
|
|
||||||
|
|
||||||
POSTURE gPosture[kModeMax][kPostureMax] = {
|
POSTURE gPostureDefaults[kModeMax][kPostureMax] = {
|
||||||
|
|
||||||
// normal human
|
// normal human
|
||||||
{
|
{
|
||||||
{
|
{ 0x4000, 0x4000, 0x4000, 14, 17, 24, 16, 32, 80, 0x1600, 0x1200, 0xc00, 0x90, -0xbaaaa, -0x175555 },
|
||||||
gDefaultAccel[0],
|
{ 0x1200, 0x1200, 0x1200, 14, 17, 24, 16, 32, 80, 0x1400, 0x1000, -0x600, 0xb0, 0x5b05, 0 },
|
||||||
gDefaultAccel[0],
|
{ 0x2000, 0x2000, 0x2000, 22, 28, 24, 16, 16, 40, 0x800, 0x600, -0x600, 0xb0, 0, 0 },
|
||||||
gDefaultAccel[0],
|
|
||||||
14,
|
|
||||||
17,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
32,
|
|
||||||
80,
|
|
||||||
0x1600,
|
|
||||||
0x1200,
|
|
||||||
0xc00,
|
|
||||||
0x90,
|
|
||||||
gDefaultJumpZ[0],
|
|
||||||
gDefaultJumpZ[1],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gDefaultAccel[1],
|
|
||||||
gDefaultAccel[1],
|
|
||||||
gDefaultAccel[1],
|
|
||||||
14,
|
|
||||||
17,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
32,
|
|
||||||
80,
|
|
||||||
0x1400,
|
|
||||||
0x1000,
|
|
||||||
-0x600,
|
|
||||||
0xb0,
|
|
||||||
gDefaultJumpZ[2],
|
|
||||||
gDefaultJumpZ[3],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gDefaultAccel[2],
|
|
||||||
gDefaultAccel[2],
|
|
||||||
gDefaultAccel[2],
|
|
||||||
22,
|
|
||||||
28,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
16,
|
|
||||||
40,
|
|
||||||
0x800,
|
|
||||||
0x600,
|
|
||||||
-0x600,
|
|
||||||
0xb0,
|
|
||||||
gDefaultJumpZ[4],
|
|
||||||
gDefaultJumpZ[5],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// normal beast
|
// normal beast
|
||||||
{
|
{
|
||||||
{
|
{ 0x4000, 0x4000, 0x4000, 14, 17, 24, 16, 32, 80, 0x1600, 0x1200, 0xc00, 0x90, -0xbaaaa, -0x175555 },
|
||||||
gDefaultAccel[3],
|
{ 0x1200, 0x1200, 0x1200, 14, 17, 24, 16, 32, 80, 0x1400, 0x1000, -0x600, 0xb0, 0x5b05, 0 },
|
||||||
gDefaultAccel[3],
|
{ 0x2000, 0x2000, 0x2000, 22, 28, 24, 16, 16, 40, 0x800, 0x600, -0x600, 0xb0, 0, 0 },
|
||||||
gDefaultAccel[3],
|
|
||||||
14,
|
|
||||||
17,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
32,
|
|
||||||
80,
|
|
||||||
0x1600,
|
|
||||||
0x1200,
|
|
||||||
0xc00,
|
|
||||||
0x90,
|
|
||||||
gDefaultJumpZ[6],
|
|
||||||
gDefaultJumpZ[7],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gDefaultAccel[4],
|
|
||||||
gDefaultAccel[4],
|
|
||||||
gDefaultAccel[4],
|
|
||||||
14,
|
|
||||||
17,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
32,
|
|
||||||
80,
|
|
||||||
0x1400,
|
|
||||||
0x1000,
|
|
||||||
-0x600,
|
|
||||||
0xb0,
|
|
||||||
gDefaultJumpZ[8],
|
|
||||||
gDefaultJumpZ[9],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gDefaultAccel[5],
|
|
||||||
gDefaultAccel[5],
|
|
||||||
gDefaultAccel[5],
|
|
||||||
22,
|
|
||||||
28,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
16,
|
|
||||||
40,
|
|
||||||
0x800,
|
|
||||||
0x600,
|
|
||||||
-0x600,
|
|
||||||
0xb0,
|
|
||||||
gDefaultJumpZ[10],
|
|
||||||
gDefaultJumpZ[11],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// shrink human
|
// shrink human
|
||||||
{
|
{
|
||||||
{
|
{ 10384, 10384, 10384, 14, 17, 24, 16, 32, 80, 5632, 4608, 3072, 144, -564586, -1329173 },
|
||||||
gDefaultAccel[6],
|
{ 2108, 2108, 2108, 14, 17, 24, 16, 32, 80, 5120, 4096, -1536, 176, 0x5b05, 0 },
|
||||||
gDefaultAccel[6],
|
{ 2192, 2192, 2192, 22, 28, 24, 16, 16, 40, 2048, 1536, -1536, 176, 0, 0 },
|
||||||
gDefaultAccel[6],
|
|
||||||
14,
|
|
||||||
17,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
32,
|
|
||||||
80,
|
|
||||||
5632,
|
|
||||||
4608,
|
|
||||||
3072,
|
|
||||||
144,
|
|
||||||
gDefaultJumpZ[12],
|
|
||||||
gDefaultJumpZ[13],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gDefaultAccel[7],
|
|
||||||
gDefaultAccel[7],
|
|
||||||
gDefaultAccel[7],
|
|
||||||
14,
|
|
||||||
17,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
32,
|
|
||||||
80,
|
|
||||||
5120,
|
|
||||||
4096,
|
|
||||||
-1536,
|
|
||||||
176,
|
|
||||||
gDefaultJumpZ[14],
|
|
||||||
gDefaultJumpZ[15],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gDefaultAccel[8],
|
|
||||||
gDefaultAccel[8],
|
|
||||||
gDefaultAccel[8],
|
|
||||||
22,
|
|
||||||
28,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
16,
|
|
||||||
40,
|
|
||||||
2048,
|
|
||||||
1536,
|
|
||||||
-1536,
|
|
||||||
176,
|
|
||||||
gDefaultJumpZ[16],
|
|
||||||
gDefaultJumpZ[17],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// grown human
|
// grown human
|
||||||
{
|
{
|
||||||
{
|
{ 19384, 19384, 19384, 14, 17, 24, 16, 32, 80, 5632, 4608, 3072, 144, -1014586, -1779173 },
|
||||||
gDefaultAccel[9],
|
{ 5608, 5608, 5608, 14, 17, 24, 16, 32, 80, 5120, 4096, -1536, 176, 0x5b05, 0 },
|
||||||
gDefaultAccel[9],
|
{ 11192, 11192, 11192, 22, 28, 24, 16, 16, 40, 2048, 1536, -1536, 176, 0, 0 },
|
||||||
gDefaultAccel[9],
|
|
||||||
14,
|
|
||||||
17,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
32,
|
|
||||||
80,
|
|
||||||
5632,
|
|
||||||
4608,
|
|
||||||
3072,
|
|
||||||
144,
|
|
||||||
gDefaultJumpZ[18],
|
|
||||||
gDefaultJumpZ[19],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gDefaultAccel[10],
|
|
||||||
gDefaultAccel[10],
|
|
||||||
gDefaultAccel[10],
|
|
||||||
14,
|
|
||||||
17,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
32,
|
|
||||||
80,
|
|
||||||
5120,
|
|
||||||
4096,
|
|
||||||
-1536,
|
|
||||||
176,
|
|
||||||
gDefaultJumpZ[20],
|
|
||||||
gDefaultJumpZ[21],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
gDefaultAccel[11],
|
|
||||||
gDefaultAccel[11],
|
|
||||||
gDefaultAccel[11],
|
|
||||||
22,
|
|
||||||
28,
|
|
||||||
24,
|
|
||||||
16,
|
|
||||||
16,
|
|
||||||
40,
|
|
||||||
2048,
|
|
||||||
1536,
|
|
||||||
-1536,
|
|
||||||
176,
|
|
||||||
gDefaultJumpZ[22],
|
|
||||||
gDefaultJumpZ[23],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -960,7 +768,7 @@ void playerSetGodMode(PLAYER *pPlayer, char bGodMode)
|
||||||
|
|
||||||
void playerResetInertia(PLAYER *pPlayer)
|
void playerResetInertia(PLAYER *pPlayer)
|
||||||
{
|
{
|
||||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||||
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
||||||
pPlayer->zWeapon = pPlayer->pSprite->z-pPosture->weaponAboveZ;
|
pPlayer->zWeapon = pPlayer->pSprite->z-pPosture->weaponAboveZ;
|
||||||
viewBackupView(pPlayer->nPlayer);
|
viewBackupView(pPlayer->nPlayer);
|
||||||
|
@ -1027,6 +835,7 @@ void playerStart(int nPlayer)
|
||||||
DUDEINFO *pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];
|
DUDEINFO *pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];
|
||||||
pPlayer->pDudeInfo = pDudeInfo;
|
pPlayer->pDudeInfo = pDudeInfo;
|
||||||
playerSetRace(pPlayer, kModeHuman);
|
playerSetRace(pPlayer, kModeHuman);
|
||||||
|
playerResetPosture(pPlayer);
|
||||||
seqSpawn(pDudeInfo->seqStartID, 3, pSprite->extra, -1);
|
seqSpawn(pDudeInfo->seqStartID, 3, pSprite->extra, -1);
|
||||||
if (pPlayer == gMe)
|
if (pPlayer == gMe)
|
||||||
SetBitString(show2dsprite, pSprite->index);
|
SetBitString(show2dsprite, pSprite->index);
|
||||||
|
@ -1105,6 +914,7 @@ void playerStart(int nPlayer)
|
||||||
pPlayer->weaponTimer = 0;
|
pPlayer->weaponTimer = 0;
|
||||||
pPlayer->weaponState = 0;
|
pPlayer->weaponState = 0;
|
||||||
pPlayer->weaponQav = -1;
|
pPlayer->weaponQav = -1;
|
||||||
|
playerResetQavScene(pPlayer); // reset qav scene
|
||||||
pPlayer->hand = 0;
|
pPlayer->hand = 0;
|
||||||
pPlayer->nWaterPal = 0;
|
pPlayer->nWaterPal = 0;
|
||||||
playerResetPowerUps(pPlayer);
|
playerResetPowerUps(pPlayer);
|
||||||
|
@ -1121,18 +931,6 @@ void playerStart(int nPlayer)
|
||||||
pPlayer->posture = 1;
|
pPlayer->posture = 1;
|
||||||
pPlayer->pXSprite->medium = kMediumWater;
|
pPlayer->pXSprite->medium = kMediumWater;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////
|
|
||||||
// reset qav scene
|
|
||||||
playerResetQavScene(pPlayer);
|
|
||||||
|
|
||||||
// restore default movement speed
|
|
||||||
playerResetMoveSpeed(pPlayer);
|
|
||||||
|
|
||||||
// restore default jump height
|
|
||||||
playerResetJumpHeight(pPlayer);
|
|
||||||
/////////////////
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void playerReset(PLAYER *pPlayer)
|
void playerReset(PLAYER *pPlayer)
|
||||||
|
@ -1182,30 +980,13 @@ void playerReset(PLAYER *pPlayer)
|
||||||
// reset qav scene
|
// reset qav scene
|
||||||
playerResetQavScene(pPlayer);
|
playerResetQavScene(pPlayer);
|
||||||
|
|
||||||
// restore default movement speed
|
// reset posture (mainly required for resetting movement speed and jump height)
|
||||||
playerResetMoveSpeed(pPlayer);
|
playerResetPosture(pPlayer);
|
||||||
|
|
||||||
// restore default jump height
|
|
||||||
playerResetJumpHeight(pPlayer);
|
|
||||||
/////////////////
|
/////////////////
|
||||||
}
|
}
|
||||||
|
|
||||||
void playerResetMoveSpeed(PLAYER* pPlayer) {
|
void playerResetPosture(PLAYER* pPlayer) {
|
||||||
for (int i = kModeHuman, k = 0; i < kModeMax; i++) {
|
memcpy(pPlayer->pPosture, gPostureDefaults, sizeof(gPostureDefaults));
|
||||||
for (int a = kPostureStand; a < kPostureMax; a++, k++)
|
|
||||||
gPosture[i][a].frontAccel = gPosture[i][a].sideAccel = gPosture[i][a].backAccel = gDefaultAccel[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void playerResetJumpHeight(PLAYER* pPlayer) {
|
|
||||||
for (int i = kModeHuman, k = 0; i < kModeMax; i++) {
|
|
||||||
for (int a = kPostureStand; a < kPostureMax; a++) {
|
|
||||||
|
|
||||||
gPosture[i][a].normalJumpZ = gDefaultJumpZ[k++];
|
|
||||||
gPosture[i][a].pwupJumpZ = gDefaultJumpZ[k++];
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void playerResetQavScene(PLAYER* pPlayer) {
|
void playerResetQavScene(PLAYER* pPlayer) {
|
||||||
|
@ -1230,6 +1011,7 @@ void playerInit(int nPlayer, unsigned int a2)
|
||||||
memset(dword_21EFB0, 0, sizeof(dword_21EFB0));
|
memset(dword_21EFB0, 0, sizeof(dword_21EFB0));
|
||||||
memset(dword_21EFD0, 0, sizeof(dword_21EFD0));
|
memset(dword_21EFD0, 0, sizeof(dword_21EFD0));
|
||||||
memset(pPlayer->fragInfo, 0, sizeof(pPlayer->fragInfo));
|
memset(pPlayer->fragInfo, 0, sizeof(pPlayer->fragInfo));
|
||||||
|
|
||||||
if (!(a2&1))
|
if (!(a2&1))
|
||||||
playerReset(pPlayer);
|
playerReset(pPlayer);
|
||||||
}
|
}
|
||||||
|
@ -1656,7 +1438,7 @@ void ProcessInput(PLAYER *pPlayer)
|
||||||
spritetype *pSprite = pPlayer->pSprite;
|
spritetype *pSprite = pPlayer->pSprite;
|
||||||
XSPRITE *pXSprite = pPlayer->pXSprite;
|
XSPRITE *pXSprite = pPlayer->pXSprite;
|
||||||
int nSprite = pPlayer->nSprite;
|
int nSprite = pPlayer->nSprite;
|
||||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||||
GINPUT *pInput = &pPlayer->input;
|
GINPUT *pInput = &pPlayer->input;
|
||||||
pPlayer->isRunning = pInput->syncFlags.run;
|
pPlayer->isRunning = pInput->syncFlags.run;
|
||||||
if (pInput->buttonFlags.byte || pInput->forward || pInput->strafe || pInput->q16turn)
|
if (pInput->buttonFlags.byte || pInput->forward || pInput->strafe || pInput->q16turn)
|
||||||
|
@ -2017,7 +1799,7 @@ void playerProcess(PLAYER *pPlayer)
|
||||||
int nSprite = pPlayer->nSprite;
|
int nSprite = pPlayer->nSprite;
|
||||||
int nXSprite = pSprite->extra;
|
int nXSprite = pSprite->extra;
|
||||||
XSPRITE *pXSprite = pPlayer->pXSprite;
|
XSPRITE *pXSprite = pPlayer->pXSprite;
|
||||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||||
powerupProcess(pPlayer);
|
powerupProcess(pPlayer);
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
GetSpriteExtents(pSprite, &top, &bottom);
|
GetSpriteExtents(pSprite, &top, &bottom);
|
||||||
|
|
|
@ -21,23 +21,24 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "compat.h"
|
|
||||||
#include "build.h"
|
|
||||||
#include "fix16.h"
|
|
||||||
#include "common_game.h"
|
|
||||||
#include "actor.h"
|
#include "actor.h"
|
||||||
#include "blood.h"
|
#include "blood.h"
|
||||||
|
#include "build.h"
|
||||||
|
#include "common_game.h"
|
||||||
|
#include "compat.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "dude.h"
|
#include "dude.h"
|
||||||
|
#include "fix16.h"
|
||||||
#include "levels.h"
|
#include "levels.h"
|
||||||
#include "qav.h"
|
#include "qav.h"
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
// life modes of the player
|
// life modes of the player
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
kModeHuman = 0,
|
kModeHuman = 0,
|
||||||
kModeBeast = 1,
|
kModeBeast = 1,
|
||||||
kModeHumanShrink = 2,
|
kModeHumanShrink = 2,
|
||||||
|
@ -46,19 +47,47 @@ kModeMax = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
// postures
|
// postures
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
kPostureStand = 0,
|
kPostureStand = 0,
|
||||||
kPostureCrouch = 1,
|
kPostureCrouch = 1,
|
||||||
kPostureSwim = 2,
|
kPostureSwim = 2,
|
||||||
kPostureMax = 3,
|
kPostureMax = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PACKINFO {
|
struct PACKINFO
|
||||||
|
{
|
||||||
bool isActive; // is active (0/1)
|
bool isActive; // is active (0/1)
|
||||||
int curAmount = 0; // remaining percent
|
int curAmount = 0; // remaining percent
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PLAYER {
|
// by NoOne: defaut player movement speeds of all move states for gPosture
|
||||||
|
extern int gDefaultAccel[12];
|
||||||
|
|
||||||
|
// by NoOne: defaut player jump heights of all move states for gPosture
|
||||||
|
extern int gDefaultJumpZ[24];
|
||||||
|
struct POSTURE
|
||||||
|
{
|
||||||
|
int frontAccel;
|
||||||
|
int sideAccel;
|
||||||
|
int backAccel;
|
||||||
|
int pace[2];
|
||||||
|
int bobV;
|
||||||
|
int bobH;
|
||||||
|
int swayV;
|
||||||
|
int swayH;
|
||||||
|
int eyeAboveZ;
|
||||||
|
int weaponAboveZ;
|
||||||
|
int xOffset;
|
||||||
|
int zOffset;
|
||||||
|
int normalJumpZ;
|
||||||
|
int pwupJumpZ;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern POSTURE gPostureDefaults[kModeMax][kPostureMax];
|
||||||
|
|
||||||
|
struct PLAYER
|
||||||
|
{
|
||||||
spritetype* pSprite;
|
spritetype* pSprite;
|
||||||
XSPRITE* pXSprite;
|
XSPRITE* pXSprite;
|
||||||
DUDEINFO* pDudeInfo;
|
DUDEINFO* pDudeInfo;
|
||||||
|
@ -170,46 +199,27 @@ struct PLAYER {
|
||||||
int angold;
|
int angold;
|
||||||
int player_par;
|
int player_par;
|
||||||
int nWaterPal;
|
int nWaterPal;
|
||||||
|
POSTURE pPosture[kModeMax][kPostureMax];
|
||||||
};
|
};
|
||||||
|
|
||||||
// by NoOne: defaut player movement speeds of all move states for gPosture
|
|
||||||
extern int gDefaultAccel[12];
|
|
||||||
|
|
||||||
// by NoOne: defaut player jump heights of all move states for gPosture
|
|
||||||
extern int gDefaultJumpZ[24];
|
|
||||||
|
|
||||||
struct POSTURE {
|
struct PROFILE
|
||||||
int frontAccel;
|
{
|
||||||
int sideAccel;
|
|
||||||
int backAccel;
|
|
||||||
int pace[2];
|
|
||||||
int bobV;
|
|
||||||
int bobH;
|
|
||||||
int swayV;
|
|
||||||
int swayH;
|
|
||||||
int eyeAboveZ;
|
|
||||||
int weaponAboveZ;
|
|
||||||
int xOffset;
|
|
||||||
int zOffset;
|
|
||||||
int normalJumpZ;
|
|
||||||
int pwupJumpZ;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern POSTURE gPosture[kModeMax][kPostureMax];
|
|
||||||
|
|
||||||
struct PROFILE {
|
|
||||||
int nAutoAim;
|
int nAutoAim;
|
||||||
int nWeaponSwitch;
|
int nWeaponSwitch;
|
||||||
int skill;
|
int skill;
|
||||||
char name[MAXPLAYERNAME];
|
char name[MAXPLAYERNAME];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AMMOINFO {
|
struct AMMOINFO
|
||||||
|
{
|
||||||
int max;
|
int max;
|
||||||
signed char vectorType;
|
signed char vectorType;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct POWERUPINFO {
|
struct POWERUPINFO
|
||||||
|
{
|
||||||
short picnum;
|
short picnum;
|
||||||
bool pickupOnce;
|
bool pickupOnce;
|
||||||
int bonusTime;
|
int bonusTime;
|
||||||
|
@ -219,7 +229,8 @@ struct POWERUPINFO {
|
||||||
|
|
||||||
#define kQavSceneStackSize 16
|
#define kQavSceneStackSize 16
|
||||||
// by NoOne: this one stores qavs anims that can be played by trigger
|
// by NoOne: this one stores qavs anims that can be played by trigger
|
||||||
struct QAVSCENE {
|
struct QAVSCENE
|
||||||
|
{
|
||||||
short index = -1; // index of sprite which triggered qav scene
|
short index = -1; // index of sprite which triggered qav scene
|
||||||
QAV * qavResrc = NULL;
|
QAV * qavResrc = NULL;
|
||||||
short causedBy = -1;
|
short causedBy = -1;
|
||||||
|
@ -228,7 +239,8 @@ struct QAVSCENE {
|
||||||
};
|
};
|
||||||
|
|
||||||
// by NoOne: this one for controlling the player using triggers (movement speed, jumps and other stuff)
|
// by NoOne: this one for controlling the player using triggers (movement speed, jumps and other stuff)
|
||||||
struct TRPLAYERCTRL {
|
struct TRPLAYERCTRL
|
||||||
|
{
|
||||||
QAVSCENE qavScene;
|
QAVSCENE qavScene;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -330,8 +342,7 @@ PLAYER* getPlayerById(short id);
|
||||||
QAV * qavSceneLoad(int qavId);
|
QAV * qavSceneLoad(int qavId);
|
||||||
void qavScenePlay(PLAYER *pPlayer);
|
void qavScenePlay(PLAYER *pPlayer);
|
||||||
void qavSceneDraw(PLAYER *pPlayer, int a2, int a3, int a4, int a5);
|
void qavSceneDraw(PLAYER *pPlayer, int a2, int a3, int a4, int a5);
|
||||||
void playerResetMoveSpeed(PLAYER* pPlayer);
|
void playerResetPosture(PLAYER* pPlayer);
|
||||||
void playerResetJumpHeight(PLAYER* pPlayer);
|
|
||||||
void playerResetQavScene(PLAYER *pPlayer);
|
void playerResetQavScene(PLAYER *pPlayer);
|
||||||
|
|
||||||
END_BLD_NS
|
END_BLD_NS
|
||||||
|
|
|
@ -905,36 +905,41 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kCmdNumberic + 1: // 65
|
case kCmdNumberic + 1: // 65
|
||||||
// player movement speed (for all players ATM)
|
// player movement speed (for all races and postures)
|
||||||
if (valueIsBetween(pXSprite->data2, -1, 32767)) {
|
if (valueIsBetween(pXSprite->data2, -1, 32767)) {
|
||||||
for (int i = 0, speed = pXSprite->data2 << 1, k = 0; i < kModeMax; i++) {
|
int speed = pXSprite->data2 << 1;
|
||||||
for (int a = 0; a < kPostureMax; a++, k++) {
|
for (int i = 0; i < kModeMax; i++) {
|
||||||
int defSpeed = gDefaultAccel[k];
|
for (int a = 0; a < kPostureMax; a++) {
|
||||||
if (pXSprite->data1 == 100)
|
POSTURE* curPosture = &pPlayer->pPosture[i][a]; POSTURE defPosture = gPostureDefaults[i][a];
|
||||||
gPosture[i][a].frontAccel = gPosture[i][a].sideAccel = gPosture[i][a].backAccel = defSpeed;
|
if (pXSprite->data2 == 100) {
|
||||||
else if (speed >= 0)
|
curPosture->frontAccel = defPosture.frontAccel;
|
||||||
gPosture[i][a].frontAccel = gPosture[i][a].sideAccel = gPosture[i][a].backAccel = ClipRange(mulscale8(defSpeed, speed), 0, 65535);
|
curPosture->sideAccel = defPosture.sideAccel;
|
||||||
|
curPosture->backAccel = defPosture.backAccel;
|
||||||
|
} else if (speed >= 0) {
|
||||||
|
curPosture->frontAccel = ClipRange(mulscale8(defPosture.frontAccel, speed), 0, 65535);
|
||||||
|
curPosture->sideAccel = ClipRange(mulscale8(defPosture.sideAccel, speed), 0, 65535);
|
||||||
|
curPosture->backAccel = ClipRange(mulscale8(defPosture.backAccel, speed), 0, 65535);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//viewSetSystemMessage("MOVEMENT: %d %d %d", pXSprite->rxID,pSprite->index, gPosture[0][0].frontAccel);
|
//viewSetSystemMessage("MOVEMENT: %d %d %d", pXSprite->rxID,pSprite->index, gPosture[0][0].frontAccel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// player jump height (for all players ATM)
|
// player jump height (for all races and stand posture only)
|
||||||
if (valueIsBetween(pXSprite->data3, -1, 32767)) {
|
if (valueIsBetween(pXSprite->data3, -1, 32767)) {
|
||||||
for (int i = 0, jump = pXSprite->data3 * 3, k = 0; i < kModeMax; i++) {
|
int jump = pXSprite->data3 * 3;
|
||||||
for (int a = 0; a < kPostureMax; a++) {
|
for (int i = 0; i < kModeMax; i++) {
|
||||||
int njmp = gDefaultJumpZ[k++]; int pjmp = gDefaultJumpZ[k++];
|
POSTURE* curPosture = &pPlayer->pPosture[i][kPostureStand]; POSTURE defPosture = gPostureDefaults[i][kPostureStand];
|
||||||
if (a != kPostureStand) continue;
|
if (pXSprite->data3 == 100) {
|
||||||
else if (pXSprite->data3 == 100) {
|
curPosture->normalJumpZ = defPosture.normalJumpZ;
|
||||||
gPosture[i][a].normalJumpZ = njmp;
|
curPosture->pwupJumpZ = defPosture.pwupJumpZ;
|
||||||
gPosture[i][a].pwupJumpZ = pjmp;
|
|
||||||
} else if (jump >= 0) {
|
} else if (jump >= 0) {
|
||||||
gPosture[i][a].normalJumpZ = ClipRange(mulscale8(njmp, jump), -0x200000, 0);
|
curPosture->normalJumpZ = ClipRange(mulscale8(defPosture.normalJumpZ, jump), -0x200000, 0);
|
||||||
gPosture[i][a].pwupJumpZ = ClipRange(mulscale8(pjmp, jump), -0x200000, 0);
|
curPosture->pwupJumpZ = ClipRange(mulscale8(defPosture.pwupJumpZ, jump), -0x200000, 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//viewSetSystemMessage("JUMPING: %d", gPosture[0][0].normalJumpZ);
|
//viewSetSystemMessage("JUMPING: %d", gPosture[0][0].normalJumpZ);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -305,13 +305,13 @@ void viewUpdatePrediction(GINPUT *pInput)
|
||||||
|
|
||||||
void sub_158B4(PLAYER *pPlayer)
|
void sub_158B4(PLAYER *pPlayer)
|
||||||
{
|
{
|
||||||
predict.at38 = predict.at58 - gPosture[pPlayer->lifeMode][predict.at48].eyeAboveZ;
|
predict.at38 = predict.at58 - pPlayer->pPosture[pPlayer->lifeMode][predict.at48].eyeAboveZ;
|
||||||
predict.at40 = predict.at58 - gPosture[pPlayer->lifeMode][predict.at48].weaponAboveZ;
|
predict.at40 = predict.at58 - pPlayer->pPosture[pPlayer->lifeMode][predict.at48].weaponAboveZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput)
|
void fakeProcessInput(PLAYER *pPlayer, GINPUT *pInput)
|
||||||
{
|
{
|
||||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][predict.at48];
|
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][predict.at48];
|
||||||
predict.at70 = pInput->syncFlags.run;
|
predict.at70 = pInput->syncFlags.run;
|
||||||
predict.at70 = 0;
|
predict.at70 = 0;
|
||||||
predict.at71 = pInput->buttonFlags.jump;
|
predict.at71 = pInput->buttonFlags.jump;
|
||||||
|
@ -490,7 +490,7 @@ void fakePlayerProcess(PLAYER *pPlayer, GINPUT *pInput)
|
||||||
{
|
{
|
||||||
spritetype *pSprite = pPlayer->pSprite;
|
spritetype *pSprite = pPlayer->pSprite;
|
||||||
XSPRITE *pXSprite = pPlayer->pXSprite;
|
XSPRITE *pXSprite = pPlayer->pXSprite;
|
||||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][predict.at48];
|
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][predict.at48];
|
||||||
|
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
GetSpriteExtents(pSprite, &top, &bottom);
|
GetSpriteExtents(pSprite, &top, &bottom);
|
||||||
|
@ -2527,7 +2527,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
|
||||||
if (pPlayer->flashEffect && (gView != pPlayer || gViewPos != VIEWPOS_0)) {
|
if (pPlayer->flashEffect && (gView != pPlayer || gViewPos != VIEWPOS_0)) {
|
||||||
auto pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_14);
|
auto pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_14);
|
||||||
if (pNTSprite) {
|
if (pNTSprite) {
|
||||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||||
pNTSprite->x += mulscale28(pPosture->zOffset, Cos(pTSprite->ang));
|
pNTSprite->x += mulscale28(pPosture->zOffset, Cos(pTSprite->ang));
|
||||||
pNTSprite->y += mulscale28(pPosture->zOffset, Sin(pTSprite->ang));
|
pNTSprite->y += mulscale28(pPosture->zOffset, Sin(pTSprite->ang));
|
||||||
pNTSprite->z = pPlayer->pSprite->z-pPosture->xOffset;
|
pNTSprite->z = pPlayer->pSprite->z-pPosture->xOffset;
|
||||||
|
|
|
@ -201,7 +201,7 @@ char sub_4B2C8(PLAYER *pPlayer, int a2, int a3)
|
||||||
|
|
||||||
void SpawnBulletEject(PLAYER *pPlayer, int a2, int a3)
|
void SpawnBulletEject(PLAYER *pPlayer, int a2, int a3)
|
||||||
{
|
{
|
||||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||||
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
||||||
int dz = pPlayer->zWeapon-(pPlayer->zWeapon-pPlayer->zView)/2;
|
int dz = pPlayer->zWeapon-(pPlayer->zWeapon-pPlayer->zView)/2;
|
||||||
fxSpawnEjectingBrass(pPlayer->pSprite, dz, a2, a3);
|
fxSpawnEjectingBrass(pPlayer->pSprite, dz, a2, a3);
|
||||||
|
@ -209,7 +209,7 @@ void SpawnBulletEject(PLAYER *pPlayer, int a2, int a3)
|
||||||
|
|
||||||
void SpawnShellEject(PLAYER *pPlayer, int a2, int a3)
|
void SpawnShellEject(PLAYER *pPlayer, int a2, int a3)
|
||||||
{
|
{
|
||||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||||
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
||||||
int t = pPlayer->zWeapon - pPlayer->zView;
|
int t = pPlayer->zWeapon - pPlayer->zView;
|
||||||
int dz = pPlayer->zWeapon-t+(t>>2);
|
int dz = pPlayer->zWeapon-t+(t>>2);
|
||||||
|
|
Loading…
Reference in a new issue