mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +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 mass = 0; int seqId = -1; Seq* pSeq = NULL;
|
||||
int mass = 0; int seqId = -1; int clipDist = pSprite->clipdist; Seq* pSeq = NULL;
|
||||
if (IsDudeSprite(pSprite)) {
|
||||
|
||||
switch (pSprite->type) {
|
||||
|
@ -7535,6 +7538,7 @@ int getSpriteMassBySize(spritetype* pSprite) {
|
|||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
seqId = xsprite[pSprite->extra].data2;
|
||||
clipDist = gGenDudeExtra[pSprite->index].initVals[2];
|
||||
break;
|
||||
default:
|
||||
seqId = dudeInfo[pSprite->type - kDudeBase].seqStartID;
|
||||
|
@ -7549,7 +7553,7 @@ int getSpriteMassBySize(spritetype* pSprite) {
|
|||
|
||||
SPRITEMASS* cached = &gSpriteMass[pSprite->extra];
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -7567,7 +7571,7 @@ int getSpriteMassBySize(spritetype* pSprite) {
|
|||
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 xrepeat = pSprite->xrepeat; short yrepeat = pSprite->yrepeat;
|
||||
|
||||
|
|
|
@ -1058,17 +1058,21 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
|
|||
actKillDude(nSource, pSprite, DAMAGE_TYPE_0, 65535);
|
||||
}
|
||||
} else if (canWalk(pSprite) && !inDodge(pXSprite->aiState) && !inRecoil(pXSprite->aiState)) {
|
||||
if (inIdle(pXSprite->aiState) || Chance(getDodgeChance(pSprite))) {
|
||||
if (!spriteIsUnderwater(pSprite, false)) {
|
||||
if (!canDuck(pSprite) || !sub_5BDA8(pSprite, 14)) aiGenDudeNewState(pSprite, &genDudeDodgeShortL);
|
||||
else aiGenDudeNewState(pSprite, &genDudeDodgeShortD);
|
||||
if (!dudeIsMelee(pXSprite)) {
|
||||
if (inIdle(pXSprite->aiState) || Chance(getDodgeChance(pSprite))) {
|
||||
if (!spriteIsUnderwater(pSprite, false)) {
|
||||
if (!canDuck(pSprite) || !sub_5BDA8(pSprite, 14)) aiGenDudeNewState(pSprite, &genDudeDodgeShortL);
|
||||
else aiGenDudeNewState(pSprite, &genDudeDodgeShortD);
|
||||
|
||||
if (Chance(0x0200))
|
||||
playGenDudeSound(pSprite, kGenDudeSndGotHit);
|
||||
if (Chance(0x0200))
|
||||
playGenDudeSound(pSprite, kGenDudeSndGotHit);
|
||||
|
||||
} else if (sub_5BDA8(pSprite, 13)) {
|
||||
aiGenDudeNewState(pSprite, &genDudeDodgeShortW);
|
||||
} else if (sub_5BDA8(pSprite, 13)) {
|
||||
aiGenDudeNewState(pSprite, &genDudeDodgeShortW);
|
||||
}
|
||||
}
|
||||
} else if (Chance(0x0200)) {
|
||||
playGenDudeSound(pSprite, kGenDudeSndGotHit);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1985,11 +1985,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
|||
if (!(sector[pSprite->sectnum].floorstat & 0x0001))
|
||||
pSprite->z += ClipHigh(sector[pSprite->sectnum].floorz - zBot, 0);
|
||||
|
||||
int curSumm = pSprite->xrepeat + pSprite->yrepeat; int defSumm = pExtra->initVals[0] + pExtra->initVals[1];
|
||||
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];
|
||||
|
||||
pSprite->clipdist = ClipRange((pSprite->xrepeat + pSprite->yrepeat) >> 1, 4, 120);
|
||||
if (propId) break;
|
||||
fallthrough__;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ int Handicap[] = {
|
|||
144, 208, 256, 304, 368
|
||||
};
|
||||
|
||||
int gDefaultAccel[] = {
|
||||
/*int gDefaultAccel[] = {
|
||||
|
||||
// normal human
|
||||
0x4000, 0x1200, 0x2000, // stand (front, side, back) / swim (front, side, back) / crouch (front, side, back)
|
||||
|
@ -148,229 +148,37 @@ int gDefaultJumpZ[] = {
|
|||
// grown human
|
||||
-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
|
||||
{
|
||||
{
|
||||
gDefaultAccel[0],
|
||||
gDefaultAccel[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],
|
||||
},
|
||||
{ 0x4000, 0x4000, 0x4000, 14, 17, 24, 16, 32, 80, 0x1600, 0x1200, 0xc00, 0x90, -0xbaaaa, -0x175555 },
|
||||
{ 0x1200, 0x1200, 0x1200, 14, 17, 24, 16, 32, 80, 0x1400, 0x1000, -0x600, 0xb0, 0x5b05, 0 },
|
||||
{ 0x2000, 0x2000, 0x2000, 22, 28, 24, 16, 16, 40, 0x800, 0x600, -0x600, 0xb0, 0, 0 },
|
||||
},
|
||||
|
||||
// normal beast
|
||||
{
|
||||
{
|
||||
gDefaultAccel[3],
|
||||
gDefaultAccel[3],
|
||||
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],
|
||||
},
|
||||
{ 0x4000, 0x4000, 0x4000, 14, 17, 24, 16, 32, 80, 0x1600, 0x1200, 0xc00, 0x90, -0xbaaaa, -0x175555 },
|
||||
{ 0x1200, 0x1200, 0x1200, 14, 17, 24, 16, 32, 80, 0x1400, 0x1000, -0x600, 0xb0, 0x5b05, 0 },
|
||||
{ 0x2000, 0x2000, 0x2000, 22, 28, 24, 16, 16, 40, 0x800, 0x600, -0x600, 0xb0, 0, 0 },
|
||||
},
|
||||
|
||||
// shrink human
|
||||
{
|
||||
{
|
||||
gDefaultAccel[6],
|
||||
gDefaultAccel[6],
|
||||
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],
|
||||
},
|
||||
{ 10384, 10384, 10384, 14, 17, 24, 16, 32, 80, 5632, 4608, 3072, 144, -564586, -1329173 },
|
||||
{ 2108, 2108, 2108, 14, 17, 24, 16, 32, 80, 5120, 4096, -1536, 176, 0x5b05, 0 },
|
||||
{ 2192, 2192, 2192, 22, 28, 24, 16, 16, 40, 2048, 1536, -1536, 176, 0, 0 },
|
||||
},
|
||||
|
||||
// grown human
|
||||
{
|
||||
{
|
||||
gDefaultAccel[9],
|
||||
gDefaultAccel[9],
|
||||
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],
|
||||
},
|
||||
{ 19384, 19384, 19384, 14, 17, 24, 16, 32, 80, 5632, 4608, 3072, 144, -1014586, -1779173 },
|
||||
{ 5608, 5608, 5608, 14, 17, 24, 16, 32, 80, 5120, 4096, -1536, 176, 0x5b05, 0 },
|
||||
{ 11192, 11192, 11192, 22, 28, 24, 16, 16, 40, 2048, 1536, -1536, 176, 0, 0 },
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -960,7 +768,7 @@ void playerSetGodMode(PLAYER *pPlayer, char bGodMode)
|
|||
|
||||
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->zWeapon = pPlayer->pSprite->z-pPosture->weaponAboveZ;
|
||||
viewBackupView(pPlayer->nPlayer);
|
||||
|
@ -1027,6 +835,7 @@ void playerStart(int nPlayer)
|
|||
DUDEINFO *pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];
|
||||
pPlayer->pDudeInfo = pDudeInfo;
|
||||
playerSetRace(pPlayer, kModeHuman);
|
||||
playerResetPosture(pPlayer);
|
||||
seqSpawn(pDudeInfo->seqStartID, 3, pSprite->extra, -1);
|
||||
if (pPlayer == gMe)
|
||||
SetBitString(show2dsprite, pSprite->index);
|
||||
|
@ -1105,6 +914,7 @@ void playerStart(int nPlayer)
|
|||
pPlayer->weaponTimer = 0;
|
||||
pPlayer->weaponState = 0;
|
||||
pPlayer->weaponQav = -1;
|
||||
playerResetQavScene(pPlayer); // reset qav scene
|
||||
pPlayer->hand = 0;
|
||||
pPlayer->nWaterPal = 0;
|
||||
playerResetPowerUps(pPlayer);
|
||||
|
@ -1121,18 +931,6 @@ void playerStart(int nPlayer)
|
|||
pPlayer->posture = 1;
|
||||
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)
|
||||
|
@ -1182,30 +980,13 @@ void playerReset(PLAYER *pPlayer)
|
|||
// reset qav scene
|
||||
playerResetQavScene(pPlayer);
|
||||
|
||||
// restore default movement speed
|
||||
playerResetMoveSpeed(pPlayer);
|
||||
|
||||
// restore default jump height
|
||||
playerResetJumpHeight(pPlayer);
|
||||
// reset posture (mainly required for resetting movement speed and jump height)
|
||||
playerResetPosture(pPlayer);
|
||||
/////////////////
|
||||
}
|
||||
|
||||
void playerResetMoveSpeed(PLAYER* pPlayer) {
|
||||
for (int i = kModeHuman, k = 0; i < kModeMax; i++) {
|
||||
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 playerResetPosture(PLAYER* pPlayer) {
|
||||
memcpy(pPlayer->pPosture, gPostureDefaults, sizeof(gPostureDefaults));
|
||||
}
|
||||
|
||||
void playerResetQavScene(PLAYER* pPlayer) {
|
||||
|
@ -1230,6 +1011,7 @@ void playerInit(int nPlayer, unsigned int a2)
|
|||
memset(dword_21EFB0, 0, sizeof(dword_21EFB0));
|
||||
memset(dword_21EFD0, 0, sizeof(dword_21EFD0));
|
||||
memset(pPlayer->fragInfo, 0, sizeof(pPlayer->fragInfo));
|
||||
|
||||
if (!(a2&1))
|
||||
playerReset(pPlayer);
|
||||
}
|
||||
|
@ -1656,7 +1438,7 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
spritetype *pSprite = pPlayer->pSprite;
|
||||
XSPRITE *pXSprite = pPlayer->pXSprite;
|
||||
int nSprite = pPlayer->nSprite;
|
||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
GINPUT *pInput = &pPlayer->input;
|
||||
pPlayer->isRunning = pInput->syncFlags.run;
|
||||
if (pInput->buttonFlags.byte || pInput->forward || pInput->strafe || pInput->q16turn)
|
||||
|
@ -2017,7 +1799,7 @@ void playerProcess(PLAYER *pPlayer)
|
|||
int nSprite = pPlayer->nSprite;
|
||||
int nXSprite = pSprite->extra;
|
||||
XSPRITE *pXSprite = pPlayer->pXSprite;
|
||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
powerupProcess(pPlayer);
|
||||
int top, bottom;
|
||||
GetSpriteExtents(pSprite, &top, &bottom);
|
||||
|
|
|
@ -21,164 +21,53 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
#pragma once
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
#include "fix16.h"
|
||||
#include "common_game.h"
|
||||
#include "actor.h"
|
||||
#include "blood.h"
|
||||
#include "build.h"
|
||||
#include "common_game.h"
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#include "controls.h"
|
||||
#include "db.h"
|
||||
#include "dude.h"
|
||||
#include "fix16.h"
|
||||
#include "levels.h"
|
||||
#include "qav.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
// life modes of the player
|
||||
enum {
|
||||
kModeHuman = 0,
|
||||
kModeBeast = 1,
|
||||
kModeHumanShrink = 2,
|
||||
kModeHumanGrown = 3,
|
||||
kModeMax = 4,
|
||||
enum
|
||||
{
|
||||
kModeHuman = 0,
|
||||
kModeBeast = 1,
|
||||
kModeHumanShrink = 2,
|
||||
kModeHumanGrown = 3,
|
||||
kModeMax = 4,
|
||||
};
|
||||
|
||||
// postures
|
||||
enum {
|
||||
kPostureStand = 0,
|
||||
kPostureCrouch = 1,
|
||||
kPostureSwim = 2,
|
||||
kPostureMax = 3,
|
||||
enum
|
||||
{
|
||||
kPostureStand = 0,
|
||||
kPostureCrouch = 1,
|
||||
kPostureSwim = 2,
|
||||
kPostureMax = 3,
|
||||
};
|
||||
|
||||
struct PACKINFO {
|
||||
struct PACKINFO
|
||||
{
|
||||
bool isActive; // is active (0/1)
|
||||
int curAmount = 0; // remaining percent
|
||||
};
|
||||
|
||||
struct PLAYER {
|
||||
spritetype *pSprite;
|
||||
XSPRITE *pXSprite;
|
||||
DUDEINFO *pDudeInfo;
|
||||
GINPUT input;
|
||||
//short input; // INPUT
|
||||
//char moveFunc; // forward
|
||||
//short at11; // turn
|
||||
//char hearDist; // strafe
|
||||
//int bobV; // buttonFlags
|
||||
//unsigned int bobH; // keyFlags
|
||||
//char swayV; // useFlags;
|
||||
//char swayH; // newWeapon
|
||||
//char at21; // mlook
|
||||
int used1; // something related to game checksum
|
||||
int weaponQav;
|
||||
int qavCallback;
|
||||
bool isRunning;
|
||||
int posture; // stand, crouch, swim
|
||||
int sceneQav; // by NoOne: used to keep qav id
|
||||
int bobPhase;
|
||||
int bobAmp;
|
||||
int bobHeight;
|
||||
int bobWidth;
|
||||
int swayPhase;
|
||||
int swayAmp;
|
||||
int swayHeight;
|
||||
int swayWidth;
|
||||
int nPlayer; // Connect id
|
||||
int nSprite;
|
||||
int lifeMode;
|
||||
int bloodlust; // ---> useless
|
||||
int zView;
|
||||
int zViewVel;
|
||||
int zWeapon;
|
||||
int zWeaponVel;
|
||||
fix16_t q16look;
|
||||
int q16horiz; // horiz
|
||||
int q16slopehoriz; // horizoff
|
||||
int slope;
|
||||
bool isUnderwater;
|
||||
bool hasKey[8];
|
||||
char hasFlag;
|
||||
short used2[8]; // ??
|
||||
int damageControl[7];
|
||||
char curWeapon;
|
||||
char nextWeapon;
|
||||
int weaponTimer;
|
||||
int weaponState;
|
||||
int weaponAmmo; //rename
|
||||
bool hasWeapon[14];
|
||||
int weaponMode[14];
|
||||
int weaponOrder[2][14];
|
||||
//int at149[14];
|
||||
int ammoCount[12];
|
||||
bool qavLoop;
|
||||
int fuseTime;
|
||||
int throwTime;
|
||||
int throwPower;
|
||||
Aim aim; // world
|
||||
//int at1c6;
|
||||
Aim relAim; // relative
|
||||
//int relAim;
|
||||
//int at1ce;
|
||||
//int at1d2;
|
||||
int aimTarget; // aim target sprite
|
||||
int aimTargetsCount;
|
||||
short aimTargets[16];
|
||||
int deathTime;
|
||||
int pwUpTime[kMaxPowerUps];
|
||||
int fragCount;
|
||||
int fragInfo[8];
|
||||
int teamId;
|
||||
int fraggerId;
|
||||
int underwaterTime;
|
||||
int bloodTime; // --> useless
|
||||
int gooTime; // --> useless
|
||||
int wetTime; // --> useless
|
||||
int bubbleTime;
|
||||
int at306; // --> useless
|
||||
int restTime;
|
||||
int kickPower;
|
||||
int laughCount;
|
||||
int spin; // turning around
|
||||
bool godMode;
|
||||
bool fallScream;
|
||||
bool cantJump;
|
||||
int packItemTime; // pack timer
|
||||
int packItemId; // pack id 1: diving suit, 2: crystal ball, 3: beast vision 4: jump boots
|
||||
PACKINFO packSlots[5]; // at325 [1]: diving suit, [2]: crystal ball, [3]: beast vision [4]: jump boots
|
||||
int armor[3]; // armor
|
||||
//int at342;
|
||||
//int at346;
|
||||
int voodooTarget;
|
||||
int voodooTargets; // --> useless
|
||||
int voodooVar1; // --> useless
|
||||
int vodooVar2; // --> useless
|
||||
int flickerEffect;
|
||||
int tiltEffect;
|
||||
int visibility;
|
||||
int painEffect;
|
||||
int blindEffect;
|
||||
int chokeEffect;
|
||||
int handTime;
|
||||
bool hand; // if true, there is hand start choking the player
|
||||
int pickupEffect;
|
||||
bool flashEffect; // if true, reduce pPlayer->visibility counter
|
||||
int quakeEffect;
|
||||
fix16_t q16ang;
|
||||
int angold;
|
||||
int player_par;
|
||||
int nWaterPal;
|
||||
};
|
||||
|
||||
// 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 POSTURE
|
||||
{
|
||||
int frontAccel;
|
||||
int sideAccel;
|
||||
int backAccel;
|
||||
|
@ -191,25 +80,146 @@ struct POSTURE {
|
|||
int weaponAboveZ;
|
||||
int xOffset;
|
||||
int zOffset;
|
||||
int normalJumpZ;
|
||||
int pwupJumpZ;
|
||||
int normalJumpZ;
|
||||
int pwupJumpZ;
|
||||
};
|
||||
|
||||
extern POSTURE gPosture[kModeMax][kPostureMax];
|
||||
extern POSTURE gPostureDefaults[kModeMax][kPostureMax];
|
||||
|
||||
struct PROFILE {
|
||||
struct PLAYER
|
||||
{
|
||||
spritetype* pSprite;
|
||||
XSPRITE* pXSprite;
|
||||
DUDEINFO* pDudeInfo;
|
||||
GINPUT input;
|
||||
//short input; // INPUT
|
||||
//char moveFunc; // forward
|
||||
//short at11; // turn
|
||||
//char hearDist; // strafe
|
||||
//int bobV; // buttonFlags
|
||||
//unsigned int bobH; // keyFlags
|
||||
//char swayV; // useFlags;
|
||||
//char swayH; // newWeapon
|
||||
//char at21; // mlook
|
||||
int used1; // something related to game checksum
|
||||
int weaponQav;
|
||||
int qavCallback;
|
||||
bool isRunning;
|
||||
int posture; // stand, crouch, swim
|
||||
int sceneQav; // by NoOne: used to keep qav id
|
||||
int bobPhase;
|
||||
int bobAmp;
|
||||
int bobHeight;
|
||||
int bobWidth;
|
||||
int swayPhase;
|
||||
int swayAmp;
|
||||
int swayHeight;
|
||||
int swayWidth;
|
||||
int nPlayer; // Connect id
|
||||
int nSprite;
|
||||
int lifeMode;
|
||||
int bloodlust; // ---> useless
|
||||
int zView;
|
||||
int zViewVel;
|
||||
int zWeapon;
|
||||
int zWeaponVel;
|
||||
fix16_t q16look;
|
||||
int q16horiz; // horiz
|
||||
int q16slopehoriz; // horizoff
|
||||
int slope;
|
||||
bool isUnderwater;
|
||||
bool hasKey[8];
|
||||
char hasFlag;
|
||||
short used2[8]; // ??
|
||||
int damageControl[7];
|
||||
char curWeapon;
|
||||
char nextWeapon;
|
||||
int weaponTimer;
|
||||
int weaponState;
|
||||
int weaponAmmo; //rename
|
||||
bool hasWeapon[14];
|
||||
int weaponMode[14];
|
||||
int weaponOrder[2][14];
|
||||
//int at149[14];
|
||||
int ammoCount[12];
|
||||
bool qavLoop;
|
||||
int fuseTime;
|
||||
int throwTime;
|
||||
int throwPower;
|
||||
Aim aim; // world
|
||||
//int at1c6;
|
||||
Aim relAim; // relative
|
||||
//int relAim;
|
||||
//int at1ce;
|
||||
//int at1d2;
|
||||
int aimTarget; // aim target sprite
|
||||
int aimTargetsCount;
|
||||
short aimTargets[16];
|
||||
int deathTime;
|
||||
int pwUpTime[kMaxPowerUps];
|
||||
int fragCount;
|
||||
int fragInfo[8];
|
||||
int teamId;
|
||||
int fraggerId;
|
||||
int underwaterTime;
|
||||
int bloodTime; // --> useless
|
||||
int gooTime; // --> useless
|
||||
int wetTime; // --> useless
|
||||
int bubbleTime;
|
||||
int at306; // --> useless
|
||||
int restTime;
|
||||
int kickPower;
|
||||
int laughCount;
|
||||
int spin; // turning around
|
||||
bool godMode;
|
||||
bool fallScream;
|
||||
bool cantJump;
|
||||
int packItemTime; // pack timer
|
||||
int packItemId; // pack id 1: diving suit, 2: crystal ball, 3: beast vision 4: jump boots
|
||||
PACKINFO packSlots[5]; // at325 [1]: diving suit, [2]: crystal ball, [3]: beast vision [4]: jump boots
|
||||
int armor[3]; // armor
|
||||
//int at342;
|
||||
//int at346;
|
||||
int voodooTarget;
|
||||
int voodooTargets; // --> useless
|
||||
int voodooVar1; // --> useless
|
||||
int vodooVar2; // --> useless
|
||||
int flickerEffect;
|
||||
int tiltEffect;
|
||||
int visibility;
|
||||
int painEffect;
|
||||
int blindEffect;
|
||||
int chokeEffect;
|
||||
int handTime;
|
||||
bool hand; // if true, there is hand start choking the player
|
||||
int pickupEffect;
|
||||
bool flashEffect; // if true, reduce pPlayer->visibility counter
|
||||
int quakeEffect;
|
||||
fix16_t q16ang;
|
||||
int angold;
|
||||
int player_par;
|
||||
int nWaterPal;
|
||||
POSTURE pPosture[kModeMax][kPostureMax];
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct PROFILE
|
||||
{
|
||||
int nAutoAim;
|
||||
int nWeaponSwitch;
|
||||
int skill;
|
||||
char name[MAXPLAYERNAME];
|
||||
};
|
||||
|
||||
struct AMMOINFO {
|
||||
struct AMMOINFO
|
||||
{
|
||||
int max;
|
||||
signed char vectorType;
|
||||
};
|
||||
|
||||
struct POWERUPINFO {
|
||||
struct POWERUPINFO
|
||||
{
|
||||
short picnum;
|
||||
bool pickupOnce;
|
||||
int bonusTime;
|
||||
|
@ -219,16 +229,18 @@ struct POWERUPINFO {
|
|||
|
||||
#define kQavSceneStackSize 16
|
||||
// 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
|
||||
QAV* qavResrc = NULL;
|
||||
QAV * qavResrc = NULL;
|
||||
short causedBy = -1;
|
||||
|
||||
// TO-DO: Stack of animations which allows to pop and push (restoring previous animation instead of weapon once current animation is played)
|
||||
};
|
||||
|
||||
// by NoOne: this one for controlling the player using triggers (movement speed, jumps and other stuff)
|
||||
struct TRPLAYERCTRL {
|
||||
struct TRPLAYERCTRL
|
||||
{
|
||||
QAVSCENE qavScene;
|
||||
};
|
||||
|
||||
|
@ -247,7 +259,7 @@ extern ClockTicks dword_21EFD0[kMaxPlayers];
|
|||
extern AMMOINFO gAmmoInfo[];
|
||||
extern POWERUPINFO gPowerUpInfo[kMaxPowerUps];
|
||||
|
||||
inline bool IsTargetTeammate(PLAYER* pSourcePlayer, spritetype* pTargetSprite)
|
||||
inline bool IsTargetTeammate(PLAYER *pSourcePlayer, spritetype *pTargetSprite)
|
||||
{
|
||||
if (pSourcePlayer == NULL)
|
||||
return false;
|
||||
|
@ -255,7 +267,7 @@ inline bool IsTargetTeammate(PLAYER* pSourcePlayer, spritetype* pTargetSprite)
|
|||
return false;
|
||||
if (gGameOptions.nGameType == 1 || gGameOptions.nGameType == 3)
|
||||
{
|
||||
PLAYER* pTargetPlayer = &gPlayer[pTargetSprite->type - kDudePlayer1];
|
||||
PLAYER *pTargetPlayer = &gPlayer[pTargetSprite->type - kDudePlayer1];
|
||||
if (pSourcePlayer != pTargetPlayer)
|
||||
{
|
||||
if (gGameOptions.nGameType == 1)
|
||||
|
@ -268,11 +280,11 @@ inline bool IsTargetTeammate(PLAYER* pSourcePlayer, spritetype* pTargetSprite)
|
|||
return false;
|
||||
}
|
||||
|
||||
inline bool IsTargetTeammate(spritetype* pSourceSprite, spritetype* pTargetSprite)
|
||||
inline bool IsTargetTeammate(spritetype *pSourceSprite, spritetype *pTargetSprite)
|
||||
{
|
||||
if (!IsPlayerSprite(pSourceSprite))
|
||||
return false;
|
||||
PLAYER* pSourcePlayer = &gPlayer[pSourceSprite->type - kDudePlayer1];
|
||||
PLAYER *pSourcePlayer = &gPlayer[pSourceSprite->type - kDudePlayer1];
|
||||
return IsTargetTeammate(pSourcePlayer, pTargetSprite);
|
||||
}
|
||||
|
||||
|
@ -291,11 +303,11 @@ char packItemActive(PLAYER *pPlayer, int nPack);
|
|||
void packUseItem(PLAYER *pPlayer, int nPack);
|
||||
void packPrevItem(PLAYER *pPlayer);
|
||||
void packNextItem(PLAYER *pPlayer);
|
||||
char playerSeqPlaying(PLAYER * pPlayer, int nSeq);
|
||||
char playerSeqPlaying(PLAYER *pPlayer, int nSeq);
|
||||
void playerSetRace(PLAYER *pPlayer, int nLifeMode);
|
||||
void playerSetGodMode(PLAYER *pPlayer, char bGodMode);
|
||||
void playerResetInertia(PLAYER *pPlayer);
|
||||
void playerCorrectInertia(PLAYER* pPlayer, vec3_t const *oldpos);
|
||||
void playerCorrectInertia(PLAYER *pPlayer, vec3_t const *oldpos);
|
||||
void playerStart(int nPlayer);
|
||||
void playerReset(PLAYER *pPlayer);
|
||||
void playerInit(int nPlayer, unsigned int a2);
|
||||
|
@ -320,18 +332,17 @@ void sub_41250(PLAYER *pPlayer);
|
|||
void playerLandingSound(PLAYER *pPlayer);
|
||||
void PlayerSurvive(int, int nXSprite);
|
||||
void PlayerKneelsOver(int, int nXSprite);
|
||||
bool isGrown(spritetype* pSprite);
|
||||
bool isShrinked(spritetype* pSprite);
|
||||
bool shrinkPlayerSize(PLAYER* pPlayer, int divider);
|
||||
bool growPlayerSize(PLAYER* pPlayer, int multiplier);
|
||||
bool resetPlayerSize(PLAYER* pPlayer);
|
||||
void deactivateSizeShrooms(PLAYER* pPlayer);
|
||||
PLAYER* getPlayerById(short id);
|
||||
QAV* qavSceneLoad(int qavId);
|
||||
void qavScenePlay(PLAYER* pPlayer);
|
||||
void qavSceneDraw(PLAYER* pPlayer, int a2, int a3, int a4, int a5);
|
||||
void playerResetMoveSpeed(PLAYER* pPlayer);
|
||||
void playerResetJumpHeight(PLAYER* pPlayer);
|
||||
void playerResetQavScene(PLAYER* pPlayer);
|
||||
bool isGrown(spritetype *pSprite);
|
||||
bool isShrinked(spritetype *pSprite);
|
||||
bool shrinkPlayerSize(PLAYER *pPlayer, int divider);
|
||||
bool growPlayerSize(PLAYER *pPlayer, int multiplier);
|
||||
bool resetPlayerSize(PLAYER *pPlayer);
|
||||
void deactivateSizeShrooms(PLAYER *pPlayer);
|
||||
PLAYER * getPlayerById(short id);
|
||||
QAV * qavSceneLoad(int qavId);
|
||||
void qavScenePlay(PLAYER *pPlayer);
|
||||
void qavSceneDraw(PLAYER *pPlayer, int a2, int a3, int a4, int a5);
|
||||
void playerResetPosture(PLAYER* pPlayer);
|
||||
void playerResetQavScene(PLAYER *pPlayer);
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -905,36 +905,41 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
|
|||
break;
|
||||
|
||||
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)) {
|
||||
for (int i = 0, speed = pXSprite->data2 << 1, k = 0; i < kModeMax; i++) {
|
||||
for (int a = 0; a < kPostureMax; a++, k++) {
|
||||
int defSpeed = gDefaultAccel[k];
|
||||
if (pXSprite->data1 == 100)
|
||||
gPosture[i][a].frontAccel = gPosture[i][a].sideAccel = gPosture[i][a].backAccel = defSpeed;
|
||||
else if (speed >= 0)
|
||||
gPosture[i][a].frontAccel = gPosture[i][a].sideAccel = gPosture[i][a].backAccel = ClipRange(mulscale8(defSpeed, speed), 0, 65535);
|
||||
int speed = pXSprite->data2 << 1;
|
||||
for (int i = 0; i < kModeMax; i++) {
|
||||
for (int a = 0; a < kPostureMax; a++) {
|
||||
POSTURE* curPosture = &pPlayer->pPosture[i][a]; POSTURE defPosture = gPostureDefaults[i][a];
|
||||
if (pXSprite->data2 == 100) {
|
||||
curPosture->frontAccel = defPosture.frontAccel;
|
||||
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);
|
||||
}
|
||||
|
||||
// player jump height (for all players ATM)
|
||||
// player jump height (for all races and stand posture only)
|
||||
if (valueIsBetween(pXSprite->data3, -1, 32767)) {
|
||||
for (int i = 0, jump = pXSprite->data3 * 3, k = 0; i < kModeMax; i++) {
|
||||
for (int a = 0; a < kPostureMax; a++) {
|
||||
int njmp = gDefaultJumpZ[k++]; int pjmp = gDefaultJumpZ[k++];
|
||||
if (a != kPostureStand) continue;
|
||||
else if (pXSprite->data3 == 100) {
|
||||
gPosture[i][a].normalJumpZ = njmp;
|
||||
gPosture[i][a].pwupJumpZ = pjmp;
|
||||
} else if (jump >= 0) {
|
||||
gPosture[i][a].normalJumpZ = ClipRange(mulscale8(njmp, jump), -0x200000, 0);
|
||||
gPosture[i][a].pwupJumpZ = ClipRange(mulscale8(pjmp, jump), -0x200000, 0);
|
||||
}
|
||||
int jump = pXSprite->data3 * 3;
|
||||
for (int i = 0; i < kModeMax; i++) {
|
||||
POSTURE* curPosture = &pPlayer->pPosture[i][kPostureStand]; POSTURE defPosture = gPostureDefaults[i][kPostureStand];
|
||||
if (pXSprite->data3 == 100) {
|
||||
curPosture->normalJumpZ = defPosture.normalJumpZ;
|
||||
curPosture->pwupJumpZ = defPosture.pwupJumpZ;
|
||||
} else if (jump >= 0) {
|
||||
curPosture->normalJumpZ = ClipRange(mulscale8(defPosture.normalJumpZ, jump), -0x200000, 0);
|
||||
curPosture->pwupJumpZ = ClipRange(mulscale8(defPosture.pwupJumpZ, jump), -0x200000, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//viewSetSystemMessage("JUMPING: %d", gPosture[0][0].normalJumpZ);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -305,13 +305,13 @@ void viewUpdatePrediction(GINPUT *pInput)
|
|||
|
||||
void sub_158B4(PLAYER *pPlayer)
|
||||
{
|
||||
predict.at38 = predict.at58 - gPosture[pPlayer->lifeMode][predict.at48].eyeAboveZ;
|
||||
predict.at40 = predict.at58 - gPosture[pPlayer->lifeMode][predict.at48].weaponAboveZ;
|
||||
predict.at38 = predict.at58 - pPlayer->pPosture[pPlayer->lifeMode][predict.at48].eyeAboveZ;
|
||||
predict.at40 = predict.at58 - pPlayer->pPosture[pPlayer->lifeMode][predict.at48].weaponAboveZ;
|
||||
}
|
||||
|
||||
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 = 0;
|
||||
predict.at71 = pInput->buttonFlags.jump;
|
||||
|
@ -490,7 +490,7 @@ void fakePlayerProcess(PLAYER *pPlayer, GINPUT *pInput)
|
|||
{
|
||||
spritetype *pSprite = pPlayer->pSprite;
|
||||
XSPRITE *pXSprite = pPlayer->pXSprite;
|
||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][predict.at48];
|
||||
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][predict.at48];
|
||||
|
||||
int 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)) {
|
||||
auto pNTSprite = viewAddEffect(nTSprite, VIEW_EFFECT_14);
|
||||
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->y += mulscale28(pPosture->zOffset, Sin(pTSprite->ang));
|
||||
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)
|
||||
{
|
||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
||||
int dz = pPlayer->zWeapon-(pPlayer->zWeapon-pPlayer->zView)/2;
|
||||
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)
|
||||
{
|
||||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
||||
int t = pPlayer->zWeapon - pPlayer->zView;
|
||||
int dz = pPlayer->zWeapon-t+(t>>2);
|
||||
|
|
Loading…
Reference in a new issue