mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 04:24:39 +00:00
Merge branch 'master' into witchaven2
# Conflicts: # source/core/packet.h # wadsrc/static/menudef.txt
This commit is contained in:
commit
5d77b1fd25
83 changed files with 8606 additions and 9068 deletions
|
@ -450,6 +450,8 @@ if( VPX_FOUND )
|
|||
add_definitions( "-DUSE_LIBVPX=1" )
|
||||
include_directories( "${VPX_INCLUDE_DIR}" )
|
||||
set( PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${VPX_LIBRARIES} )
|
||||
else()
|
||||
message( SEND_ERROR "Could not find libvpx" )
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
return;
|
||||
}
|
||||
|
||||
PLAYER* pPlayer = &gPlayer[myconnectindex];
|
||||
double const scaleAdjust = InputScale();
|
||||
InputPacket input {};
|
||||
|
||||
|
@ -50,12 +51,10 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
|
||||
if (!cl_syncinput && gamestate == GS_LEVEL)
|
||||
{
|
||||
PLAYER* pPlayer = &gPlayer[myconnectindex];
|
||||
|
||||
// Perform unsynchronised angle/horizon if not dead.
|
||||
if (gView->pXSprite->health != 0)
|
||||
{
|
||||
applylook(&pPlayer->angle, input.avel, &pPlayer->input.actions, scaleAdjust, pPlayer->posture != 0);
|
||||
applylook(&pPlayer->angle, input.avel, &pPlayer->input.actions, scaleAdjust);
|
||||
sethorizon(&pPlayer->horizon.horiz, input.horz, &pPlayer->input.actions, scaleAdjust);
|
||||
}
|
||||
|
||||
|
|
|
@ -1445,7 +1445,7 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
|
||||
if (cl_syncinput)
|
||||
{
|
||||
applylook(&pPlayer->angle, pInput->avel, &pInput->actions, 1, pPlayer->posture != 0);
|
||||
applylook(&pPlayer->angle, pInput->avel, &pInput->actions);
|
||||
UpdatePlayerSpriteAngle(pPlayer);
|
||||
}
|
||||
|
||||
|
@ -1493,14 +1493,20 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
if (pXSector->locked && pPlayer == gMe)
|
||||
{
|
||||
viewSetMessage(GStrings("TXTB_LOCKED"));
|
||||
sndStartSample(3062, 255, 2, 0);
|
||||
auto snd = 3062;
|
||||
if (sndCheckPlaying(snd))
|
||||
sndStopSample(snd);
|
||||
sndStartSample(snd, 255, 2, 0);
|
||||
}
|
||||
if (!key || pPlayer->hasKey[key])
|
||||
trTriggerSector(a2, pXSector, kCmdSpritePush);
|
||||
else if (pPlayer == gMe)
|
||||
{
|
||||
viewSetMessage(GStrings("TXTB_KEY"));
|
||||
sndStartSample(3063, 255, 2, 0);
|
||||
auto snd = 3063;
|
||||
if (sndCheckPlaying(snd))
|
||||
sndStopSample(snd);
|
||||
sndStartSample(snd, 255, 2, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1511,14 +1517,20 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
if (pXWall->locked && pPlayer == gMe)
|
||||
{
|
||||
viewSetMessage(GStrings("TXTB_LOCKED"));
|
||||
sndStartSample(3062, 255, 2, 0);
|
||||
auto snd = 3062;
|
||||
if (sndCheckPlaying(snd))
|
||||
sndStopSample(snd);
|
||||
sndStartSample(snd, 255, 2, 0);
|
||||
}
|
||||
if (!key || pPlayer->hasKey[key])
|
||||
trTriggerWall(a2, pXWall, kCmdWallPush);
|
||||
else if (pPlayer == gMe)
|
||||
{
|
||||
viewSetMessage(GStrings("TXTB_KEY"));
|
||||
sndStartSample(3063, 255, 2, 0);
|
||||
auto snd = 3063;
|
||||
if (sndCheckPlaying(snd))
|
||||
sndStopSample(snd);
|
||||
sndStartSample(snd, 255, 2, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1557,7 +1569,7 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
|
||||
if (cl_syncinput)
|
||||
{
|
||||
sethorizon(&pPlayer->horizon.horiz, pInput->horz, &pInput->actions, 1);
|
||||
sethorizon(&pPlayer->horizon.horiz, pInput->horz, &pInput->actions);
|
||||
}
|
||||
|
||||
int nSector = pSprite->sectnum;
|
||||
|
|
|
@ -144,6 +144,22 @@ void SoundCallback(intptr_t val)
|
|||
pChannel->TotalKills = 0;
|
||||
}
|
||||
|
||||
bool sndCheckPlaying(unsigned int nSound)
|
||||
{
|
||||
auto snd = soundEngine->FindSoundByResID(nSound);
|
||||
return snd > 0 ? soundEngine->GetSoundPlayingInfo(SOURCE_Any, nullptr, snd) : false;
|
||||
}
|
||||
|
||||
void sndStopSample(unsigned int nSound)
|
||||
{
|
||||
auto snd = soundEngine->FindSoundByResID(nSound);
|
||||
|
||||
if (snd > 0)
|
||||
{
|
||||
soundEngine->StopSoundID(snd);
|
||||
}
|
||||
}
|
||||
|
||||
void sndStartSample(const char *pzSound, int nVolume, int nChannel)
|
||||
{
|
||||
if (!SoundEnabled())
|
||||
|
|
|
@ -45,6 +45,8 @@ struct SFX
|
|||
};
|
||||
|
||||
int sndGetRate(int format);
|
||||
bool sndCheckPlaying(unsigned int nSound);
|
||||
void sndStopSample(unsigned int nSound);
|
||||
void sndStartSample(const char *pzSound, int nVolume, int nChannel = -1);
|
||||
void sndStartSample(unsigned int nSound, int nVolume, int nChannel = -1, bool bLoop = false, EChanFlags soundflags = CHANF_NONE);
|
||||
void sndStartWavID(unsigned int nSound, int nVolume, int nChannel = -1);
|
||||
|
|
|
@ -69,8 +69,6 @@ int32_t voxscale[MAXVOXELS];
|
|||
|
||||
static int32_t beforedrawrooms = 1;
|
||||
|
||||
static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1;
|
||||
|
||||
int32_t globalflags;
|
||||
|
||||
static int8_t tempbuf[MAXWALLS];
|
||||
|
@ -399,49 +397,6 @@ static inline void initksqrt(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// dosetaspect
|
||||
//
|
||||
static void dosetaspect(void)
|
||||
{
|
||||
int32_t i, j;
|
||||
|
||||
if (xyaspect != oxyaspect)
|
||||
{
|
||||
oxyaspect = xyaspect;
|
||||
j = xyaspect*320;
|
||||
}
|
||||
|
||||
if (xdimen != oxdimen || viewingrange != oviewingrange)
|
||||
{
|
||||
int32_t k, x, xinc;
|
||||
|
||||
no_radarang2 = 0;
|
||||
oviewingrange = viewingrange;
|
||||
|
||||
xinc = mulscale32(viewingrange*2560,xdimenrecip);
|
||||
x = IntToFixed(5120)-mulscale1(xinc,xdimen);
|
||||
|
||||
for (i=0; i<xdimen; i++)
|
||||
{
|
||||
j = (x&65535); k = FixedToInt(x); x += xinc;
|
||||
|
||||
if (k < 0 || k >= (int32_t)countof(qradarang)-1)
|
||||
{
|
||||
no_radarang2 = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (j != 0)
|
||||
j = mulscale16(qradarang[k+1]-qradarang[k], j);
|
||||
}
|
||||
|
||||
oxdimen = xdimen;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int32_t engineLoadTables(void)
|
||||
{
|
||||
static char tablesloaded = 0;
|
||||
|
@ -1092,9 +1047,6 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
|
|||
|
||||
globalcursectnum = dacursectnum;
|
||||
|
||||
if ((xyaspect != oxyaspect) || (xdimen != oxdimen) || (viewingrange != oviewingrange))
|
||||
dosetaspect();
|
||||
|
||||
memset(gotsector, 0, sizeof(gotsector));
|
||||
|
||||
i = xdimen-1;
|
||||
|
@ -2183,9 +2135,6 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
|||
renderFillPolygon(npoints);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
renderSetAspect(oviewingrange, oyxaspect);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2219,9 +2168,6 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
|
|||
|
||||
j = ydim*4; //Leave room for horizlookup&horizlookup2
|
||||
|
||||
//Force drawrooms to call dosetaspect & recalculate stuff
|
||||
oxyaspect = oxdimen = oviewingrange = -1;
|
||||
|
||||
videoSetViewableArea(0L,0L,xdim-1,ydim-1);
|
||||
videoClearScreen(0L);
|
||||
|
||||
|
|
|
@ -242,6 +242,27 @@ DEFINE_ACTION_FUNCTION(FFont, BreakLines)
|
|||
ACTION_RETURN_OBJECT(Create<DBrokenLines>(broken));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FFont, BreakLines2)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FFont);
|
||||
PARAM_STRING(text);
|
||||
PARAM_INT(maxwidth);
|
||||
|
||||
auto broken = V_BreakLines(self, maxwidth, text, true);
|
||||
ACTION_RETURN_OBJECT(Create<DBrokenLines>(broken));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Hugohaft, BreakLines)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FFont);
|
||||
PARAM_STRING(text);
|
||||
PARAM_INT(maxwidth);
|
||||
|
||||
auto broken = V_BreakLines(self, maxwidth, text, true);
|
||||
ACTION_RETURN_OBJECT(Create<DBrokenLines>(broken));
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool generic_ui;
|
||||
EXTERN_CVAR(String, language)
|
||||
|
|
|
@ -266,7 +266,7 @@ private:
|
|||
|
||||
void *operator new(size_t len, nonew&)
|
||||
{
|
||||
return M_Malloc(len);
|
||||
return M_Calloc(len, 1);
|
||||
}
|
||||
public:
|
||||
|
||||
|
|
|
@ -79,8 +79,8 @@ void VMFunction::CreateRegUse()
|
|||
int count = 0;
|
||||
if (!Proto)
|
||||
{
|
||||
if (RegTypes) return;
|
||||
Printf(TEXTCOLOR_ORANGE "Function without prototype needs register info manually set: %s\n", PrintableName.GetChars());
|
||||
//if (RegTypes) return;
|
||||
//Printf(TEXTCOLOR_ORANGE "Function without prototype needs register info manually set: %s\n", PrintableName.GetChars());
|
||||
return;
|
||||
}
|
||||
assert(Proto->isPrototype());
|
||||
|
|
|
@ -110,8 +110,8 @@ void FNotifyBuffer::DrawNative()
|
|||
// * top left for Exhumed
|
||||
// * 4 lines with the tiny font for Blood. (same mechanic as the regular one, just a different font and scale.)
|
||||
|
||||
bool center = g_gameType & (GAMEFLAG_DUKE | GAMEFLAG_NAM | GAMEFLAG_WW2GI | GAMEFLAG_RR | GAMEFLAG_SW);
|
||||
bool pulse = g_gameType & (GAMEFLAG_DUKE | GAMEFLAG_NAM | GAMEFLAG_WW2GI | GAMEFLAG_RR);
|
||||
bool center = g_gameType & (GAMEFLAG_DUKE | GAMEFLAG_NAM | GAMEFLAG_WW2GI | GAMEFLAG_RRALL | GAMEFLAG_SW);
|
||||
bool pulse = g_gameType & (GAMEFLAG_DUKE | GAMEFLAG_NAM | GAMEFLAG_WW2GI | GAMEFLAG_RRALL);
|
||||
unsigned topline = g_gameType & GAMEFLAG_BLOOD ? 0 : Text.Size() - 1;
|
||||
|
||||
FFont* font = g_gameType & GAMEFLAG_BLOOD ? SmallFont2 : SmallFont;
|
||||
|
|
|
@ -21,6 +21,7 @@ extern bool GUICapture;
|
|||
extern bool AppActive;
|
||||
extern cycle_t drawtime, actortime, thinktime, gameupdatetime;
|
||||
extern bool r_NoInterpolate;
|
||||
extern bool crouch_toggle;
|
||||
|
||||
struct MapRecord;
|
||||
extern MapRecord* g_nextmap;
|
||||
|
|
|
@ -133,8 +133,8 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
|
|||
|
||||
// process remaining controller input.
|
||||
currInput->horz -= scaleAdjust * hidInput->dpitch * hidspeed;
|
||||
currInput->svel -= xs_CRoundToInt(scaleAdjust * hidInput->dx * keymove * cntrlvelscale);
|
||||
currInput->fvel -= xs_CRoundToInt(scaleAdjust * hidInput->dz * keymove * cntrlvelscale);
|
||||
currInput->svel += xs_CRoundToInt(scaleAdjust * hidInput->dx * keymove * cntrlvelscale);
|
||||
currInput->fvel += xs_CRoundToInt(scaleAdjust * hidInput->dz * keymove * cntrlvelscale);
|
||||
|
||||
// process keyboard turning keys.
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe)
|
||||
|
@ -298,7 +298,7 @@ void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust, bool const crouching)
|
||||
void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust)
|
||||
{
|
||||
// return q16rotscrnang to 0 and set to 0 if less than a quarter of a unit
|
||||
angle->rotscrnang -= bamlook(xs_CRoundToInt(scaleAdjust * angle->rotscrnang.asbam() * (15. / GameTicRate)));
|
||||
|
@ -335,7 +335,7 @@ void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double
|
|||
if (angle->spin.asbam() < 0)
|
||||
{
|
||||
// return spin to 0
|
||||
lookangle add = bamlook(xs_CRoundToUInt(scaleAdjust * ((!crouching ? 3840. : 1920.) / GameTicRate) * BAMUNIT));
|
||||
lookangle add = bamlook(xs_CRoundToUInt(scaleAdjust * ((!(*actions & SB_CROUCH) ? 3840. : 1920.) / GameTicRate) * BAMUNIT));
|
||||
angle->spin += add;
|
||||
if (angle->spin.asbam() > 0)
|
||||
{
|
||||
|
|
|
@ -199,6 +199,5 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerAngle& w, Pl
|
|||
FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w, PlayerHorizon* def);
|
||||
|
||||
void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlInfo* const hidInput, double const scaleAdjust, int const drink_amt = 0, bool const allowstrafe = true, double const turnscale = 1);
|
||||
void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust);
|
||||
void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust, bool const crouching);
|
||||
|
||||
void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust = 1);
|
||||
void applylook(PlayerAngle* angle, float const avel, ESyncBits* actions, double const scaleAdjust = 1);
|
||||
|
|
|
@ -46,7 +46,7 @@ static int WeaponToSend = 0;
|
|||
ESyncBits ActionsToSend = 0;
|
||||
static int dpad_lock = 0;
|
||||
bool sendPause;
|
||||
|
||||
bool crouch_toggle;
|
||||
static double lastCheck;
|
||||
|
||||
CVAR(Float, m_pitch, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE) // Mouse speeds
|
||||
|
@ -120,6 +120,7 @@ void InputState::ClearAllInput()
|
|||
WeaponToSend = 0;
|
||||
dpad_lock = 0;
|
||||
lastCheck = 0;
|
||||
crouch_toggle = false;
|
||||
buttonMap.ResetButtonStates(); // this is important. If all input is cleared, the buttons must be cleared as well.
|
||||
gi->clearlocalinputstate(); // also clear game local input state.
|
||||
}
|
||||
|
@ -182,8 +183,8 @@ ControlInfo CONTROL_GetInput()
|
|||
I_GetAxes(joyaxes);
|
||||
|
||||
hidInput.dyaw += -joyaxes[JOYAXIS_Yaw];
|
||||
hidInput.dx += -joyaxes[JOYAXIS_Side] * .5f;
|
||||
hidInput.dz += -joyaxes[JOYAXIS_Forward] * .5f;
|
||||
hidInput.dx += joyaxes[JOYAXIS_Side] * .5f;
|
||||
hidInput.dz += joyaxes[JOYAXIS_Forward] * .5f;
|
||||
hidInput.dpitch += -joyaxes[JOYAXIS_Pitch];
|
||||
}
|
||||
|
||||
|
@ -327,8 +328,7 @@ CCMD(pause)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void ApplyGlobalInput(InputPacket& input, ControlInfo* hidInput)
|
||||
void ApplyGlobalInput(InputPacket& input, ControlInfo* hidInput, bool const crouchable, bool const disableToggle)
|
||||
{
|
||||
if (WeaponToSend != 0) input.setNewWeapon(WeaponToSend);
|
||||
WeaponToSend = 0;
|
||||
|
@ -366,9 +366,18 @@ void ApplyGlobalInput(InputPacket& input, ControlInfo* hidInput)
|
|||
if (buttonMap.ButtonDown(gamefunc_Jump))
|
||||
input.actions |= SB_JUMP;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Crouch))
|
||||
if (buttonMap.ButtonDown(gamefunc_Crouch) || buttonMap.ButtonDown(gamefunc_Toggle_Crouch) || crouch_toggle)
|
||||
input.actions |= SB_CROUCH;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch))
|
||||
{
|
||||
crouch_toggle = !crouch_toggle && crouchable;
|
||||
if (crouchable) buttonMap.ClearButton(gamefunc_Toggle_Crouch);
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Crouch) || buttonMap.ButtonDown(gamefunc_Jump) || disableToggle)
|
||||
crouch_toggle = false;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Fire))
|
||||
input.actions |= SB_FIRE;
|
||||
|
||||
|
|
|
@ -102,6 +102,6 @@ enum GameFunction_t
|
|||
};
|
||||
|
||||
void SetupGameButtons();
|
||||
void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput);
|
||||
void ApplyGlobalInput(InputPacket& input, ControlInfo* const hidInput, bool const crouchable = true, bool const disableToggle = false);
|
||||
extern ESyncBits ActionsToSend;
|
||||
double InputScale();
|
||||
|
|
|
@ -399,7 +399,8 @@ static void BuildEpisodeMenu()
|
|||
addedVolumes++;
|
||||
if (gVolumeSubtitles[i].IsNotEmpty())
|
||||
{
|
||||
auto it = CreateListMenuItemStaticText(ld->mXpos, y, gVolumeSubtitles[i], SmallFont, CR_GRAY, false);
|
||||
auto it = CreateCustomListMenuItemText(ld->mXpos, y, ld->mLinespacing * 6 / 10, 1,
|
||||
gVolumeSubtitles[i], SmallFont, CR_GRAY, false, NAME_None, i);
|
||||
y += ld->mLinespacing * 6 / 10;
|
||||
ld->mItems.Push(it);
|
||||
}
|
||||
|
|
|
@ -25,8 +25,7 @@ enum ESyncBits_ : uint32_t
|
|||
SB_OPEN = 1 << 17,
|
||||
|
||||
SB_AIMMODE = 1 << 18,
|
||||
SB_QUICK_KICK = 1 << 19, // Duke only.
|
||||
SB_CROUCH_LOCK = 1 << 19, // SW only.
|
||||
SB_QUICK_KICK = 1 << 19,
|
||||
SB_FLYDOWN = 1 << 19, // WH only.
|
||||
SB_ESCAPE = 1 << 20, // Duke only
|
||||
SB_SPELL = 1 << 20, // WH only
|
||||
|
|
|
@ -75,6 +75,21 @@ CVAR(String, cl_savedir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
//
|
||||
//=============================================================================
|
||||
|
||||
static void SerializeGlobals(FSerializer& arc)
|
||||
{
|
||||
if (arc.BeginObject("globals"))
|
||||
{
|
||||
arc("crouch_toggle", crouch_toggle)
|
||||
.EndObject();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
static void SerializeSession(FSerializer& arc)
|
||||
{
|
||||
SerializeMap(arc);
|
||||
|
@ -85,6 +100,7 @@ static void SerializeSession(FSerializer& arc)
|
|||
S_SerializeSounds(arc);
|
||||
SerializeAutomap(arc);
|
||||
SerializeHud(arc);
|
||||
SerializeGlobals(arc);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
@ -496,7 +496,7 @@ HITWALL:
|
|||
}
|
||||
|
||||
// draws bullet puff on walls when they're shot
|
||||
BuildAnim(-1, pBulletInfo->field_C, 0, x2, y2, z2 + zOffset, hitsect, 40, pBulletInfo->nFlags);
|
||||
BuildAnim(-1, pBulletInfo->field_C, 0, x2, y2, z2 + zOffset + -4096, hitsect, 40, pBulletInfo->nFlags);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -403,7 +403,7 @@ void GameInterface::Ticker()
|
|||
if (weap2 == WeaponSel_Next)
|
||||
{
|
||||
auto newWeap = currWeap == 6 ? 0 : currWeap + 1;
|
||||
while (!(nPlayerWeapons[nLocalPlayer] & (1 << newWeap)))
|
||||
while (!(nPlayerWeapons[nLocalPlayer] & (1 << newWeap)) || (nPlayerWeapons[nLocalPlayer] & (1 << newWeap) && PlayerList[nLocalPlayer].nAmmo[newWeap] == 0))
|
||||
{
|
||||
newWeap++;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ void GameInterface::Ticker()
|
|||
else if (weap2 == WeaponSel_Prev)
|
||||
{
|
||||
auto newWeap = currWeap == 0 ? 6 : currWeap - 1;
|
||||
while (!(nPlayerWeapons[nLocalPlayer] & (1 << newWeap)))
|
||||
while (!(nPlayerWeapons[nLocalPlayer] & (1 << newWeap)) || (nPlayerWeapons[nLocalPlayer] & (1 << newWeap) && PlayerList[nLocalPlayer].nAmmo[newWeap] == 0))
|
||||
{
|
||||
newWeap--;
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
if (PlayerList[nLocalPlayer].nHealth == 0) localInput.actions &= SB_OPEN;
|
||||
}
|
||||
|
||||
Player* pPlayer = &PlayerList[nLocalPlayer];
|
||||
double const scaleAdjust = InputScale();
|
||||
InputPacket input {};
|
||||
|
||||
|
@ -121,11 +122,9 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
Player* pPlayer = &PlayerList[nLocalPlayer];
|
||||
|
||||
if (!nFreeze)
|
||||
{
|
||||
applylook(&pPlayer->angle, input.avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, eyelevel[nLocalPlayer] > -14080);
|
||||
applylook(&pPlayer->angle, input.avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
|
||||
sethorizon(&pPlayer->horizon.horiz, input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ void DoEnergyTile()
|
|||
auto energy1 = TileFiles.tileMakeWritable(kEnergy1);
|
||||
auto energy2 = TileFiles.tileMakeWritable(kEnergy2);
|
||||
uint8_t* ptr1 = energy1 + 1984;
|
||||
uint8_t* ptr2 = energy2 + 2048;
|
||||
uint8_t* ptr2 = energy1 + 2048;
|
||||
|
||||
short nColor = nButtonColor + 161;
|
||||
|
||||
|
|
|
@ -1347,7 +1347,7 @@ int BuildSpark(int nSprite, int nVal)
|
|||
if (var_14 < 0) {
|
||||
return -1;
|
||||
}
|
||||
auto spr = &sprite[nSprite];
|
||||
auto spr = &sprite[var_14];
|
||||
|
||||
assert(var_14 < kMaxSprites);
|
||||
|
||||
|
|
|
@ -921,7 +921,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
if (cl_syncinput)
|
||||
{
|
||||
Player* pPlayer = &PlayerList[nPlayer];
|
||||
applylook(&pPlayer->angle, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions, 1, eyelevel[nLocalPlayer] > -14080);
|
||||
applylook(&pPlayer->angle, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions);
|
||||
UpdatePlayerSpriteAngle(pPlayer);
|
||||
}
|
||||
|
||||
|
@ -2640,7 +2640,7 @@ loc_1BD2E:
|
|||
if (cl_syncinput)
|
||||
{
|
||||
Player* pPlayer = &PlayerList[nPlayer];
|
||||
sethorizon(&pPlayer->horizon.horiz, sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions, 1);
|
||||
sethorizon(&pPlayer->horizon.horiz, sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions);
|
||||
}
|
||||
}
|
||||
else // else, player's health is less than 0
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -29,6 +29,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
#include "global.h"
|
||||
#include "names_r.h"
|
||||
#include "serializer.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -121,24 +122,24 @@ void lava_serialize(FSerializer& arc)
|
|||
("windertime", windertime);
|
||||
}
|
||||
|
||||
void addtorch(int i)
|
||||
void addtorch(spritetype* s)
|
||||
{
|
||||
if (torchcnt >= 64)
|
||||
I_Error("Too many torch effects");
|
||||
|
||||
torchsector[torchcnt] = sprite[i].sectnum;
|
||||
torchsectorshade[torchcnt] = sector[sprite[i].sectnum].floorshade;
|
||||
torchtype[torchcnt] = sprite[i].lotag;
|
||||
torchsector[torchcnt] = s->sectnum;
|
||||
torchsectorshade[torchcnt] = sector[s->sectnum].floorshade;
|
||||
torchtype[torchcnt] = s->lotag;
|
||||
torchcnt++;
|
||||
}
|
||||
|
||||
void addlightning(int i)
|
||||
void addlightning(spritetype* s)
|
||||
{
|
||||
if (lightnincnt >= 64)
|
||||
I_Error("Too many lightnin effects");
|
||||
|
||||
lightninsector[lightnincnt] = sprite[i].sectnum;
|
||||
lightninsectorshade[lightnincnt] = sector[sprite[i].sectnum].floorshade;
|
||||
lightninsector[lightnincnt] = s->sectnum;
|
||||
lightninsectorshade[lightnincnt] = sector[s->sectnum].floorshade;
|
||||
lightnincnt++;
|
||||
}
|
||||
|
||||
|
@ -149,7 +150,7 @@ void addjaildoor(int p1, int p2, int iht, int jlt, int p3, int j)
|
|||
|
||||
if (jlt != 10 && jlt != 20 && jlt != 30 && jlt != 40)
|
||||
{
|
||||
Printf(PRINT_HIGH, "Bad direction %d for jail door with tag %d\n", iht);
|
||||
Printf(PRINT_HIGH, "Bad direction %d for jail door with tag %d\n", jlt, iht);
|
||||
return; // wouldn't work so let's skip it.
|
||||
}
|
||||
|
||||
|
@ -517,12 +518,12 @@ void moveminecart(void)
|
|||
}
|
||||
cx = (max_x + min_x) >> 1;
|
||||
cy = (max_y + min_y) >> 1;
|
||||
SectIterator it(csect);
|
||||
while ((j = it.NextIndex()) >= 0)
|
||||
DukeSectIterator it(csect);
|
||||
while (auto a2 = it.Next())
|
||||
{
|
||||
auto sj = &sprite[j];
|
||||
if (badguy(&sprite[j]))
|
||||
setsprite(j,cx,cy,sprite[j].z);
|
||||
auto sj = &a2->s;
|
||||
if (badguy(sj))
|
||||
setsprite(a2, cx, cy, sj->z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -538,14 +539,14 @@ void operatejaildoors(int hitag)
|
|||
jaildooropen[i] = 1;
|
||||
jaildoordrag[i] = jaildoordist[i];
|
||||
if (!isRRRA() || jaildoorsound[i] != 0)
|
||||
S_PlayActorSound(jaildoorsound[i], ps[screenpeek].i);
|
||||
S_PlayActorSound(jaildoorsound[i], ps[screenpeek].GetActor());
|
||||
}
|
||||
if (jaildooropen[i] == 2)
|
||||
{
|
||||
jaildooropen[i] = 3;
|
||||
jaildoordrag[i] = jaildoordist[i];
|
||||
if (!isRRRA() || jaildoorsound[i] != 0)
|
||||
S_PlayActorSound(jaildoorsound[i], ps[screenpeek].i);
|
||||
S_PlayActorSound(jaildoorsound[i], ps[screenpeek].GetActor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -37,6 +37,7 @@ source as it is released.
|
|||
#include "global.h"
|
||||
#include "prediction.h"
|
||||
#include "names_d.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
EXTERN_CVAR(Bool, wt_commentary)
|
||||
|
||||
|
@ -49,12 +50,14 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
int l, t1, t3, t4;
|
||||
spritetype* s;
|
||||
tspritetype* t;
|
||||
weaponhit* h;
|
||||
|
||||
for (j = 0; j < spritesortcnt; j++)
|
||||
{
|
||||
t = &tsprite[j];
|
||||
i = t->owner;
|
||||
s = &sprite[t->owner];
|
||||
h = &hittype[i];
|
||||
s = &h->s;
|
||||
|
||||
switch (t->picnum)
|
||||
{
|
||||
|
@ -146,7 +149,10 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
{ //is the perfect time to animate sprites
|
||||
t = &tsprite[j];
|
||||
i = t->owner;
|
||||
s = &sprite[i];
|
||||
h = &hittype[i];
|
||||
s = &h->s;
|
||||
auto OwnerAc = h->GetOwner();
|
||||
auto Owner = OwnerAc ? &OwnerAc->s : nullptr;
|
||||
|
||||
switch (s->picnum)
|
||||
{
|
||||
|
@ -168,7 +174,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
}
|
||||
|
||||
if (t->statnum == 99) continue;
|
||||
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && s->owner >= 0)
|
||||
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newOwner == nullptr && h->GetOwner())
|
||||
{
|
||||
t->x -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx);
|
||||
t->y -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy);
|
||||
|
@ -177,15 +183,15 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
}
|
||||
else if (s->picnum != CRANEPOLE)
|
||||
{
|
||||
t->x -= mulscale16(MaxSmoothRatio - smoothratio, s->x - hittype[i].bposx);
|
||||
t->y -= mulscale16(MaxSmoothRatio - smoothratio, s->y - hittype[i].bposy);
|
||||
t->z -= mulscale16(MaxSmoothRatio - smoothratio, s->z - hittype[i].bposz);
|
||||
t->x -= mulscale16(MaxSmoothRatio - smoothratio, s->x - h->bposx);
|
||||
t->y -= mulscale16(MaxSmoothRatio - smoothratio, s->y - h->bposy);
|
||||
t->z -= mulscale16(MaxSmoothRatio - smoothratio, s->z - h->bposz);
|
||||
}
|
||||
|
||||
sect = s->sectnum;
|
||||
t1 = hittype[i].temp_data[1];
|
||||
t3 = hittype[i].temp_data[3];
|
||||
t4 = hittype[i].temp_data[4];
|
||||
t1 = h->temp_data[1];
|
||||
t3 = h->temp_data[3];
|
||||
t4 = h->temp_data[4];
|
||||
|
||||
switch (s->picnum)
|
||||
{
|
||||
|
@ -210,35 +216,35 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
case TRIPBOMB:
|
||||
continue;
|
||||
case FORCESPHERE:
|
||||
if (t->statnum == 5)
|
||||
if (t->statnum == STAT_MISC && Owner)
|
||||
{
|
||||
short sqa, sqb;
|
||||
|
||||
sqa =
|
||||
getangle(
|
||||
sprite[s->owner].x - ps[screenpeek].posx,
|
||||
sprite[s->owner].y - ps[screenpeek].posy);
|
||||
Owner->x - ps[screenpeek].posx,
|
||||
Owner->y - ps[screenpeek].posy);
|
||||
sqb =
|
||||
getangle(
|
||||
sprite[s->owner].x - t->x,
|
||||
sprite[s->owner].y - t->y);
|
||||
Owner->x - t->x,
|
||||
Owner->y - t->y);
|
||||
|
||||
if (abs(getincangle(sqa, sqb)) > 512)
|
||||
if (ldist(&sprite[s->owner], t) < ldist(&sprite[ps[screenpeek].i], &sprite[s->owner]))
|
||||
if (ldist(Owner, t) < ldist(&ps[screenpeek].GetActor()->s, Owner))
|
||||
t->xrepeat = t->yrepeat = 0;
|
||||
}
|
||||
continue;
|
||||
case BURNING:
|
||||
case BURNING2:
|
||||
if (sprite[s->owner].statnum == 10)
|
||||
if (Owner && Owner->statnum == STAT_PLAYER)
|
||||
{
|
||||
if (display_mirror == 0 && sprite[s->owner].yvel == screenpeek && ps[sprite[s->owner].yvel].over_shoulder_on == 0)
|
||||
if (display_mirror == 0 && Owner->yvel == screenpeek && ps[screenpeek].over_shoulder_on == 0)
|
||||
t->xrepeat = 0;
|
||||
else
|
||||
{
|
||||
t->ang = getangle(x - t->x, y - t->y);
|
||||
t->x = sprite[s->owner].x;
|
||||
t->y = sprite[s->owner].y;
|
||||
t->x = Owner->x;
|
||||
t->y = Owner->y;
|
||||
t->x += sintable[(t->ang + 512) & 2047] >> 10;
|
||||
t->y += sintable[t->ang & 2047] >> 10;
|
||||
}
|
||||
|
@ -253,14 +259,14 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
continue;
|
||||
case VIEWSCREEN:
|
||||
case VIEWSCREEN2:
|
||||
if (camsprite >= 0 && hittype[sprite[i].owner].temp_data[0] == 1)
|
||||
if (camsprite != nullptr && h->GetOwner()->temp_data[0] == 1)
|
||||
{
|
||||
t->picnum = STATIC;
|
||||
t->cstat |= (rand() & 12);
|
||||
t->xrepeat += 8;
|
||||
t->yrepeat += 8;
|
||||
}
|
||||
else if (camsprite >= 0)
|
||||
else if (camsprite != nullptr)
|
||||
{
|
||||
t->picnum = TILE_VIEWSCR;
|
||||
}
|
||||
|
@ -296,7 +302,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
}*/
|
||||
|
||||
k = getangle(s->x - x, s->y - y);
|
||||
if (hittype[i].temp_data[0] < 4)
|
||||
if (h->temp_data[0] < 4)
|
||||
k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
||||
else k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
||||
|
||||
|
@ -318,7 +324,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
|
||||
if (t->pal == 1) t->z -= (18 << 8);
|
||||
|
||||
if (ps[p].over_shoulder_on > 0 && ps[p].newowner < 0)
|
||||
if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr)
|
||||
{
|
||||
t->cstat |= 2;
|
||||
if (screenpeek == myconnectindex && numplayers >= 2)
|
||||
|
@ -331,7 +337,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
}
|
||||
}
|
||||
|
||||
if ((display_mirror == 1 || screenpeek != p || s->owner == -1) && ud.multimode > 1 && ud.showweapons && sprite[ps[p].i].extra > 0 && ps[p].curr_weapon > 0)
|
||||
if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && ud.showweapons && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0)
|
||||
{
|
||||
auto newtspr = &tsprite[spritesortcnt];
|
||||
memcpy(newtspr, t, sizeof(spritetype));
|
||||
|
@ -362,7 +368,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
case DEVISTATOR_WEAPON: newtspr->picnum = DEVISTATORSPRITE; break;
|
||||
}
|
||||
|
||||
if (s->owner >= 0)
|
||||
if (h->GetOwner())
|
||||
newtspr->z = ps[p].posz - (12 << 8);
|
||||
else newtspr->z = s->z - (51 << 8);
|
||||
if (ps[p].curr_weapon == HANDBOMB_WEAPON)
|
||||
|
@ -379,7 +385,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
spritesortcnt++;
|
||||
}
|
||||
|
||||
if (s->owner == -1)
|
||||
if (!h->GetOwner())
|
||||
{
|
||||
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
|
||||
k = 0;
|
||||
|
@ -395,7 +401,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
}
|
||||
|
||||
if (sector[t->sectnum].lotag == 2) k += 1795 - 1405;
|
||||
else if ((hittype[i].floorz - s->z) > (64 << 8)) k += 60;
|
||||
else if ((h->floorz - s->z) > (64 << 8)) k += 60;
|
||||
|
||||
t->picnum += k;
|
||||
t->pal = ps[p].palookup;
|
||||
|
@ -405,21 +411,21 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
|
||||
if (ps[p].on_crane == nullptr && (sector[s->sectnum].lotag & 0x7ff) != 1)
|
||||
{
|
||||
l = s->z - hittype[ps[p].i].floorz + (3 << 8);
|
||||
l = s->z - ps[p].GetActor()->floorz + (3 << 8);
|
||||
if (l > 1024 && s->yrepeat > 32 && s->extra > 0)
|
||||
s->yoffset = (signed char)(l / (s->yrepeat << 2));
|
||||
else s->yoffset = 0;
|
||||
}
|
||||
|
||||
if (ps[p].newowner > -1)
|
||||
if (ps[p].newOwner != nullptr)
|
||||
{
|
||||
t4 = ScriptCode[actorinfo[APLAYER].scriptaddress + 1];
|
||||
t3 = 0;
|
||||
t1 = ScriptCode[actorinfo[APLAYER].scriptaddress + 2];
|
||||
}
|
||||
|
||||
if (ud.camerasprite == -1 && ps[p].newowner == -1)
|
||||
if (s->owner >= 0 && display_mirror == 0 && ps[p].over_shoulder_on == 0)
|
||||
if (ud.cameraactor == nullptr && ps[p].newOwner == nullptr)
|
||||
if (h->GetOwner() && display_mirror == 0 && ps[p].over_shoulder_on == 0)
|
||||
if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek))
|
||||
{
|
||||
t->owner = -1;
|
||||
|
@ -432,10 +438,10 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
if (sector[sect].floorpal)
|
||||
t->pal = sector[sect].floorpal;
|
||||
|
||||
if (s->owner == -1) continue;
|
||||
if (!h->GetOwner()) continue;
|
||||
|
||||
if (t->z > hittype[i].floorz && t->xrepeat < 32)
|
||||
t->z = hittype[i].floorz;
|
||||
if (t->z > h->floorz && t->xrepeat < 32)
|
||||
t->z = h->floorz;
|
||||
|
||||
break;
|
||||
|
||||
|
@ -470,9 +476,9 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
case SCRAP6 + 6:
|
||||
case SCRAP6 + 7:
|
||||
|
||||
if (hittype[i].picnum == BLIMP && t->picnum == SCRAP1 && s->yvel >= 0)
|
||||
if (h->picnum == BLIMP && t->picnum == SCRAP1 && s->yvel >= 0)
|
||||
t->picnum = s->yvel;
|
||||
else t->picnum += hittype[i].temp_data[0];
|
||||
else t->picnum += h->temp_data[0];
|
||||
t->shade -= 6;
|
||||
|
||||
if (sector[sect].floorpal)
|
||||
|
@ -552,20 +558,20 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
while (!tileGetTexture(t->picnum)->isValid() && t->picnum > 0)
|
||||
t->picnum -= l; //Hack, for actors
|
||||
|
||||
if (hittype[i].dispicnum >= 0)
|
||||
hittype[i].dispicnum = t->picnum;
|
||||
if (h->dispicnum >= 0)
|
||||
h->dispicnum = t->picnum;
|
||||
}
|
||||
else if (display_mirror == 1)
|
||||
t->cstat |= 4;
|
||||
}
|
||||
|
||||
if (s->statnum == STAT_DUMMYPLAYER || badguy(s) || (s->picnum == APLAYER && s->owner >= 0))
|
||||
if (s->statnum == STAT_DUMMYPLAYER || badguy(s) || (s->picnum == APLAYER && h->GetOwner()))
|
||||
if (t->statnum != 99 && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE)
|
||||
if (s->picnum != HOTMEAT)
|
||||
{
|
||||
if (hittype[i].dispicnum < 0)
|
||||
if (h->dispicnum < 0)
|
||||
{
|
||||
hittype[i].dispicnum++;
|
||||
h->dispicnum++;
|
||||
continue;
|
||||
}
|
||||
else if (r_shadows && spritesortcnt < (MAXSPRITESONSCREEN - 2))
|
||||
|
@ -575,7 +581,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
if ((sector[sect].lotag & 0xff) > 2 || s->statnum == 4 || s->statnum == 5 || s->picnum == DRONE || s->picnum == COMMANDER)
|
||||
daz = sector[sect].floorz;
|
||||
else
|
||||
daz = hittype[i].floorz;
|
||||
daz = h->floorz;
|
||||
|
||||
|
||||
if ((s->z - daz) < (8 << 8) && ps[screenpeek].posz < daz)
|
||||
|
@ -628,8 +634,9 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
switch (s->picnum)
|
||||
{
|
||||
case LASERLINE:
|
||||
if (!Owner) break;
|
||||
if (sector[t->sectnum].lotag == 2) t->pal = 8;
|
||||
t->z = sprite[s->owner].z - (3 << 8);
|
||||
t->z = Owner->z - (3 << 8);
|
||||
if (lasermode == 2 && ps[screenpeek].heat_on == 0)
|
||||
t->yrepeat = 0;
|
||||
case EXPLOSION2:
|
||||
|
@ -655,7 +662,8 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
t->cstat |= 128;
|
||||
case BURNING:
|
||||
case BURNING2:
|
||||
if (sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2)
|
||||
if (!Owner) break;
|
||||
if (Owner->picnum != TREE1 && Owner->picnum != TREE2)
|
||||
t->z = sector[t->sectnum].floorz;
|
||||
t->shade = -127;
|
||||
break;
|
||||
|
@ -677,8 +685,8 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
else t->cstat &= ~4;
|
||||
}
|
||||
|
||||
t->picnum = s->picnum + k + ((hittype[i].temp_data[0] < 4) * 5);
|
||||
t->shade = sprite[s->owner].shade;
|
||||
t->picnum = s->picnum + k + ((h->temp_data[0] < 4) * 5);
|
||||
if (Owner) t->shade = Owner->shade;
|
||||
|
||||
break;
|
||||
|
||||
|
@ -686,32 +694,32 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
t->picnum = WATERSPLASH2 + t1;
|
||||
break;
|
||||
case REACTOR2:
|
||||
t->picnum = s->picnum + hittype[i].temp_data[2];
|
||||
t->picnum = s->picnum + h->temp_data[2];
|
||||
break;
|
||||
case SHELL:
|
||||
t->picnum = s->picnum + (hittype[i].temp_data[0] & 1);
|
||||
t->picnum = s->picnum + (h->temp_data[0] & 1);
|
||||
case SHOTGUNSHELL:
|
||||
t->cstat |= 12;
|
||||
if (hittype[i].temp_data[0] > 1) t->cstat &= ~4;
|
||||
if (hittype[i].temp_data[0] > 2) t->cstat &= ~12;
|
||||
if (h->temp_data[0] > 1) t->cstat &= ~4;
|
||||
if (h->temp_data[0] > 2) t->cstat &= ~12;
|
||||
break;
|
||||
case FRAMEEFFECT1:
|
||||
if (s->owner >= 0 && sprite[s->owner].statnum < MAXSTATUS)
|
||||
if (Owner && Owner->statnum < MAXSTATUS)
|
||||
{
|
||||
if (sprite[s->owner].picnum == APLAYER)
|
||||
if (ud.camerasprite == -1)
|
||||
if (screenpeek == sprite[s->owner].yvel && display_mirror == 0)
|
||||
if (Owner->picnum == APLAYER)
|
||||
if (ud.cameraactor == nullptr)
|
||||
if (screenpeek == Owner->yvel && display_mirror == 0)
|
||||
{
|
||||
t->owner = -1;
|
||||
break;
|
||||
}
|
||||
if ((sprite[s->owner].cstat & 32768) == 0)
|
||||
if ((Owner->cstat & 32768) == 0)
|
||||
{
|
||||
t->picnum = hittype[s->owner].dispicnum;
|
||||
t->pal = sprite[s->owner].pal;
|
||||
t->shade = sprite[s->owner].shade;
|
||||
t->ang = sprite[s->owner].ang;
|
||||
t->cstat = 2 | sprite[s->owner].cstat;
|
||||
t->picnum = OwnerAc->dispicnum;
|
||||
t->pal = Owner->pal;
|
||||
t->shade = Owner->shade;
|
||||
t->ang = Owner->ang;
|
||||
t->cstat = 2 | Owner->cstat;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -734,7 +742,7 @@ void animatesprites_d(int x, int y, int a, int smoothratio)
|
|||
break;
|
||||
}
|
||||
|
||||
hittype[i].dispicnum = t->picnum;
|
||||
h->dispicnum = t->picnum;
|
||||
if (sector[t->sectnum].floorpicnum == MIRROR)
|
||||
t->xrepeat = t->yrepeat = 0;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
#include "global.h"
|
||||
#include "names_r.h"
|
||||
#include "prediction.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -42,6 +43,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
int l, t1, t3, t4;
|
||||
spritetype* s;
|
||||
tspritetype* t;
|
||||
weaponhit* h;
|
||||
|
||||
int bg = 0;
|
||||
|
||||
|
@ -49,7 +51,8 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
{
|
||||
t = &tsprite[j];
|
||||
i = t->owner;
|
||||
s = &sprite[t->owner];
|
||||
h = &hittype[i];
|
||||
s = &h->s;
|
||||
|
||||
switch (t->picnum)
|
||||
{
|
||||
|
@ -135,7 +138,10 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
{ //is the perfect time to animate sprites
|
||||
t = &tsprite[j];
|
||||
i = t->owner;
|
||||
s = &sprite[i];
|
||||
h = &hittype[i];
|
||||
s = &h->s;
|
||||
auto OwnerAc = h->GetOwner();
|
||||
auto Owner = OwnerAc ? &OwnerAc->s : nullptr;
|
||||
|
||||
switch (s->picnum)
|
||||
{
|
||||
|
@ -153,7 +159,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
}
|
||||
|
||||
if (t->statnum == 99) continue;
|
||||
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && s->owner >= 0)
|
||||
if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps[s->yvel].newOwner == nullptr && h->GetOwner())
|
||||
{
|
||||
t->x -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posx - ps[s->yvel].oposx);
|
||||
t->y -= mulscale16(MaxSmoothRatio - smoothratio, ps[s->yvel].posy - ps[s->yvel].oposy);
|
||||
|
@ -164,15 +170,15 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
}
|
||||
else if (s->picnum != CRANEPOLE)
|
||||
{
|
||||
t->x -= mulscale16(MaxSmoothRatio - smoothratio, s->x - hittype[i].bposx);
|
||||
t->y -= mulscale16(MaxSmoothRatio - smoothratio, s->y - hittype[i].bposy);
|
||||
t->z -= mulscale16(MaxSmoothRatio - smoothratio, s->z - hittype[i].bposz);
|
||||
t->x -= mulscale16(MaxSmoothRatio - smoothratio, s->x - h->bposx);
|
||||
t->y -= mulscale16(MaxSmoothRatio - smoothratio, s->y - h->bposy);
|
||||
t->z -= mulscale16(MaxSmoothRatio - smoothratio, s->z - h->bposz);
|
||||
}
|
||||
|
||||
sect = s->sectnum;
|
||||
t1 = hittype[i].temp_data[1];
|
||||
t3 = hittype[i].temp_data[3];
|
||||
t4 = hittype[i].temp_data[4];
|
||||
t1 = h->temp_data[1];
|
||||
t3 = h->temp_data[3];
|
||||
t4 = h->temp_data[4];
|
||||
|
||||
switch (s->picnum)
|
||||
{
|
||||
|
@ -208,34 +214,34 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
case TRIPBOMBSPRITE:
|
||||
continue;
|
||||
case FORCESPHERE:
|
||||
if (t->statnum == 5)
|
||||
if (t->statnum == STAT_MISC && Owner)
|
||||
{
|
||||
short sqa, sqb;
|
||||
|
||||
sqa =
|
||||
getangle(
|
||||
sprite[s->owner].x - ps[screenpeek].posx,
|
||||
sprite[s->owner].y - ps[screenpeek].posy);
|
||||
Owner->x - ps[screenpeek].posx,
|
||||
Owner->y - ps[screenpeek].posy);
|
||||
sqb =
|
||||
getangle(
|
||||
sprite[s->owner].x - t->x,
|
||||
sprite[s->owner].y - t->y);
|
||||
Owner->x - t->x,
|
||||
Owner->y - t->y);
|
||||
|
||||
if (abs(getincangle(sqa, sqb)) > 512)
|
||||
if (ldist(&sprite[s->owner], t) < ldist(&sprite[ps[screenpeek].i], &sprite[s->owner]))
|
||||
if (ldist(Owner, t) < ldist(&ps[screenpeek].GetActor()->s, Owner))
|
||||
t->xrepeat = t->yrepeat = 0;
|
||||
}
|
||||
continue;
|
||||
case BURNING:
|
||||
if (sprite[s->owner].statnum == 10)
|
||||
if (Owner && Owner->statnum == STAT_PLAYER)
|
||||
{
|
||||
if (display_mirror == 0 && sprite[s->owner].yvel == screenpeek && ps[sprite[s->owner].yvel].over_shoulder_on == 0)
|
||||
if (display_mirror == 0 && Owner->yvel == screenpeek && ps[Owner->yvel].over_shoulder_on == 0)
|
||||
t->xrepeat = 0;
|
||||
else
|
||||
{
|
||||
t->ang = getangle(x - t->x, y - t->y);
|
||||
t->x = sprite[s->owner].x;
|
||||
t->y = sprite[s->owner].y;
|
||||
t->x = Owner->x;
|
||||
t->y = Owner->y;
|
||||
t->x += sintable[(t->ang + 512) & 2047] >> 10;
|
||||
t->y += sintable[t->ang & 2047] >> 10;
|
||||
}
|
||||
|
@ -249,7 +255,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
t->shade = (sintable[(ud.levelclock << 4) & 2047] >> 10);
|
||||
break;
|
||||
case SHRINKSPARK:
|
||||
if ((sprite[s->owner].picnum == CHEER || sprite[s->owner].picnum == CHEERSTAYPUT) && isRRRA())
|
||||
if (Owner && (Owner->picnum == CHEER || Owner->picnum == CHEERSTAYPUT) && isRRRA())
|
||||
{
|
||||
t->picnum = CHEERBLADE + ((ud.levelclock >> 4) & 3);
|
||||
t->shade = -127;
|
||||
|
@ -265,16 +271,16 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
}
|
||||
else goto default_case;
|
||||
case SPIT:
|
||||
if (isRRRA())
|
||||
if (isRRRA() && Owner)
|
||||
{
|
||||
if (sprite[s->owner].picnum == MINION && sprite[s->owner].pal == 8)
|
||||
if (Owner->picnum == MINION && Owner->pal == 8)
|
||||
t->picnum = RRTILE3500 + ((ud.levelclock >> 4) % 6);
|
||||
else if (sprite[s->owner].picnum == MINION && sprite[s->owner].pal == 19)
|
||||
else if (Owner->picnum == MINION && Owner->pal == 19)
|
||||
{
|
||||
t->picnum = RRTILE5090 + ((ud.levelclock >> 4) & 3);
|
||||
t->shade = -127;
|
||||
}
|
||||
else if (sprite[s->owner].picnum == MAMA)
|
||||
else if (Owner->picnum == MAMA)
|
||||
{
|
||||
k = getangle(s->x - x, s->y - y);
|
||||
k = (((s->ang + 3072 + 128 - k) & 2047) >> 8) & 7;
|
||||
|
@ -343,7 +349,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
case RECON:
|
||||
|
||||
k = getangle(s->x - x, s->y - y);
|
||||
if (hittype[i].temp_data[0] < 4)
|
||||
if (h->temp_data[0] < 4)
|
||||
k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
||||
else k = (((s->ang + 3072 + 128 - k) & 2047) / 170);
|
||||
|
||||
|
@ -365,7 +371,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
|
||||
if (t->pal == 1) t->z -= (18 << 8);
|
||||
|
||||
if (ps[p].over_shoulder_on > 0 && ps[p].newowner < 0)
|
||||
if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr)
|
||||
{
|
||||
t->cstat |= 2;
|
||||
if (screenpeek == myconnectindex && numplayers >= 2)
|
||||
|
@ -378,7 +384,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
}
|
||||
}
|
||||
|
||||
if ((display_mirror == 1 || screenpeek != p || s->owner == -1) && ud.multimode > 1 && ud.showweapons && sprite[ps[p].i].extra > 0 && ps[p].curr_weapon > 0)
|
||||
if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && ud.showweapons && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0)
|
||||
{
|
||||
auto newtspr = &tsprite[spritesortcnt];
|
||||
memcpy(newtspr, t, sizeof(spritetype));
|
||||
|
@ -408,7 +414,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
case TIT_WEAPON: newtspr->picnum = FREEZESPRITE; break;
|
||||
}
|
||||
|
||||
if (s->owner >= 0)
|
||||
if (h->GetOwner())
|
||||
newtspr->z = ps[p].posz - (12 << 8);
|
||||
else newtspr->z = s->z - (51 << 8);
|
||||
if (ps[p].curr_weapon == HANDBOMB_WEAPON)
|
||||
|
@ -430,7 +436,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
spritesortcnt++;
|
||||
}
|
||||
|
||||
if (s->owner == -1)
|
||||
if (!h->GetOwner())
|
||||
{
|
||||
/*if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) {
|
||||
k = 0;
|
||||
|
@ -446,7 +452,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
}
|
||||
|
||||
if (sector[t->sectnum].lotag == 2) k += 1795 - 1405;
|
||||
else if ((hittype[i].floorz - s->z) > (64 << 8)) k += 60;
|
||||
else if ((h->floorz - s->z) > (64 << 8)) k += 60;
|
||||
|
||||
t->picnum += k;
|
||||
t->pal = ps[p].palookup;
|
||||
|
@ -456,21 +462,21 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
|
||||
if (ps[p].on_crane == nullptr && (sector[s->sectnum].lotag & 0x7ff) != 1)
|
||||
{
|
||||
l = s->z - hittype[ps[p].i].floorz + (3 << 8);
|
||||
l = s->z - ps[p].GetActor()->floorz + (3 << 8);
|
||||
if (l > 1024 && s->yrepeat > 32 && s->extra > 0)
|
||||
s->yoffset = (signed char)(l / (s->yrepeat << 2));
|
||||
else s->yoffset = 0;
|
||||
}
|
||||
|
||||
if (ps[p].newowner > -1)
|
||||
if (ps[p].newOwner != nullptr)
|
||||
{
|
||||
t4 = ScriptCode[actorinfo[APLAYER].scriptaddress + 1];
|
||||
t3 = 0;
|
||||
t1 = ScriptCode[actorinfo[APLAYER].scriptaddress + 2];
|
||||
}
|
||||
|
||||
if (ud.camerasprite == -1 && ps[p].newowner == -1)
|
||||
if (s->owner >= 0 && display_mirror == 0 && ps[p].over_shoulder_on == 0)
|
||||
if (ud.cameraactor == nullptr && ps[p].newOwner == nullptr)
|
||||
if (h->GetOwner() && display_mirror == 0 && ps[p].over_shoulder_on == 0)
|
||||
if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek))
|
||||
{
|
||||
t->owner = -1;
|
||||
|
@ -483,10 +489,10 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
if (sector[sect].floorpal)
|
||||
t->pal = sector[sect].floorpal;
|
||||
|
||||
if (s->owner == -1) continue;
|
||||
if (!h->GetOwner()) continue;
|
||||
|
||||
if (t->z > hittype[i].floorz && t->xrepeat < 32)
|
||||
t->z = hittype[i].floorz;
|
||||
if (t->z > h->floorz && t->xrepeat < 32)
|
||||
t->z = h->floorz;
|
||||
|
||||
if (ps[p].OnMotorcycle && p == screenpeek)
|
||||
{
|
||||
|
@ -610,7 +616,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
|
||||
if (t->picnum == SCRAP1 && s->yvel >= 0)
|
||||
t->picnum = s->yvel;
|
||||
else t->picnum += hittype[i].temp_data[0];
|
||||
else t->picnum += h->temp_data[0];
|
||||
|
||||
if (sector[sect].floorpal)
|
||||
t->pal = sector[sect].floorpal;
|
||||
|
@ -704,8 +710,8 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
while (!tileGetTexture(t->picnum)->isValid() && t->picnum > 0)
|
||||
t->picnum -= l; //Hack, for actors
|
||||
|
||||
if (hittype[i].dispicnum >= 0)
|
||||
hittype[i].dispicnum = t->picnum;
|
||||
if (h->dispicnum >= 0)
|
||||
h->dispicnum = t->picnum;
|
||||
}
|
||||
else if (display_mirror == 1)
|
||||
t->cstat |= 4;
|
||||
|
@ -714,13 +720,13 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
if (!isRRRA() && s->picnum == SBMOVE)
|
||||
t->shade = -127;
|
||||
|
||||
if (s->statnum == 13 || badguy(s) || (s->picnum == APLAYER && s->owner >= 0))
|
||||
if (s->statnum == 13 || badguy(s) || (s->picnum == APLAYER && h->GetOwner()))
|
||||
if ((s->cstat & 48) == 0 && t->statnum != 99)
|
||||
if (s->picnum != EXPLOSION2 && s->picnum != DOMELITE && s->picnum != TORNADO && s->picnum != EXPLOSION3 && (s->picnum != SBMOVE || isRRRA()))
|
||||
{
|
||||
if (hittype[i].dispicnum < 0)
|
||||
if (h->dispicnum < 0)
|
||||
{
|
||||
hittype[i].dispicnum++;
|
||||
h->dispicnum++;
|
||||
continue;
|
||||
}
|
||||
else if (r_shadows && spritesortcnt < (MAXSPRITESONSCREEN - 2))
|
||||
|
@ -731,7 +737,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
if ((sector[sect].lotag & 0xff) > 2 || s->statnum == 4 || s->statnum == 5 || s->picnum == DRONE)
|
||||
daz = sector[sect].floorz;
|
||||
else
|
||||
daz = hittype[i].floorz;
|
||||
daz = h->floorz;
|
||||
|
||||
if ((s->z - daz) < (8 << 8))
|
||||
if (ps[screenpeek].posz < daz)
|
||||
|
@ -814,7 +820,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
break;
|
||||
case FIRE:
|
||||
case BURNING:
|
||||
if (sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2)
|
||||
if (Owner && Owner->picnum != TREE1 && Owner->picnum != TREE2)
|
||||
t->z = sector[t->sectnum].floorz;
|
||||
t->shade = -127;
|
||||
break;
|
||||
|
@ -911,8 +917,8 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
}
|
||||
else t->cstat &= ~4;
|
||||
|
||||
t->picnum = s->picnum + k + ((hittype[i].temp_data[0] < 4) * 5);
|
||||
t->shade = sprite[s->owner].shade;
|
||||
t->picnum = s->picnum + k + ((h->temp_data[0] < 4) * 5);
|
||||
if (Owner) t->shade = Owner->shade;
|
||||
break;
|
||||
case MUD:
|
||||
t->picnum = MUD + t1;
|
||||
|
@ -921,35 +927,35 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
t->picnum = WATERSPLASH2 + t1;
|
||||
break;
|
||||
case REACTOR2:
|
||||
t->picnum = s->picnum + hittype[i].temp_data[2];
|
||||
t->picnum = s->picnum + h->temp_data[2];
|
||||
break;
|
||||
case SHELL:
|
||||
t->picnum = s->picnum + (hittype[i].temp_data[0] & 1);
|
||||
t->picnum = s->picnum + (h->temp_data[0] & 1);
|
||||
case SHOTGUNSHELL:
|
||||
t->cstat |= 12;
|
||||
if (hittype[i].temp_data[0] > 1) t->cstat &= ~4;
|
||||
if (hittype[i].temp_data[0] > 2) t->cstat &= ~12;
|
||||
if (h->temp_data[0] > 1) t->cstat &= ~4;
|
||||
if (h->temp_data[0] > 2) t->cstat &= ~12;
|
||||
break;
|
||||
case FRAMEEFFECT1:
|
||||
if (s->owner >= 0 && sprite[s->owner].statnum < MAXSTATUS)
|
||||
if (Owner && Owner->statnum < MAXSTATUS)
|
||||
{
|
||||
if (sprite[s->owner].picnum == APLAYER)
|
||||
if (ud.camerasprite == -1)
|
||||
if (screenpeek == sprite[s->owner].yvel && display_mirror == 0)
|
||||
if (Owner->picnum == APLAYER)
|
||||
if (ud.cameraactor == nullptr)
|
||||
if (screenpeek == Owner->yvel && display_mirror == 0)
|
||||
{
|
||||
t->owner = -1;
|
||||
break;
|
||||
}
|
||||
if ((sprite[s->owner].cstat & 32768) == 0)
|
||||
if ((Owner->cstat & 32768) == 0)
|
||||
{
|
||||
if (sprite[s->owner].picnum == APLAYER)
|
||||
if (Owner->picnum == APLAYER)
|
||||
t->picnum = 1554;
|
||||
else
|
||||
t->picnum = hittype[s->owner].dispicnum;
|
||||
t->pal = sprite[s->owner].pal;
|
||||
t->shade = sprite[s->owner].shade;
|
||||
t->ang = sprite[s->owner].ang;
|
||||
t->cstat = 2 | sprite[s->owner].cstat;
|
||||
t->picnum = OwnerAc->dispicnum;
|
||||
t->pal = Owner->pal;
|
||||
t->shade = Owner->shade;
|
||||
t->ang = Owner->ang;
|
||||
t->cstat = 2 | Owner->cstat;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -967,7 +973,7 @@ void animatesprites_r(int x, int y, int a, int smoothratio)
|
|||
break;
|
||||
}
|
||||
|
||||
hittype[i].dispicnum = t->picnum;
|
||||
h->dispicnum = t->picnum;
|
||||
if (sector[t->sectnum].floorpicnum == MIRROR)
|
||||
t->xrepeat = t->yrepeat = 0;
|
||||
}
|
||||
|
|
|
@ -36,25 +36,22 @@ BEGIN_DUKE_NS
|
|||
short pinsectorresetdown(short sect);
|
||||
|
||||
|
||||
void ballreturn(short spr)
|
||||
void ballreturn(DDukeActor *ball)
|
||||
{
|
||||
int j, i;
|
||||
StatIterator it(STAT_BOWLING);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
DukeStatIterator it(STAT_BOWLING);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
auto si = &sprite[i];
|
||||
if (si->picnum == RRTILE281 && sprite[spr].sectnum == si->sectnum)
|
||||
if (act->s.picnum == RRTILE281 && ball->s.sectnum == act->s.sectnum)
|
||||
{
|
||||
StatIterator it2(STAT_BOWLING);
|
||||
while ((j = it2.NextIndex()) >= 0)
|
||||
DukeStatIterator it2(STAT_BOWLING);
|
||||
while (auto act2 = it2.Next())
|
||||
{
|
||||
auto sj = &sprite[j];
|
||||
if (sj->picnum == RRTILE282 && si->hitag == sj->hitag)
|
||||
fi.spawn(j, BOWLINGBALLSPRITE);
|
||||
if (sj->picnum == RRTILE280 && si->hitag == sj->hitag && sj->lotag == 0)
|
||||
if (act2->s.picnum == RRTILE282 && act->s.hitag == act2->s.hitag)
|
||||
spawn(act2, BOWLINGBALLSPRITE);
|
||||
if (act2->s.picnum == RRTILE280 && act->s.hitag == act2->s.hitag && act2->s.lotag == 0)
|
||||
{
|
||||
sj->lotag = 100;
|
||||
sj->extra++;
|
||||
act2->s.lotag = 100;
|
||||
act2->s.extra++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,15 +60,12 @@ void ballreturn(short spr)
|
|||
|
||||
short pinsectorresetdown(short sect)
|
||||
{
|
||||
int vel, j;
|
||||
|
||||
j = getanimationgoal(anim_ceilingz, sect);
|
||||
int j = getanimationgoal(anim_ceilingz, sect);
|
||||
|
||||
if (j == -1)
|
||||
{
|
||||
j = sector[sect].floorz;
|
||||
vel = 64;
|
||||
setanimation(sect, anim_ceilingz, sect, j, vel);
|
||||
setanimation(sect, anim_ceilingz, sect, j, 64);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -79,15 +73,12 @@ short pinsectorresetdown(short sect)
|
|||
|
||||
short pinsectorresetup(short sect)
|
||||
{
|
||||
int vel, j;
|
||||
|
||||
j = getanimationgoal(anim_ceilingz, sect);
|
||||
int j = getanimationgoal(anim_ceilingz, sect);
|
||||
|
||||
if (j == -1)
|
||||
{
|
||||
j = sector[nextsectorneighborz(sect, sector[sect].ceilingz, -1, -1)].ceilingz;
|
||||
vel = 64;
|
||||
setanimation(sect, anim_ceilingz, sect, j, vel);
|
||||
setanimation(sect, anim_ceilingz, sect, j, 64);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -99,76 +90,76 @@ short checkpins(short sect)
|
|||
int x, y;
|
||||
short pins[10];
|
||||
short tag;
|
||||
|
||||
pin = 0;
|
||||
for(i=0;i<10;i++) pins[i] = 0;
|
||||
|
||||
SectIterator it(sect);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
pin = 0;
|
||||
for (i = 0; i < 10; i++) pins[i] = 0;
|
||||
|
||||
DukeSectIterator it(sect);
|
||||
while (auto a2 = it.Next())
|
||||
{
|
||||
if (sprite[i].picnum == RRTILE3440)
|
||||
if (a2->s.picnum == RRTILE3440)
|
||||
{
|
||||
pin++;
|
||||
pins[sprite[i].lotag] = 1;
|
||||
pins[a2->s.lotag] = 1;
|
||||
}
|
||||
if (sprite[i].picnum == RRTILE280)
|
||||
if (a2->s.picnum == RRTILE280)
|
||||
{
|
||||
tag = sprite[i].hitag;
|
||||
tag = a2->s.hitag;
|
||||
}
|
||||
}
|
||||
|
||||
if (tag)
|
||||
{
|
||||
tag += 2024;
|
||||
tileCopySection(2024,0,0,128,64,tag,0,0);
|
||||
for(i=0;i<10;i++)
|
||||
tileCopySection(2024, 0, 0, 128, 64, tag, 0, 0);
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (pins[i] == 1)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
x = 64;
|
||||
y = 48;
|
||||
break;
|
||||
case 1:
|
||||
x = 56;
|
||||
y = 40;
|
||||
break;
|
||||
case 2:
|
||||
x = 72;
|
||||
y = 40;
|
||||
break;
|
||||
case 3:
|
||||
x = 48;
|
||||
y = 32;
|
||||
break;
|
||||
case 4:
|
||||
x = 64;
|
||||
y = 32;
|
||||
break;
|
||||
case 5:
|
||||
x = 80;
|
||||
y = 32;
|
||||
break;
|
||||
case 6:
|
||||
x = 40;
|
||||
y = 24;
|
||||
break;
|
||||
case 7:
|
||||
x = 56;
|
||||
y = 24;
|
||||
break;
|
||||
case 8:
|
||||
x = 72;
|
||||
y = 24;
|
||||
break;
|
||||
case 9:
|
||||
x = 88;
|
||||
y = 24;
|
||||
break;
|
||||
case 0:
|
||||
x = 64;
|
||||
y = 48;
|
||||
break;
|
||||
case 1:
|
||||
x = 56;
|
||||
y = 40;
|
||||
break;
|
||||
case 2:
|
||||
x = 72;
|
||||
y = 40;
|
||||
break;
|
||||
case 3:
|
||||
x = 48;
|
||||
y = 32;
|
||||
break;
|
||||
case 4:
|
||||
x = 64;
|
||||
y = 32;
|
||||
break;
|
||||
case 5:
|
||||
x = 80;
|
||||
y = 32;
|
||||
break;
|
||||
case 6:
|
||||
x = 40;
|
||||
y = 24;
|
||||
break;
|
||||
case 7:
|
||||
x = 56;
|
||||
y = 24;
|
||||
break;
|
||||
case 8:
|
||||
x = 72;
|
||||
y = 24;
|
||||
break;
|
||||
case 9:
|
||||
x = 88;
|
||||
y = 24;
|
||||
break;
|
||||
}
|
||||
tileCopySection(2023,0,0,8,8,tag,x-4,y-10);
|
||||
tileCopySection(2023, 0, 0, 8, 8, tag, x - 4, y - 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -178,84 +169,84 @@ short checkpins(short sect)
|
|||
|
||||
void resetpins(short sect)
|
||||
{
|
||||
short i, j, tag;
|
||||
int i, tag;
|
||||
int x, y;
|
||||
SectIterator it(sect);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
DukeSectIterator it(sect);
|
||||
while (auto a2 = it.Next())
|
||||
{
|
||||
if (sprite[i].picnum == 3440)
|
||||
deletesprite(i);
|
||||
if (a2->s.picnum == RRTILE3440)
|
||||
deletesprite(a2);
|
||||
}
|
||||
it.Reset(sect);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
while (auto a2 = it.Next())
|
||||
{
|
||||
if (sprite[i].picnum == 283)
|
||||
if (a2->s.picnum == 283)
|
||||
{
|
||||
j = fi.spawn(i,3440);
|
||||
sprite[j].lotag = sprite[i].lotag;
|
||||
if (sprite[j].lotag == 3 || sprite[j].lotag == 5)
|
||||
auto spawned = spawn(a2, RRTILE3440);
|
||||
spawned->s.lotag = a2->s.lotag;
|
||||
if (spawned->s.lotag == 3 || spawned->s.lotag == 5)
|
||||
{
|
||||
sprite[j].clipdist = (1+(krand()%1))*16+32;
|
||||
spawned->s.clipdist = (1 + (krand() % 1)) * 16 + 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite[j].clipdist = (1+(krand()%1))*16+32;
|
||||
spawned->s.clipdist = (1 + (krand() % 1)) * 16 + 32;
|
||||
}
|
||||
sprite[j].ang -= ((krand()&32)-(krand()&64))&2047;
|
||||
spawned->s.ang -= ((krand() & 32) - (krand() & 64)) & 2047;
|
||||
}
|
||||
if (sprite[i].picnum == 280)
|
||||
tag = sprite[i].hitag;
|
||||
if (a2->s.picnum == 280)
|
||||
tag = a2->s.hitag;
|
||||
}
|
||||
if (tag)
|
||||
{
|
||||
tag += LANEPICS+1;
|
||||
tileCopySection(LANEPICS+1,0,0,128,64,tag,0,0);
|
||||
for(i=0;i<10;i++)
|
||||
tag += LANEPICS + 1;
|
||||
tileCopySection(LANEPICS + 1, 0, 0, 128, 64, tag, 0, 0);
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
x = 64;
|
||||
y = 48;
|
||||
break;
|
||||
case 1:
|
||||
x = 56;
|
||||
y = 40;
|
||||
break;
|
||||
case 2:
|
||||
x = 72;
|
||||
y = 40;
|
||||
break;
|
||||
case 3:
|
||||
x = 48;
|
||||
y = 32;
|
||||
break;
|
||||
case 4:
|
||||
x = 64;
|
||||
y = 32;
|
||||
break;
|
||||
case 5:
|
||||
x = 80;
|
||||
y = 32;
|
||||
break;
|
||||
case 6:
|
||||
x = 40;
|
||||
y = 24;
|
||||
break;
|
||||
case 7:
|
||||
x = 56;
|
||||
y = 24;
|
||||
break;
|
||||
case 8:
|
||||
x = 72;
|
||||
y = 24;
|
||||
break;
|
||||
case 9:
|
||||
x = 88;
|
||||
y = 24;
|
||||
break;
|
||||
case 0:
|
||||
x = 64;
|
||||
y = 48;
|
||||
break;
|
||||
case 1:
|
||||
x = 56;
|
||||
y = 40;
|
||||
break;
|
||||
case 2:
|
||||
x = 72;
|
||||
y = 40;
|
||||
break;
|
||||
case 3:
|
||||
x = 48;
|
||||
y = 32;
|
||||
break;
|
||||
case 4:
|
||||
x = 64;
|
||||
y = 32;
|
||||
break;
|
||||
case 5:
|
||||
x = 80;
|
||||
y = 32;
|
||||
break;
|
||||
case 6:
|
||||
x = 40;
|
||||
y = 24;
|
||||
break;
|
||||
case 7:
|
||||
x = 56;
|
||||
y = 24;
|
||||
break;
|
||||
case 8:
|
||||
x = 72;
|
||||
y = 24;
|
||||
break;
|
||||
case 9:
|
||||
x = 88;
|
||||
y = 24;
|
||||
break;
|
||||
}
|
||||
tileCopySection(LANEPICS,0,0,8,8,tag,x-4,y-10);
|
||||
tileCopySection(LANEPICS, 0, 0, 8, 8, tag, x - 4, y - 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -265,58 +256,58 @@ void resetlanepics(void)
|
|||
int x, y;
|
||||
short i;
|
||||
short tag, pic;
|
||||
for(tag=0;tag<4;tag++)
|
||||
for (tag = 0; tag < 4; tag++)
|
||||
{
|
||||
pic = tag + 1;
|
||||
if (pic == 0) continue;
|
||||
pic += LANEPICS+1;
|
||||
tileCopySection(LANEPICS+1,0,0,128,64, pic,0,0);
|
||||
for(i=0;i<10;i++)
|
||||
pic += LANEPICS + 1;
|
||||
tileCopySection(LANEPICS + 1, 0, 0, 128, 64, pic, 0, 0);
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
x = 64;
|
||||
y = 48;
|
||||
break;
|
||||
case 1:
|
||||
x = 56;
|
||||
y = 40;
|
||||
break;
|
||||
case 2:
|
||||
x = 72;
|
||||
y = 40;
|
||||
break;
|
||||
case 3:
|
||||
x = 48;
|
||||
y = 32;
|
||||
break;
|
||||
case 4:
|
||||
x = 64;
|
||||
y = 32;
|
||||
break;
|
||||
case 5:
|
||||
x = 80;
|
||||
y = 32;
|
||||
break;
|
||||
case 6:
|
||||
x = 40;
|
||||
y = 24;
|
||||
break;
|
||||
case 7:
|
||||
x = 56;
|
||||
y = 24;
|
||||
break;
|
||||
case 8:
|
||||
x = 72;
|
||||
y = 24;
|
||||
break;
|
||||
case 9:
|
||||
x = 88;
|
||||
y = 24;
|
||||
break;
|
||||
case 0:
|
||||
x = 64;
|
||||
y = 48;
|
||||
break;
|
||||
case 1:
|
||||
x = 56;
|
||||
y = 40;
|
||||
break;
|
||||
case 2:
|
||||
x = 72;
|
||||
y = 40;
|
||||
break;
|
||||
case 3:
|
||||
x = 48;
|
||||
y = 32;
|
||||
break;
|
||||
case 4:
|
||||
x = 64;
|
||||
y = 32;
|
||||
break;
|
||||
case 5:
|
||||
x = 80;
|
||||
y = 32;
|
||||
break;
|
||||
case 6:
|
||||
x = 40;
|
||||
y = 24;
|
||||
break;
|
||||
case 7:
|
||||
x = 56;
|
||||
y = 24;
|
||||
break;
|
||||
case 8:
|
||||
x = 72;
|
||||
y = 24;
|
||||
break;
|
||||
case 9:
|
||||
x = 88;
|
||||
y = 24;
|
||||
break;
|
||||
}
|
||||
tileCopySection(LANEPICS,0,0,8,8,pic,x-4,y-10);
|
||||
tileCopySection(LANEPICS, 0, 0, 8, 8, pic, x - 4, y - 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ static int ccmd_spawn(CCmdFuncPtr parm)
|
|||
unsigned int cstat = 0, picnum = 0;
|
||||
unsigned int pal = 0;
|
||||
int ang = 0;
|
||||
int set = 0, idx;
|
||||
int set = 0;
|
||||
|
||||
#if 0 // fixme - route through the network and this limitation becomes irrelevant
|
||||
if (netgame || numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME)) {
|
||||
|
@ -88,14 +88,15 @@ static int ccmd_spawn(CCmdFuncPtr parm)
|
|||
return CCMD_SHOWHELP;
|
||||
}
|
||||
|
||||
idx = fi.spawn(ps[myconnectindex].i, (short)picnum);
|
||||
if (set & 1) sprite[idx].pal = (char)pal;
|
||||
if (set & 2) sprite[idx].cstat = (short)cstat;
|
||||
if (set & 4) sprite[idx].ang = ang;
|
||||
auto spawned = spawn(ps[myconnectindex].GetActor(), picnum);
|
||||
if (set & 1) spawned->s.pal = (char)pal;
|
||||
if (set & 2) spawned->s.cstat = (short)cstat;
|
||||
if (set & 4) spawned->s.ang = ang;
|
||||
if (set & 8) {
|
||||
if (setsprite(idx, x, y, z) < 0) {
|
||||
if (setsprite(spawned, x, y, z) < 0)
|
||||
{
|
||||
Printf("spawn: Sprite can't be spawned into null space\n");
|
||||
deletesprite(idx);
|
||||
deletesprite(spawned);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,10 +107,10 @@ static const char* cheatUnlock()
|
|||
{
|
||||
if (j & (0xffff - 16384))
|
||||
sector[i].lotag &= (0xffff - 16384);
|
||||
operatesectors(i, ps[myconnectindex].i);
|
||||
operatesectors(i, ps[myconnectindex].GetActor());
|
||||
}
|
||||
}
|
||||
fi.operateforcefields(ps[myconnectindex].i, -1);
|
||||
fi.operateforcefields(ps[myconnectindex].GetActor(), -1);
|
||||
return quoteMgr.GetQuote(QUOTE_CHEAT_UNLOCK);
|
||||
}
|
||||
|
||||
|
@ -118,10 +118,10 @@ static const char *cheatKfc(int player)
|
|||
{
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
int spr = fi.spawn(ps[player].i, TILE_HEN);
|
||||
sprite[spr].pal = 1;
|
||||
sprite[spr].xrepeat = sprite[spr].xrepeat << 2;
|
||||
sprite[spr].yrepeat = sprite[spr].yrepeat << 2;
|
||||
auto spr = spawn(ps[player].GetActor(), TILE_HEN);
|
||||
spr->s.pal = 1;
|
||||
spr->s.xrepeat = spr->s.xrepeat << 2;
|
||||
spr->s.yrepeat = spr->s.yrepeat << 2;
|
||||
}
|
||||
return quoteMgr.GetQuote(QUOTE_CHEAT_KFC);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
|
|||
return cheatMonsters();
|
||||
|
||||
case CHT_BIKE:
|
||||
OnMotorcycle(&ps[player], 0);
|
||||
OnMotorcycle(&ps[player], nullptr);
|
||||
ps[player].ammo_amount[MOTORCYCLE_WEAPON] = max_ammo_amount[MOTORCYCLE_WEAPON];
|
||||
return quoteMgr.GetQuote(QUOTE_ON_BIKE);
|
||||
|
||||
|
@ -195,7 +195,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
|
|||
ps[player].gotweapon.Zero();
|
||||
ps[player].curr_weapon = KNEE_WEAPON;
|
||||
ps[player].nocheat = 1;
|
||||
sprite[ps[player].i].extra = 1;
|
||||
ps[player].GetActor()->s.extra = 1;
|
||||
return quoteMgr.GetQuote(QUOTE_YERFUCKED);
|
||||
|
||||
case CHT_AARON:
|
||||
|
@ -241,11 +241,11 @@ static bool cheatInventory(int player)
|
|||
{
|
||||
auto invGet = [=](int defvalue, int evtype, int16_t &dest)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, defvalue, -1, player);
|
||||
OnEvent(evtype, -1, player, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, player) >= 0)
|
||||
SetGameVarID(g_iReturnVarID, defvalue, nullptr, player);
|
||||
OnEvent(evtype, player, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, nullptr, player) >= 0)
|
||||
{
|
||||
dest = GetGameVarID(g_iReturnVarID, -1, player);
|
||||
dest = GetGameVarID(g_iReturnVarID, nullptr, player);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -472,7 +472,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
|
|||
int type = ReadByte(stream);
|
||||
if (skip) return;
|
||||
|
||||
if (numplayers != 1 || gamestate != GS_LEVEL || sprite[ps[player].i].extra <= 0)
|
||||
if (numplayers != 1 || gamestate != GS_LEVEL || ps[player].GetActor()->s.extra <= 0)
|
||||
{
|
||||
Printf("give: Cannot give while dead or not in a single-player game.\n");
|
||||
return;
|
||||
|
@ -486,7 +486,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
|
|||
break;
|
||||
|
||||
case GIVE_HEALTH:
|
||||
sprite[ps[player].i].extra = max_player_health << 1;
|
||||
ps[player].GetActor()->s.extra = max_player_health << 1;
|
||||
break;
|
||||
|
||||
case GIVE_WEAPONS:
|
||||
|
|
|
@ -288,12 +288,6 @@ enum amoveflags_t
|
|||
antifaceplayerslow = 32768
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SWITCH_WALL,
|
||||
SWITCH_SPRITE
|
||||
};
|
||||
|
||||
enum sflags_t
|
||||
{
|
||||
SFLAG_SHADOW = 0x00000001,
|
||||
|
|
|
@ -93,7 +93,7 @@ bool GameInterface::CanSave()
|
|||
{
|
||||
if (ud.recstat == 2 || gamestate != GS_LEVEL) return false;
|
||||
auto &myplayer = ps[myconnectindex];
|
||||
return (sprite[myplayer.i].extra > 0);
|
||||
return (myplayer.GetActor()->s.extra > 0);
|
||||
}
|
||||
|
||||
bool GameInterface::StartGame(FNewGameStartup& gs)
|
||||
|
|
|
@ -41,20 +41,18 @@ void animatewalls_d(void);
|
|||
void animatewalls_r(void);
|
||||
void operaterespawns_d(int low);
|
||||
void operaterespawns_r(int low);
|
||||
void operateforcefields_r(int s, int low);
|
||||
void operateforcefields_d(int s, int low);
|
||||
bool checkhitswitch_d(int snum, int w, int switchtype);
|
||||
bool checkhitswitch_r(int snum, int w, int switchtype);
|
||||
void activatebysector_d(int sect, int j);
|
||||
void activatebysector_r(int sect, int j);
|
||||
void checkhitwall_d(int spr, int dawallnum, int x, int y, int z, int atwith);
|
||||
void checkhitwall_r(int spr, int dawallnum, int x, int y, int z, int atwith);
|
||||
void checkplayerhurt_d(struct player_struct* p, int j);
|
||||
void checkplayerhurt_r(struct player_struct* p, int j);
|
||||
void operateforcefields_r(DDukeActor* act, int low);
|
||||
void operateforcefields_d(DDukeActor* act, int low);
|
||||
bool checkhitswitch_d(int snum, int w, DDukeActor *act);
|
||||
bool checkhitswitch_r(int snum, int w, DDukeActor* act);
|
||||
void activatebysector_d(int sect, DDukeActor* j);
|
||||
void activatebysector_r(int sect, DDukeActor* j);
|
||||
void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith);
|
||||
void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith);
|
||||
bool checkhitceiling_d(int sn);
|
||||
bool checkhitceiling_r(int sn);
|
||||
void checkhitsprite_d(int i, int sn);
|
||||
void checkhitsprite_r(int i, int sn);
|
||||
void checkhitsprite_d(DDukeActor* i, DDukeActor* sn);
|
||||
void checkhitsprite_r(DDukeActor* i, DDukeActor* sn);
|
||||
void checksectors_d(int snum);
|
||||
void checksectors_r(int snum);
|
||||
|
||||
|
@ -64,38 +62,32 @@ bool floorspace_d(int sectnum);
|
|||
bool floorspace_r(int sectnum);
|
||||
void addweapon_d(struct player_struct* p, int weapon);
|
||||
void addweapon_r(struct player_struct* p, int weapon);
|
||||
void hitradius_d(short i, int r, int hp1, int hp2, int hp3, int hp4);
|
||||
void hitradius_r(short i, int r, int hp1, int hp2, int hp3, int hp4);
|
||||
void hitradius_d(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4);
|
||||
void hitradius_r(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4);
|
||||
void lotsofmoney_d(DDukeActor* s, short n);
|
||||
void lotsofmail_d(DDukeActor* s, short n);
|
||||
void lotsofpaper_d(DDukeActor* s, short n);
|
||||
void lotsoffeathers_r(DDukeActor* s, short n);
|
||||
void guts_d(spritetype* s, short gtype, short n, short p);
|
||||
void guts_r(spritetype* s, short gtype, short n, short p);
|
||||
void gutsdir_d(spritetype* s, short gtype, short n, short p);
|
||||
void gutsdir_r(spritetype* s, short gtype, short n, short p);
|
||||
int ifhitsectors_d(int sectnum);
|
||||
int ifhitsectors_r(int sectnum);
|
||||
void guts_d(DDukeActor* s, short gtype, short n, short p);
|
||||
void guts_r(DDukeActor* s, short gtype, short n, short p);
|
||||
DDukeActor* ifhitsectors_d(int sectnum);
|
||||
DDukeActor* ifhitsectors_r(int sectnum);
|
||||
int ifhitbyweapon_r(DDukeActor* sn);
|
||||
int ifhitbyweapon_d(DDukeActor* sn);
|
||||
void fall_d(int g_i, int g_p);
|
||||
void fall_r(int g_i, int g_p);
|
||||
void fall_d(DDukeActor* i, int g_p);
|
||||
void fall_r(DDukeActor* 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);
|
||||
int spawn_d(int j, int pn);
|
||||
int spawn_r(int j, int pn);
|
||||
void check_fta_sounds_d(int i);
|
||||
void check_fta_sounds_r(int i);
|
||||
void respawnhitag_d(DDukeActor* g_sp);
|
||||
void respawnhitag_r(DDukeActor* g_sp);
|
||||
void checktimetosleep_d(DDukeActor* actor);
|
||||
void checktimetosleep_r(DDukeActor* actor);
|
||||
void move_d(DDukeActor* i, int g_p, int g_x);
|
||||
void move_r(DDukeActor* i, int g_p, int g_x);
|
||||
void incur_damage_d(struct player_struct* p);
|
||||
void incur_damage_r(struct player_struct* p);
|
||||
void shoot_d(int i, int atwith);
|
||||
void shoot_r(int i, int atwith);
|
||||
void shoot_d(DDukeActor* i, int atwith);
|
||||
void shoot_r(DDukeActor* i, int atwith);
|
||||
void selectweapon_d(int snum, int j);
|
||||
void selectweapon_r(int snum, int j);
|
||||
int doincrements_d(struct player_struct* p);
|
||||
|
@ -141,7 +133,6 @@ void SetDispatcher()
|
|||
checkhitswitch_d,
|
||||
activatebysector_d,
|
||||
checkhitwall_d,
|
||||
checkplayerhurt_d,
|
||||
checkhitceiling_d,
|
||||
checkhitsprite_d,
|
||||
checksectors_d,
|
||||
|
@ -150,12 +141,10 @@ void SetDispatcher()
|
|||
floorspace_d,
|
||||
addweapon_d,
|
||||
hitradius_d,
|
||||
movesprite_d,
|
||||
lotsofmoney_d,
|
||||
lotsofmail_d,
|
||||
lotsofpaper_d,
|
||||
guts_d,
|
||||
gutsdir_d,
|
||||
ifhitsectors_d,
|
||||
ifhitbyweapon_d,
|
||||
fall_d,
|
||||
|
@ -163,8 +152,6 @@ void SetDispatcher()
|
|||
respawnhitag_d,
|
||||
checktimetosleep_d,
|
||||
move_d,
|
||||
spawn_d,
|
||||
check_fta_sounds_d,
|
||||
|
||||
incur_damage_d,
|
||||
shoot_d,
|
||||
|
@ -193,7 +180,6 @@ void SetDispatcher()
|
|||
checkhitswitch_r,
|
||||
activatebysector_r,
|
||||
checkhitwall_r,
|
||||
checkplayerhurt_r,
|
||||
checkhitceiling_r,
|
||||
checkhitsprite_r,
|
||||
checksectors_r,
|
||||
|
@ -202,12 +188,10 @@ void SetDispatcher()
|
|||
floorspace_r,
|
||||
addweapon_r,
|
||||
hitradius_r,
|
||||
movesprite_r,
|
||||
lotsoffeathers_r,
|
||||
lotsoffeathers_r,
|
||||
lotsoffeathers_r,
|
||||
guts_r,
|
||||
gutsdir_r,
|
||||
ifhitsectors_r,
|
||||
ifhitbyweapon_r,
|
||||
fall_r,
|
||||
|
@ -215,8 +199,6 @@ void SetDispatcher()
|
|||
respawnhitag_r,
|
||||
checktimetosleep_r,
|
||||
move_r,
|
||||
spawn_r,
|
||||
check_fta_sounds_r,
|
||||
|
||||
incur_damage_r,
|
||||
shoot_r,
|
||||
|
|
|
@ -75,38 +75,33 @@ struct Dispatcher
|
|||
bool (*isadoorwall)(int dapic);
|
||||
void (*animatewalls)();
|
||||
void (*operaterespawns)(int low);
|
||||
void (*operateforcefields)(int s, int low);
|
||||
bool (*checkhitswitch)(int snum, int w, int switchtype);
|
||||
void (*activatebysector)(int sect, int j);
|
||||
void (*checkhitwall)(int spr, int dawallnum, int x, int y, int z, int atwith);
|
||||
void (*checkplayerhurt)(struct player_struct* p, int j);
|
||||
void (*operateforcefields)(DDukeActor* act, int low);
|
||||
bool (*checkhitswitch)(int snum, int w, DDukeActor* act);
|
||||
void (*activatebysector)(int sect, DDukeActor* j);
|
||||
void (*checkhitwall)(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith);
|
||||
bool (*checkhitceiling)(int sn);
|
||||
void (*checkhitsprite)(int i, int sn);
|
||||
void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn);
|
||||
void (*checksectors)(int low);
|
||||
|
||||
bool (*ceilingspace)(int sectnum);
|
||||
bool (*floorspace)(int sectnum);
|
||||
void (*addweapon)(struct player_struct *p, int weapon);
|
||||
void (*hitradius)(short i, int r, int hp1, int hp2, int hp3, int hp4);
|
||||
int (*movesprite)(int spritenum, int xchange, int ychange, int zchange, unsigned int cliptype);
|
||||
void (*hitradius)(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4);
|
||||
void (*lotsofmoney)(DDukeActor *s, short n);
|
||||
void (*lotsofmail)(DDukeActor *s, short n);
|
||||
void (*lotsofpaper)(DDukeActor *s, short n);
|
||||
void (*guts)(spritetype* s, short gtype, short n, short p);
|
||||
void (*gutsdir)(spritetype* s, short gtype, short n, short p);
|
||||
int (*ifhitsectors)(int sectnum);
|
||||
void (*guts)(DDukeActor* s, short gtype, short n, short p);
|
||||
DDukeActor* (*ifhitsectors)(int sectnum);
|
||||
int (*ifhitbyweapon)(DDukeActor* sectnum);
|
||||
void (*fall)(int g_i, int g_p);
|
||||
void (*fall)(DDukeActor* actor, 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);
|
||||
int (*spawn)(int j, int pn);
|
||||
void (*check_fta_sounds)(int i);
|
||||
void (*respawnhitag)(DDukeActor* g_sp);
|
||||
void (*checktimetosleep)(DDukeActor* actor);
|
||||
void (*move)(DDukeActor* i, int g_p, int g_x);
|
||||
|
||||
// player
|
||||
void (*incur_damage)(struct player_struct* p);
|
||||
void (*shoot)(int, int);
|
||||
void (*shoot)(DDukeActor*, int);
|
||||
void (*selectweapon)(int snum, int j);
|
||||
int (*doincrements)(struct player_struct* p);
|
||||
void (*checkweapons)(struct player_struct* p);
|
||||
|
|
|
@ -68,6 +68,22 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class DukeLinearSpriteIterator
|
||||
{
|
||||
int index = 0;
|
||||
public:
|
||||
|
||||
DDukeActor* Next()
|
||||
{
|
||||
while (index < MAXSPRITES)
|
||||
{
|
||||
auto p = &hittype[index++];
|
||||
if (p->s.statnum != MAXSTATUS) return p;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
inline DDukeActor* player_struct::GetActor()
|
||||
{
|
||||
return &hittype[i];
|
||||
|
@ -116,31 +132,6 @@ inline int setsprite(int i, int x, int y, int z)
|
|||
return ::setsprite(i, x, y, z);
|
||||
}
|
||||
|
||||
inline int S_PlayActorSound(int soundNum, DDukeActor* spriteNum, int channel = CHAN_AUTO, EChanFlags flags = 0)
|
||||
{
|
||||
return S_PlayActorSound(soundNum, spriteNum ? spriteNum->GetIndex() : -1, channel, flags);
|
||||
}
|
||||
|
||||
inline void S_StopSound(int sndNum, DDukeActor* actor, int flags = -1)
|
||||
{
|
||||
S_StopSound(sndNum, actor ? actor->GetIndex() : -1, flags);
|
||||
}
|
||||
|
||||
inline void S_RelinkActorSound(DDukeActor* from, DDukeActor* to)
|
||||
{
|
||||
S_RelinkActorSound(from ? from->GetIndex() : -1, to ? to->GetIndex() : -1);
|
||||
}
|
||||
|
||||
inline int S_CheckActorSoundPlaying(DDukeActor* a, int soundNum, int channel = 0)
|
||||
{
|
||||
return S_CheckActorSoundPlaying(a->GetIndex(), soundNum, channel);
|
||||
}
|
||||
|
||||
inline DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, DDukeActor* Owner, signed char s_ss)
|
||||
{
|
||||
return &hittype[EGS(whatsect, s_x, s_y, s_z, s_pn, s_s, s_xr, s_yr, s_a, s_ve, s_zv, Owner ? Owner->GetIndex() : -1, s_ss)];
|
||||
}
|
||||
|
||||
inline int ActorToScriptIndex(DDukeActor* a)
|
||||
{
|
||||
if (!a) return -1;
|
||||
|
@ -154,14 +145,12 @@ inline DDukeActor* ScriptIndexToActor(int index)
|
|||
return &hittype[index];
|
||||
}
|
||||
|
||||
inline bool wallswitchcheck(DDukeActor* s)
|
||||
{
|
||||
return !!(tileinfo[s->s.picnum].flags & TFLAG_WALLSWITCH);
|
||||
}
|
||||
int spawn_d(int j, int pn);
|
||||
int spawn_r(int j, int pn);
|
||||
|
||||
inline DDukeActor* spawn(DDukeActor* spawner, int type)
|
||||
{
|
||||
int i = fi.spawn(spawner ? spawner->GetIndex() : -1, type);
|
||||
int i = (isRR()? spawn_r : spawn_d)(spawner ? spawner->GetIndex() : -1, type);
|
||||
return i == -1 ? nullptr : &hittype[i];
|
||||
}
|
||||
|
||||
|
@ -185,79 +174,52 @@ inline int bossguy(DDukeActor* pSprite)
|
|||
return bossguypic(pSprite->s.picnum);
|
||||
}
|
||||
|
||||
inline int GetGameVarID(int id, DDukeActor* sActor, int sPlayer)
|
||||
{
|
||||
return GetGameVarID(id, sActor->GetIndex(), sPlayer);
|
||||
}
|
||||
|
||||
inline void SetGameVarID(int id, int lValue, DDukeActor* sActor, int sPlayer)
|
||||
{
|
||||
SetGameVarID(id, lValue, sActor->GetIndex(), sPlayer);
|
||||
}
|
||||
|
||||
// old interface versions of already changed functions
|
||||
|
||||
inline void RANDOMSCRAP(spritetype* s, int i)
|
||||
{
|
||||
return RANDOMSCRAP(&hittype[s - sprite]);
|
||||
}
|
||||
|
||||
inline void deletesprite(int num)
|
||||
{
|
||||
deletesprite(&hittype[num]);
|
||||
}
|
||||
|
||||
inline int ssp(int i, unsigned int cliptype) //The set sprite function
|
||||
{
|
||||
return ssp(&hittype[i], cliptype);
|
||||
}
|
||||
|
||||
int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, unsigned int cliptype, Collision& result);
|
||||
int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, unsigned int cliptype, Collision& result);
|
||||
|
||||
inline int movesprite_d(int actor, int xchange, int ychange, int zchange, unsigned int cliptype)
|
||||
{
|
||||
Collision c;
|
||||
movesprite_ex_d(&hittype[actor], xchange, ychange, zchange, cliptype, c);
|
||||
return c.legacyVal;
|
||||
}
|
||||
|
||||
inline int movesprite_r(int actor, int xchange, int ychange, int zchange, unsigned int cliptype)
|
||||
{
|
||||
Collision c;
|
||||
movesprite_ex_r(&hittype[actor], xchange, ychange, zchange, cliptype, c);
|
||||
return c.legacyVal;
|
||||
}
|
||||
|
||||
inline int movesprite_ex(DDukeActor* actor, int xchange, int ychange, int zchange, unsigned int cliptype, Collision& result)
|
||||
{
|
||||
auto f = isRR() ? movesprite_ex_r : movesprite_ex_d;
|
||||
return f(actor, xchange, ychange, zchange, cliptype, result);
|
||||
}
|
||||
|
||||
inline void ms(short i)
|
||||
inline int clipmove_ex(int* x, int* y, int* z, short* sect, int xv, int yv, int wal, int ceil, int flor, int ct, Collision& result)
|
||||
{
|
||||
ms(&hittype[i]);
|
||||
int res = clipmove(x, y, z, sect, xv, yv, wal, ceil, flor, ct);
|
||||
return result.setFromEngine(res);
|
||||
}
|
||||
|
||||
inline void execute(DDukeActor* act, int a, int b)
|
||||
inline void getzrange_ex(int x, int y, int z, int16_t sectnum, int32_t* ceilz, Collision& ceilhit, int32_t* florz, Collision& florhit, int32_t walldist, uint32_t cliptype)
|
||||
{
|
||||
execute(act->GetIndex(), a, b);
|
||||
int ch, fh;
|
||||
getzrange(x, y, z, sectnum, ceilz, &ch, florz, &fh, walldist, cliptype);
|
||||
ceilhit.setFromEngine(ch);
|
||||
florhit.setFromEngine(fh);
|
||||
}
|
||||
|
||||
inline void makeitfall(DDukeActor* act)
|
||||
inline int hitscan(int x, int y, int z, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz,
|
||||
short* hitsect, short* hitwall, DDukeActor** hitspr, int* hitx, int* hity, int* hitz, uint32_t cliptype)
|
||||
{
|
||||
makeitfall(act->GetIndex());
|
||||
short hitsprt;
|
||||
int res = ::hitscan(x, y, z, sectnum, vx, vy, vz, hitsect, hitwall, &hitsprt, hitx, hity, hitz, cliptype);
|
||||
if (hitspr) *hitspr = hitsprt == -1 ? nullptr : &hittype[hitsprt];
|
||||
return res;
|
||||
}
|
||||
|
||||
inline void getglobalz(DDukeActor* act)
|
||||
inline void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange,
|
||||
int16_t* neartagsector, int16_t* neartagwall, DDukeActor** neartagsprite,
|
||||
int32_t* neartaghitdist, int32_t neartagrange, uint8_t tagsearch)
|
||||
{
|
||||
getglobalz(act->GetIndex());
|
||||
}
|
||||
|
||||
inline int findplayer(DDukeActor* act, int* x)
|
||||
{
|
||||
return findplayer(&act->s, x);
|
||||
int16_t nts;
|
||||
::neartag(xs, ys, zs, sectnum, ange, neartagsector, neartagwall, &nts, neartaghitdist, neartagrange, tagsearch);
|
||||
*neartagsprite = nts == -1 ? nullptr : &hittype[nts];
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -40,6 +40,14 @@ BEGIN_DUKE_NS
|
|||
|
||||
void initactorflags_d()
|
||||
{
|
||||
actorinfo[COMMANDER].gutsoffset = -(24 << 8);
|
||||
|
||||
for (auto &fa : actorinfo)
|
||||
{
|
||||
fa.falladjustz = 24 << 8;
|
||||
}
|
||||
actorinfo[OCTABRAIN].falladjustz = actorinfo[COMMANDER].falladjustz = actorinfo[DRONE].falladjustz = 0;
|
||||
|
||||
setflag(SFLAG_INTERNAL_BADGUY, {
|
||||
SHARK,
|
||||
RECON,
|
||||
|
|
|
@ -34,6 +34,19 @@ BEGIN_DUKE_NS
|
|||
|
||||
void initactorflags_r()
|
||||
{
|
||||
for (auto &fa : actorinfo)
|
||||
{
|
||||
fa.falladjustz = 24 << 8;
|
||||
}
|
||||
if (isRRRA())
|
||||
{
|
||||
actorinfo[HULKBOAT].falladjustz = 12 << 8;
|
||||
actorinfo[MINIONBOAT].falladjustz = 3 << 8;
|
||||
actorinfo[CHEERBOAT].falladjustz = actorinfo[EMPTYBOAT].falladjustz = 6 << 8;
|
||||
}
|
||||
actorinfo[DRONE].falladjustz = 0;
|
||||
|
||||
|
||||
setflag(SFLAG_INTERNAL_BADGUY|SFLAG_KILLCOUNT, {
|
||||
BOULDER,
|
||||
BOULDER1,
|
||||
|
|
|
@ -17,8 +17,8 @@ BEGIN_DUKE_NS
|
|||
void lava_cleararrays();
|
||||
void addjaildoor(int p1, int p2, int iht, int jlt, int p3, int h);
|
||||
void addminecart(int p1, int p2, int i, int iht, int p3, int childsectnum);
|
||||
void addtorch(int i);
|
||||
void addlightning(int i);
|
||||
void addtorch(spritetype* i);
|
||||
void addlightning(spritetype* i);
|
||||
|
||||
void movecyclers(void);
|
||||
void movedummyplayers(void);
|
||||
|
@ -31,82 +31,88 @@ void moveclouds(double smoothratio);
|
|||
void RANDOMSCRAP(DDukeActor* i);
|
||||
void ms(DDukeActor* i);
|
||||
void movecrane(DDukeActor* i, int crane);
|
||||
void movefountain(int i, int fountain);
|
||||
void moveflammable(int i, int tire, int box, int pool);
|
||||
void detonate(int i, int explosion);
|
||||
void movemasterswitch(int i, int spectype1, int spectype2);
|
||||
void movetrash(int i);
|
||||
void movewaterdrip(int i, int drip);
|
||||
void movedoorshock(int i);
|
||||
void movetouchplate(int i, int plate);
|
||||
void movecanwithsomething(int i);
|
||||
void bounce(int i);
|
||||
void movetongue(int i, int tongue, int jaw);
|
||||
void rpgexplode(int i, int j, const vec3_t& pos, int EXPLOSION2, int EXPLOSION2BOT, int newextra, int playsound);
|
||||
void moveooz(int i, int seenine, int seeninedead, int ooz, int explosion);
|
||||
void movefountain(DDukeActor* i, int fountain);
|
||||
void moveflammable(DDukeActor* i, int tire, int box, int pool);
|
||||
void detonate(DDukeActor* i, int explosion);
|
||||
void movemasterswitch(DDukeActor* i, int spectype1, int spectype2);
|
||||
void movetrash(DDukeActor* i);
|
||||
void movewaterdrip(DDukeActor* i, int drip);
|
||||
void movedoorshock(DDukeActor* i);
|
||||
void movetouchplate(DDukeActor* i, int plate);
|
||||
void movecanwithsomething(DDukeActor* i);
|
||||
void bounce(DDukeActor* i);
|
||||
void movetongue(DDukeActor* i, int tongue, int jaw);
|
||||
void rpgexplode(DDukeActor* i, int j, const vec3_t& pos, int EXPLOSION2, int EXPLOSIONBOT2, int newextra, int playsound);
|
||||
void moveooz(DDukeActor* i, int seenine, int seeninedead, int ooz, int explosion);
|
||||
void lotsofstuff(DDukeActor* s, int n, int spawntype);
|
||||
bool respawnmarker(int i, int yellow, int green);
|
||||
bool rat(int i, bool makesound);
|
||||
bool queball(int i, int pocket, int queball, int stripeball);
|
||||
void forcesphere(int i, int forcesphere);
|
||||
void recon(int i, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(int i));
|
||||
void ooz(int i);
|
||||
void reactor(int i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK);
|
||||
void camera(int i);
|
||||
void forcesphere(int i);
|
||||
void watersplash2(int i);
|
||||
void frameeffect1(int i);
|
||||
bool money(int i, int BLOODPOOL);
|
||||
bool jibs(int i, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2);
|
||||
bool bloodpool(int i, bool puke, int TIRE);
|
||||
void shell(int i, bool morecheck);
|
||||
void glasspieces(int i);
|
||||
void scrap(int i, int SCRAP1, int SCRAP6);
|
||||
bool respawnmarker(DDukeActor* i, int yellow, int green);
|
||||
bool rat(DDukeActor* i, bool makesound);
|
||||
bool queball(DDukeActor* i, int pocket, int queball, int stripeball);
|
||||
void forcesphere(DDukeActor* i, int forcesphere);
|
||||
void recon(DDukeActor* i, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(DDukeActor* i));
|
||||
void ooz(DDukeActor* i);
|
||||
void reactor(DDukeActor* i, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK);
|
||||
void camera(DDukeActor* i);
|
||||
void forcesphereexplode(DDukeActor* i);
|
||||
void watersplash2(DDukeActor* i);
|
||||
void frameeffect1(DDukeActor* i);
|
||||
bool money(DDukeActor* i, int BLOODPOOL);
|
||||
bool jibs(DDukeActor* i, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2);
|
||||
bool bloodpool(DDukeActor* i, bool puke, int TIRE);
|
||||
void shell(DDukeActor* i, bool morecheck);
|
||||
void glasspieces(DDukeActor* i);
|
||||
void scrap(DDukeActor* i, int SCRAP1, int SCRAP6);
|
||||
|
||||
void handle_se00(int i, int LASERLINE);
|
||||
void handle_se01(int i);
|
||||
void handle_se14(int i, bool checkstat, int RPG, int JIBS6);
|
||||
void handle_se30(int i, int JIBS6);
|
||||
void handle_se02(int i);
|
||||
void handle_se03(int i);
|
||||
void handle_se04(int i);
|
||||
void handle_se05(int i, int FIRELASER);
|
||||
void handle_se08(int i, bool checkhitag1);
|
||||
void handle_se10(int i, const int *);
|
||||
void handle_se11(int i);
|
||||
void handle_se12(int i, int planeonly = 0);
|
||||
void handle_se13(int i);
|
||||
void handle_se15(int i);
|
||||
void handle_se16(int i, int REACTOR, int REACTOR2);
|
||||
void handle_se17(int i);
|
||||
void handle_se18(int i, bool morecheck);
|
||||
void handle_se19(int i, int BIGFORCE);
|
||||
void handle_se20(int i);
|
||||
void handle_se21(int i);
|
||||
void handle_se22(int i);
|
||||
void handle_se26(int i);
|
||||
void handle_se27(int i);
|
||||
void handle_se32(int i);
|
||||
void handle_se35(int i, int SMALLSMOKE, int EXPLOSION2);
|
||||
void handle_se128(int i);
|
||||
void handle_se130(int i, int countmax, int EXPLOSION2);
|
||||
void handle_se00(DDukeActor* i, int LASERLINE);
|
||||
void handle_se01(DDukeActor* i);
|
||||
void handle_se14(DDukeActor* i, bool checkstat, int RPG, int JIBS6);
|
||||
void handle_se30(DDukeActor* i, int JIBS6);
|
||||
void handle_se02(DDukeActor* i);
|
||||
void handle_se03(DDukeActor* i);
|
||||
void handle_se04(DDukeActor* i);
|
||||
void handle_se05(DDukeActor* i, int FIRELASER);
|
||||
void handle_se08(DDukeActor* i, bool checkhitag1);
|
||||
void handle_se10(DDukeActor* i, const int *);
|
||||
void handle_se11(DDukeActor* i);
|
||||
void handle_se12(DDukeActor* i, int planeonly = 0);
|
||||
void handle_se13(DDukeActor* i);
|
||||
void handle_se15(DDukeActor* i);
|
||||
void handle_se16(DDukeActor* i, int REACTOR, int REACTOR2);
|
||||
void handle_se17(DDukeActor* i);
|
||||
void handle_se18(DDukeActor* i, bool morecheck);
|
||||
void handle_se19(DDukeActor* i, int BIGFORCE);
|
||||
void handle_se20(DDukeActor* i);
|
||||
void handle_se21(DDukeActor* i);
|
||||
void handle_se22(DDukeActor* i);
|
||||
void handle_se24(DDukeActor* actor, int16_t* list1, int16_t* list2, int TRIPBOMB, int LASERLINE, int CRANE, int shift);
|
||||
void handle_se25(DDukeActor* a, int t_index, int snd1, int snd2);
|
||||
void handle_se26(DDukeActor* i);
|
||||
void handle_se27(DDukeActor* i);
|
||||
void handle_se31(DDukeActor* a, bool choosedir);
|
||||
void handle_se32(DDukeActor* i);
|
||||
void handle_se35(DDukeActor* i, int SMALLSMOKE, int EXPLOSION2);
|
||||
void handle_se128(DDukeActor* i);
|
||||
void handle_se130(DDukeActor* i, int countmax, int EXPLOSION2);
|
||||
|
||||
void respawn_rrra(DDukeActor* oldact, DDukeActor* newact);
|
||||
// This is only called from game specific code so it does not need an indirection.
|
||||
void check_fta_sounds_d(DDukeActor* i);
|
||||
void check_fta_sounds_r(DDukeActor* i);
|
||||
|
||||
int dodge(spritetype*);
|
||||
void alterang(int a, int g_i, int g_p);
|
||||
void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(int, int), void (*falladjustz)(spritetype*));
|
||||
int dodge(DDukeActor*);
|
||||
void alterang(int ang, DDukeActor* actor, int g_p);
|
||||
void fall_common(DDukeActor* actor, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(DDukeActor*, int));
|
||||
void checkavailweapon(struct player_struct* p);
|
||||
void deletesprite(DDukeActor* num);
|
||||
void addammo(int weapon, struct player_struct* p, int amount);
|
||||
|
||||
int ssp(DDukeActor* i, unsigned int cliptype); //The set sprite function
|
||||
void insertspriteq(DDukeActor *i);
|
||||
int wakeup(int sn, int pn);
|
||||
int wakeup(DDukeActor* sn, int pn);
|
||||
|
||||
|
||||
int timedexit(int snum);
|
||||
void dokneeattack(int snum, int pi, const std::initializer_list<int>& respawnlist);
|
||||
void dokneeattack(int snum, const std::initializer_list<int>& respawnlist);
|
||||
int endoflevel(int snum);
|
||||
void playerisdead(int snum, int psectlotag, int fz, int cz);
|
||||
void footprints(int snum);
|
||||
|
@ -122,31 +128,28 @@ void playerAimUp(int snum, ESyncBits actions);
|
|||
void playerAimDown(int snum, ESyncBits actions);
|
||||
bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, int ang, fixed_t q16horiz, double smoothratio);
|
||||
void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n);
|
||||
int hits(int i);
|
||||
int hitasprite(int i, short* hitsp);
|
||||
int aim(spritetype* s, int aang);
|
||||
DDukeActor* aim(DDukeActor* s, int aang);
|
||||
void checkweapons(struct player_struct* const p);
|
||||
int findotherplayer(int p, int* d);
|
||||
void quickkill(struct player_struct* p);
|
||||
void setpal(struct player_struct* p);
|
||||
int setpal(struct player_struct* p);
|
||||
int madenoise(int playerNum);
|
||||
int haskey(int sect, int snum);
|
||||
void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST);
|
||||
void shootbloodsplat(DDukeActor* i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST);
|
||||
|
||||
void breakwall(short newpn, short spr, short dawallnum);
|
||||
void callsound2(int soundNum, int playerNum);
|
||||
int callsound(int sectnum,int snum);
|
||||
int hitasprite(int snum,short *hitSprite);
|
||||
int findplayer(const spritetype* s, int* dist);
|
||||
void breakwall(short newpn, DDukeActor* spr, short dawallnum);
|
||||
int callsound(int sectnum,DDukeActor* snum);
|
||||
int hitasprite(DDukeActor* snum,DDukeActor **hitSprite);
|
||||
int findplayer(const DDukeActor* s, int* dist);
|
||||
void operatejaildoors(int hitag);
|
||||
void allignwarpelevators(void);
|
||||
bool isablockdoor(int tileNum);
|
||||
bool activatewarpelevators(int s, int w);
|
||||
bool activatewarpelevators(DDukeActor* s, int w);
|
||||
int check_activator_motion(int lotag);
|
||||
void operateactivators(int l, int w);
|
||||
void operateforcefields_common(int s, int low, const std::initializer_list<int>& tiles);
|
||||
void operateforcefields_common(DDukeActor* s, int low, const std::initializer_list<int>& tiles);
|
||||
void operatemasterswitches(int lotag);
|
||||
void operatesectors(int s, int i);
|
||||
void operatesectors(int s, DDukeActor* i);
|
||||
void hud_input(int playerNum);
|
||||
int getanimationgoal(int animtype, int animindex);
|
||||
bool isanearoperator(int lotag);
|
||||
|
@ -155,41 +158,43 @@ int setanimation(short animsect, int animtype, int animindex, int thegoal, int t
|
|||
void dofurniture(int wallNum, int sectnum, int playerNum);
|
||||
void dotorch();
|
||||
int hitawall(struct player_struct* pl, int* hitWall);
|
||||
int hits(int snum);
|
||||
int hits(DDukeActor* snum);
|
||||
|
||||
void clearsectinterpolate(int sprnum);
|
||||
void setsectinterpolate(int sprnum);
|
||||
int LocateTheLocator(int const tag, int const sectnum);
|
||||
void setsectinterpolate(int sectnum);
|
||||
DDukeActor* LocateTheLocator(int n, int sectnum);
|
||||
void clearcamera(player_struct* ps);
|
||||
|
||||
void showtwoscreens(const CompletionFunc& func);
|
||||
void doorders(const CompletionFunc& func);
|
||||
|
||||
void LoadActor(int i, int p, int x);
|
||||
void execute(int s, int p, int d);
|
||||
void makeitfall(int s);
|
||||
int furthestangle(int snum, int angDiv);
|
||||
void getglobalz(int s);
|
||||
void OnEvent(int id, int pnum = -1, int snum = -1, int dist = -1);
|
||||
void LoadActor(DDukeActor* i, int p, int x);
|
||||
void execute(DDukeActor* s, int p, int d);
|
||||
void makeitfall(DDukeActor* s);
|
||||
int furthestangle(DDukeActor* snum, int angDiv);
|
||||
void getglobalz(DDukeActor* s);
|
||||
void OnEvent(int id, int pnum = -1, DDukeActor* snum = nullptr, int dist = -1);
|
||||
|
||||
short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, short s_ow, signed char s_ss);
|
||||
void ceilingglass(int snum, int sectnum, int cnt);
|
||||
void spriteglass(int snum, int cnt);
|
||||
void lotsofcolourglass(int snum, int wallNum, int cnt);
|
||||
void lotsofglass(int snum, int wallnum, int cnt);
|
||||
DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, DDukeActor* s_ow, signed char s_ss);
|
||||
void ceilingglass(DDukeActor* snum, int sectnum, int cnt);
|
||||
void spriteglass(DDukeActor* snum, int cnt);
|
||||
void lotsofcolourglass(DDukeActor* snum, int wallNum, int cnt);
|
||||
void lotsofglass(DDukeActor* snum, int wallnum, int cnt);
|
||||
void checkplayerhurt_d(struct player_struct* p, const Collision& coll);
|
||||
void checkplayerhurt_r(struct player_struct* p, const Collision& coll);
|
||||
|
||||
void addspritetodelete(int spnum);
|
||||
void addspritetodelete(int spnum=0);
|
||||
void checkavailinven(struct player_struct* p);
|
||||
int initspriteforspawn(int j, int pn, const std::initializer_list<int> &excludes);
|
||||
void spawninitdefault(int j, int i);
|
||||
void spawntransporter(int j, int i, bool beam);
|
||||
int spawnbloodpoolpart1(int j, int i);
|
||||
void initfootprint(int j, int i);
|
||||
void initshell(int j, int i, bool isshell);
|
||||
void initcrane(int j, int i, int CRANEPOLE);
|
||||
void initwaterdrip(int j, int i);
|
||||
int initreactor(int j, int i, bool isrecon);
|
||||
void spawneffector(int i);
|
||||
int initspriteforspawn(DDukeActor* j, int pn, const std::initializer_list<int> &excludes);
|
||||
void spawninitdefault(DDukeActor* actj, DDukeActor* act);
|
||||
void spawntransporter(DDukeActor* actj, DDukeActor* acti, bool beam);
|
||||
int spawnbloodpoolpart1(DDukeActor* actj, DDukeActor* acti);
|
||||
void initfootprint(DDukeActor* actj, DDukeActor* acti);
|
||||
void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell);
|
||||
void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE);
|
||||
void initwaterdrip(DDukeActor* actj, DDukeActor* acti);
|
||||
int initreactor(DDukeActor* actj, DDukeActor* acti, bool isrecon);
|
||||
void spawneffector(DDukeActor* actor);
|
||||
void gameexitfrommenu();
|
||||
int startrts(int lumpNum, int localPlayer);
|
||||
|
||||
|
@ -203,12 +208,12 @@ void cacheit_d();
|
|||
void cacheit_r();
|
||||
|
||||
void FTA(int q, struct player_struct* p);
|
||||
void OnMotorcycle(player_struct *pl, int snum);
|
||||
void OnMotorcycle(player_struct *pl, DDukeActor* snum);
|
||||
void OffMotorcycle(player_struct *pl);
|
||||
void OnBoat(player_struct *pl, int snum);
|
||||
void OnBoat(player_struct *pl, DDukeActor* snum);
|
||||
void OffBoat(player_struct *pl);
|
||||
|
||||
void cameratext(int i);
|
||||
void cameratext(DDukeActor* i);
|
||||
void dobonus(int bonusonly, const CompletionFunc& completion);
|
||||
void dobonus_d(int bonusonly, const CompletionFunc& completion);
|
||||
void dobonus_r(int bonusonly, const CompletionFunc& completion);
|
||||
|
|
|
@ -291,7 +291,7 @@ void GameInterface::app_init()
|
|||
ud.multimode = 1;
|
||||
ud.m_monsters_off = userConfig.nomonsters;
|
||||
ps[0].aim_mode = 1;
|
||||
ud.camerasprite = -1;
|
||||
ud.cameraactor = nullptr;
|
||||
|
||||
if (fileSystem.FileExists("DUKESW.BIN"))
|
||||
g_gameType |= GAMEFLAG_SHAREWARE;
|
||||
|
@ -325,7 +325,6 @@ void GameInterface::app_init()
|
|||
registerosdcommands();
|
||||
|
||||
screenpeek = myconnectindex;
|
||||
ps[myconnectindex].palette = BASEPAL;
|
||||
|
||||
for (int j = numplayers; j < ud.multimode; j++)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
|||
#include "sbar.h"
|
||||
#include "glbackend/glbackend.h"
|
||||
#include "gamestate.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -248,12 +249,12 @@ void drawoverlays(double smoothratio)
|
|||
|
||||
MarkSectorSeen(pp->cursectnum);
|
||||
|
||||
if (ud.camerasprite == -1)
|
||||
if (ud.cameraactor == nullptr)
|
||||
{
|
||||
if (automapMode != am_full)
|
||||
{
|
||||
if (!isRR() && pp->newowner >= 0)
|
||||
cameratext(pp->newowner);
|
||||
if (!isRR() && pp->newOwner != nullptr)
|
||||
cameratext(pp->newOwner);
|
||||
else
|
||||
{
|
||||
fi.displayweapon(screenpeek, smoothratio);
|
||||
|
@ -268,7 +269,7 @@ void drawoverlays(double smoothratio)
|
|||
{
|
||||
dointerpolations(smoothratio);
|
||||
|
||||
if (pp->newowner == -1 && playrunning())
|
||||
if (pp->newOwner == nullptr && playrunning())
|
||||
{
|
||||
if (screenpeek == myconnectindex && numplayers > 1)
|
||||
{
|
||||
|
@ -298,7 +299,7 @@ void drawoverlays(double smoothratio)
|
|||
|
||||
StatusBar->UpdateStatusBar();
|
||||
|
||||
if (ps[myconnectindex].newowner == -1 && ud.camerasprite == -1)
|
||||
if (ps[myconnectindex].newOwner == nullptr && ud.cameraactor == nullptr)
|
||||
{
|
||||
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -getHalfLookAng(pp->angle.olook_ang.asq16(), pp->angle.look_ang.asq16(), cl_syncinput, smoothratio), pp->over_shoulder_on ? 2.5 : 0, isRR() ? 0.5 : 1);
|
||||
}
|
||||
|
@ -316,14 +317,14 @@ void drawoverlays(double smoothratio)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void cameratext(int i)
|
||||
void cameratext(DDukeActor *cam)
|
||||
{
|
||||
auto drawitem = [=](int tile, double x, double y, bool flipx, bool flipy)
|
||||
{
|
||||
DrawTexture(twod, tileGetTexture(tile), x, y, DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y, DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_CenterOffsetRel, true,
|
||||
DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1, DTA_FlipX, flipx, DTA_FlipY, flipy, DTA_FullscreenScale, FSMode_Fit320x200, TAG_DONE);
|
||||
};
|
||||
if (!hittype[i].temp_data[0])
|
||||
if (!cam->temp_data[0])
|
||||
{
|
||||
drawitem(TILE_CAMCORNER, 24, 33, false, false);
|
||||
drawitem(TILE_CAMCORNER + 1, 320 - 26, 33, false, false);
|
||||
|
@ -416,16 +417,16 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
|
|||
yvect2 = mulscale16(yvect, yxaspect);
|
||||
|
||||
//Draw sprites
|
||||
k = ps[screenpeek].i;
|
||||
auto pactor = ps[screenpeek].GetActor();
|
||||
for (i = 0; i < numsectors; i++)
|
||||
{
|
||||
if (!gFullMap || !show2dsector[i]) continue;
|
||||
SectIterator it(i);
|
||||
while ((j = it.NextIndex()) >= 0)
|
||||
DukeSectIterator it(i);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
spr = &sprite[j];
|
||||
spr = &act->s;
|
||||
|
||||
if (j == k || (spr->cstat & 0x8000) || spr->cstat == 257 || spr->xrepeat == 0) continue;
|
||||
if (act == pactor || (spr->cstat & 0x8000) || spr->cstat == 257 || spr->xrepeat == 0) continue;
|
||||
|
||||
col = PalEntry(0, 170, 170);
|
||||
if (spr->cstat & 1) col = PalEntry(170, 0, 170);
|
||||
|
@ -563,9 +564,10 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
|
|||
|
||||
for (p = connecthead; p >= 0; p = connectpoint2[p])
|
||||
{
|
||||
ox = sprite[ps[p].i].x - cposx;
|
||||
oy = sprite[ps[p].i].y - cposy;
|
||||
daang = (sprite[ps[p].i].ang - cang) & 2047;
|
||||
auto pspr = &ps[p].GetActor()->s;
|
||||
ox = pspr->x - cposx;
|
||||
oy = pspr->y - cposy;
|
||||
daang = (pspr->ang - cang) & 2047;
|
||||
|
||||
x1 = mulscale(ox, xvect, 16) - mulscale(oy, yvect, 16);
|
||||
y1 = mulscale(oy, xvect2, 16) + mulscale(ox, yvect2, 16);
|
||||
|
@ -573,19 +575,19 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
|
|||
if (p == screenpeek || ud.coop == 1)
|
||||
{
|
||||
auto& pp = ps[p];
|
||||
if (sprite[pp.i].xvel > 16 && pp.on_ground)
|
||||
if (pspr->xvel > 16 && pp.on_ground)
|
||||
i = TILE_APLAYERTOP + ((ud.levelclock >> 4) & 3);
|
||||
else
|
||||
i = TILE_APLAYERTOP;
|
||||
|
||||
j = klabs(pp.truefz - pp.posz) >> 8;
|
||||
j = mulscale(czoom * (sprite[pp.i].yrepeat + j), yxaspect, 16);
|
||||
j = mulscale(czoom * (pspr->yrepeat + j), yxaspect, 16);
|
||||
|
||||
if (j < 22000) j = 22000;
|
||||
else if (j > (65536 << 1)) j = (65536 << 1);
|
||||
|
||||
DrawTexture(twod, tileGetTexture(i), xdim / 2. + x1 / 4096., ydim / 2. + y1 / 4096., DTA_TranslationIndex, TRANSLATION(Translation_Remap + pp.palette, sprite[pp.i].pal), DTA_CenterOffset, true,
|
||||
DTA_Rotate, daang * (-360./2048), DTA_Color, shadeToLight(sprite[pp.i].shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE);
|
||||
DrawTexture(twod, tileGetTexture(i), xdim / 2. + x1 / 4096., ydim / 2. + y1 / 4096., DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(&pp), pspr->pal), DTA_CenterOffset, true,
|
||||
DTA_Rotate, daang * (-360./2048), DTA_Color, shadeToLight(pspr->shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -66,7 +66,7 @@ void GameInterface::Ticker()
|
|||
{
|
||||
if (earthquaketime > 0) earthquaketime--;
|
||||
|
||||
ud.camerasprite = -1;
|
||||
ud.cameraactor = nullptr;
|
||||
everyothertime++;
|
||||
|
||||
global_random = krand();
|
||||
|
|
|
@ -278,7 +278,7 @@ void ResetGameVars(void)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int GetGameVarID(int id, int sActor, int sPlayer)
|
||||
int GetGameVarID(int id, DDukeActor* sActor, int sPlayer)
|
||||
{
|
||||
if(id<0 || id >= iGameVarCount)
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ int GetGameVarID(int id, int sActor, int sPlayer)
|
|||
}
|
||||
if (id == g_iThisActorID)
|
||||
{
|
||||
return sActor;
|
||||
return sActor->GetIndex();
|
||||
}
|
||||
if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER )
|
||||
{
|
||||
|
@ -304,9 +304,9 @@ int GetGameVarID(int id, int sActor, int sPlayer)
|
|||
else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR )
|
||||
{
|
||||
// for the current actor
|
||||
if(sActor >= 0 && sActor <=MAXSPRITES)
|
||||
if(sActor != nullptr)
|
||||
{
|
||||
return aGameVars[id].plArray[sActor];
|
||||
return aGameVars[id].plArray[sActor->GetIndex()];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -344,7 +344,7 @@ int GetGameVarID(int id, int sActor, int sPlayer)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void SetGameVarID(int id, int lValue, int sActor, int sPlayer)
|
||||
void SetGameVarID(int id, int lValue, DDukeActor* sActor, int sPlayer)
|
||||
{
|
||||
if(id<0 || id >= iGameVarCount)
|
||||
{
|
||||
|
@ -360,7 +360,7 @@ void SetGameVarID(int id, int lValue, int sActor, int sPlayer)
|
|||
else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR )
|
||||
{
|
||||
// for the current actor
|
||||
if (sActor >= 0) aGameVars[id].plArray[sActor]=lValue;
|
||||
if (sActor != nullptr) aGameVars[id].plArray[sActor->GetIndex()]=lValue;
|
||||
else for (auto& i : aGameVars[id].plArray) i = lValue; // -1 sets all actors - was undefined OOB access in WW2GI.
|
||||
}
|
||||
else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PLONG )
|
||||
|
@ -381,7 +381,7 @@ void SetGameVarID(int id, int lValue, int sActor, int sPlayer)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int GetGameVar(const char *szGameLabel, int lDefault, int sActor, int sPlayer)
|
||||
int GetGameVar(const char *szGameLabel, int lDefault, DDukeActor* sActor, int sPlayer)
|
||||
{
|
||||
for (int i = 0; i < iGameVarCount; i++)
|
||||
{
|
||||
|
@ -1171,49 +1171,49 @@ void ResetSystemDefaults(void)
|
|||
for(i=0;i<12/*MAX_WEAPONS*/;i++)
|
||||
{
|
||||
sprintf(aszBuf,"WEAPON%d_CLIP",i);
|
||||
aplWeaponClip[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponClip[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_RELOAD",i);
|
||||
aplWeaponReload[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponReload[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_FIREDELAY",i);
|
||||
aplWeaponFireDelay[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponFireDelay[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_TOTALTIME",i);
|
||||
aplWeaponTotalTime[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponTotalTime[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_HOLDDELAY",i);
|
||||
aplWeaponHoldDelay[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponHoldDelay[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_FLAGS",i);
|
||||
aplWeaponFlags[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponFlags[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_SHOOTS",i);
|
||||
aplWeaponShoots[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponShoots[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_SPAWNTIME",i);
|
||||
aplWeaponSpawnTime[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponSpawnTime[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_SPAWN",i);
|
||||
aplWeaponSpawn[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponSpawn[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",i);
|
||||
aplWeaponShotsPerBurst[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponShotsPerBurst[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_WORKSLIKE",i);
|
||||
aplWeaponWorksLike[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponWorksLike[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_INITIALSOUND",i);
|
||||
aplWeaponInitialSound[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponInitialSound[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_FIRESOUND",i);
|
||||
aplWeaponFireSound[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponFireSound[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_SOUND2TIME",i);
|
||||
aplWeaponSound2Time[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponSound2Time[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
sprintf(aszBuf,"WEAPON%d_SOUND2SOUND",i);
|
||||
aplWeaponSound2Sound[i][j]=GetGameVar(aszBuf,0, -1, j);
|
||||
aplWeaponSound2Sound[i][j]=GetGameVar(aszBuf,0, nullptr, j);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,9 +124,11 @@ int GetDefID(const char *szGameLabel);
|
|||
void ClearGameVars(void);
|
||||
void AddSystemVars();
|
||||
void ResetGameVars(void);
|
||||
int GetGameVarID(int id, int sActor, int sPlayer);
|
||||
void SetGameVarID(int id, int lValue, int sActor, int sPlayer);
|
||||
int GetGameVar(const char* szGameLabel, int lDefault, int sActor, int sPlayer);
|
||||
struct weaponhit;
|
||||
using DDukeActor = weaponhit;
|
||||
int GetGameVarID(int id, DDukeActor* sActor, int sPlayer);
|
||||
void SetGameVarID(int id, int lValue, DDukeActor* sActor, int sPlayer);
|
||||
int GetGameVar(const char* szGameLabel, int lDefault, DDukeActor* sActor, int sPlayer);
|
||||
|
||||
void ClearGameEvents();
|
||||
bool IsGameEvent(int i);
|
||||
|
|
|
@ -84,7 +84,7 @@ animwalltype animwall[MAXANIMWALLS];
|
|||
int numanimwalls;
|
||||
int animatecnt;
|
||||
int numclouds;
|
||||
int camsprite;
|
||||
DDukeActor* camsprite;
|
||||
int numcyclers;
|
||||
int earthquaketime;
|
||||
int freezerhurtowner;
|
||||
|
@ -135,7 +135,8 @@ unsigned ambientfx;
|
|||
int msx[MAXANIMPOINTS], msy[MAXANIMPOINTS];
|
||||
int WindTime, WindDir;
|
||||
short fakebubba_spawn, mamaspawn_count, banjosound;
|
||||
short BellTime, BellSprite /* word_119BE0*/;
|
||||
short BellTime;
|
||||
DDukeActor* BellSprite /* word_119BE0*/;
|
||||
uint8_t enemysizecheat /*raat607*/, ufospawnsminion, pistonsound, chickenphase /* raat605*/, RRRA_ExitedLevel, fogactive;
|
||||
uint32_t everyothertime;
|
||||
player_orig po[MAXPLAYERS];
|
||||
|
|
|
@ -70,7 +70,7 @@ extern animwalltype animwall[MAXANIMWALLS];
|
|||
extern int numanimwalls;
|
||||
extern int animatecnt;
|
||||
extern int numclouds;
|
||||
extern int camsprite;
|
||||
extern DDukeActor* camsprite;
|
||||
extern int numcyclers;
|
||||
extern int earthquaketime;
|
||||
extern int freezerhurtowner;
|
||||
|
@ -127,7 +127,8 @@ extern unsigned ambientfx;
|
|||
extern int msx[MAXANIMPOINTS], msy[MAXANIMPOINTS];
|
||||
extern int WindTime, WindDir;
|
||||
extern short fakebubba_spawn, mamaspawn_count, banjosound;
|
||||
extern short BellTime, BellSprite /* word_119BE0*/;
|
||||
extern short BellTime;
|
||||
extern DDukeActor* BellSprite /* word_119BE0*/;
|
||||
extern uint8_t enemysizecheat /*raat607*/, ufospawnsminion, pistonsound, chickenphase /* raat605*/, RRRA_ExitedLevel, fogactive;
|
||||
extern uint32_t everyothertime;
|
||||
extern player_orig po[MAXPLAYERS];
|
||||
|
|
|
@ -35,6 +35,7 @@ source as it is released.
|
|||
#include "ns.h"
|
||||
#include "global.h"
|
||||
#include "names_d.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -105,7 +106,7 @@ int animatefist(int gs, int snum, double look_anghalf)
|
|||
fistzoom = 40290;
|
||||
fistz = 194 + (calcSinTableValue(((6 + fisti) << 7) & 2047) / 512.);
|
||||
|
||||
if (sprite[ps[snum].i].pal == 1)
|
||||
if (ps[snum].GetActor()->s.pal == 1)
|
||||
fistpal = 1;
|
||||
else
|
||||
fistpal = sector[ps[snum].cursectnum].floorpal;
|
||||
|
@ -130,13 +131,13 @@ int animateknee(int gs, int snum, double hard_landing, double look_anghalf, doub
|
|||
short pal;
|
||||
double looking_arc;
|
||||
|
||||
if (ps[snum].knee_incs > 11 || ps[snum].knee_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0;
|
||||
if (ps[snum].knee_incs > 11 || ps[snum].knee_incs == 0 || ps[snum].GetActor()->s.extra <= 0) return 0;
|
||||
|
||||
looking_arc = knee_y[ps[snum].knee_incs] + (fabs(look_anghalf) / 4.5);
|
||||
|
||||
looking_arc -= hard_landing * 8.;
|
||||
|
||||
if (sprite[ps[snum].i].pal == 1)
|
||||
if (ps[snum].GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
{
|
||||
|
@ -162,13 +163,13 @@ int animateknuckles(int gs, int snum, double hard_landing, double look_anghalf,
|
|||
short pal;
|
||||
double looking_arc;
|
||||
|
||||
if (isWW2GI() || ps[snum].over_shoulder_on != 0 || ps[snum].knuckle_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0;
|
||||
if (isWW2GI() || ps[snum].over_shoulder_on != 0 || ps[snum].knuckle_incs == 0 || ps[snum].GetActor()->s.extra <= 0) return 0;
|
||||
|
||||
looking_arc = fabs(look_anghalf) / 4.5;
|
||||
|
||||
looking_arc -= hard_landing * 8.;
|
||||
|
||||
if (sprite[ps[snum].i].pal == 1)
|
||||
if (ps[snum].GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[ps[snum].cursectnum].floorpal;
|
||||
|
@ -189,7 +190,7 @@ void displaymasks_d(int snum, double)
|
|||
{
|
||||
int p;
|
||||
|
||||
if (sprite[ps[snum].i].pal == 1)
|
||||
if (ps[snum].GetActor()->s.pal == 1)
|
||||
p = 1;
|
||||
else
|
||||
p = sector[ps[snum].cursectnum].floorpal;
|
||||
|
@ -218,16 +219,11 @@ static int animatetip(int gs, int snum, double hard_landing, double look_anghalf
|
|||
looking_arc = fabs(look_anghalf) / 4.5;
|
||||
looking_arc -= hard_landing * 8.;
|
||||
|
||||
if (sprite[ps[snum].i].pal == 1)
|
||||
if (ps[snum].GetActor()->s.pal == 1)
|
||||
p = 1;
|
||||
else
|
||||
p = sector[ps[snum].cursectnum].floorpal;
|
||||
|
||||
/* if(ps[snum].access_spritenum >= 0)
|
||||
p = sprite[ps[snum].access_spritenum].pal;
|
||||
else
|
||||
p = wall[ps[snum].access_wallnum].pal;
|
||||
*/
|
||||
hud_drawpal(170 + (getavel(snum) / 16.) - look_anghalf,
|
||||
(tip_y[ps[snum].tipincs] >> 1) + looking_arc + 240 - horiz16th, TIP + ((26 - ps[snum].tipincs) >> 4), gs, 0, p);
|
||||
|
||||
|
@ -246,16 +242,14 @@ int animateaccess(int gs,int snum,double hard_landing,double look_anghalf,double
|
|||
double looking_arc;
|
||||
char p;
|
||||
|
||||
if(ps[snum].access_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0;
|
||||
if(ps[snum].access_incs == 0 || ps[snum].GetActor()->s.extra <= 0) return 0;
|
||||
|
||||
looking_arc = access_y[ps[snum].access_incs] + (fabs(look_anghalf) / 4.5);
|
||||
looking_arc -= hard_landing * 8.;
|
||||
|
||||
if(ps[snum].access_spritenum >= 0)
|
||||
p = sprite[ps[snum].access_spritenum].pal;
|
||||
if(ps[snum].access_spritenum != nullptr)
|
||||
p = ps[snum].access_spritenum->s.pal;
|
||||
else p = 0;
|
||||
// else
|
||||
// p = wall[ps[snum].access_wallnum].pal;
|
||||
|
||||
if((ps[snum].access_incs-3) > 0 && (ps[snum].access_incs-3)>>3)
|
||||
hud_drawpal(170+(getavel(snum)/16.)-look_anghalf+(access_y[ps[snum].access_incs]>>2),looking_arc+266-horiz16th,HANDHOLDINGLASER+(ps[snum].access_incs>>3),gs,0,p);
|
||||
|
@ -294,10 +288,10 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
random_club_frame = p->orandom_club_frame + fmulscale16(p->random_club_frame - p->orandom_club_frame, smoothratio);
|
||||
hard_landing = p->ohard_landing + fmulscale16(p->hard_landing - p->ohard_landing, smoothratio);
|
||||
|
||||
gs = sprite[p->i].shade;
|
||||
gs = p->GetActor()->s.shade;
|
||||
if(gs > 24) gs = 24;
|
||||
|
||||
bool playerVars = p->newowner >= 0 || ud.camerasprite >= 0 || p->over_shoulder_on > 0 || (sprite[p->i].pal != 1 && sprite[p->i].extra <= 0);
|
||||
bool playerVars = p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0);
|
||||
bool playerAnims = animatefist(gs,snum,look_anghalf) || animateknuckles(gs,snum,hard_landing,look_anghalf,horiz16th) ||
|
||||
animatetip(gs,snum,hard_landing,look_anghalf,horiz16th) || animateaccess(gs,snum,hard_landing,look_anghalf,horiz16th);
|
||||
|
||||
|
@ -313,7 +307,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
weapon_xoffset = (160)-90;
|
||||
weapon_xoffset -= calcSinTableValue((weapon_sway / 2.) + 512) / (1024. + 512.);
|
||||
weapon_xoffset -= 58 + p->weapon_ang;
|
||||
if( sprite[p->i].xrepeat < 32 )
|
||||
if( p->GetActor()->s.xrepeat < 32 )
|
||||
gun_pos -= fabs(calcSinTableValue(weapon_sway * 4.) / 512.);
|
||||
else gun_pos -= fabs(calcSinTableValue(weapon_sway / 2.) / 1024.);
|
||||
|
||||
|
@ -344,7 +338,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
j = 14-p->quick_kick;
|
||||
if (j != 14 || p->last_quick_kick)
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
{
|
||||
|
@ -364,13 +358,13 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
}
|
||||
}
|
||||
|
||||
if (sprite[p->i].xrepeat < 40)
|
||||
if (p->GetActor()->s.xrepeat < 40)
|
||||
{
|
||||
static int fistsign;
|
||||
//shrunken..
|
||||
if (p->jetpack_on == 0)
|
||||
{
|
||||
i = sprite[p->i].xvel;
|
||||
i = p->GetActor()->s.xvel;
|
||||
looking_arc += 32 - (i >> 1);
|
||||
fistsign += i >> 1;
|
||||
}
|
||||
|
@ -398,7 +392,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
{
|
||||
if (*kb > 0)
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
{
|
||||
|
@ -429,7 +423,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
auto displaytripbomb = [&]()
|
||||
{
|
||||
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -462,7 +456,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
//pin = (isWorldTour() || (duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R;
|
||||
auto rpgpic = /*isWorldTour() ? RPGGUNWIDE :*/ RPGGUN;
|
||||
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else pal = sector[p->cursectnum].floorpal;
|
||||
|
||||
|
@ -510,7 +504,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
auto displayshotgun_ww = [&]()
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -521,7 +515,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
gun_pos -= calcSinTableValue(kickback_pic * 128.) / 4096.;
|
||||
}
|
||||
|
||||
if (*kb > 0 && sprite[p->i].pal != 1)
|
||||
if (*kb > 0 && p->GetActor()->s.pal != 1)
|
||||
{
|
||||
weapon_xoffset += 1 - (rand() & 3);
|
||||
}
|
||||
|
@ -572,7 +566,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
auto displayshotgun = [&]()
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -657,7 +651,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
auto displaychaingun_ww = [&]()
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -665,7 +659,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
if (*kb > 0)
|
||||
gun_pos -= calcSinTableValue(kickback_pic * 128.) / 4096.;
|
||||
|
||||
if (*kb > 0 && sprite[p->i].pal != 1) weapon_xoffset += 1 - (rand() & 3);
|
||||
if (*kb > 0 && p->GetActor()->s.pal != 1) weapon_xoffset += 1 - (rand() & 3);
|
||||
|
||||
if (*kb == 0)
|
||||
{
|
||||
|
@ -770,7 +764,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
auto displaychaingun = [&]
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -778,7 +772,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
if (*kb > 0)
|
||||
gun_pos -= calcSinTableValue(kickback_pic * 128.) / 4096.;
|
||||
|
||||
if (*kb > 0 && sprite[p->i].pal != 1) weapon_xoffset += 1 - (rand() & 3);
|
||||
if (*kb > 0 && p->GetActor()->s.pal != 1) weapon_xoffset += 1 - (rand() & 3);
|
||||
|
||||
hud_drawpal(weapon_xoffset + 168 - look_anghalf, looking_arc + 260 - gun_pos, CHAINGUN, gs, o, pal);
|
||||
switch(*kb)
|
||||
|
@ -790,9 +784,9 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
if (*kb > 4 && *kb < 12)
|
||||
{
|
||||
i = 0;
|
||||
if (sprite[p->i].pal != 1) i = rand() & 7;
|
||||
if (p->GetActor()->s.pal != 1) i = rand() & 7;
|
||||
hud_drawpal(i + weapon_xoffset - 4 + 140 - look_anghalf,i + looking_arc - (kickback_pic / 2.) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),gs,o,pal);
|
||||
if (sprite[p->i].pal != 1) i = rand() & 7;
|
||||
if (p->GetActor()->s.pal != 1) i = rand() & 7;
|
||||
hud_drawpal(i + weapon_xoffset - 4 + 184 - look_anghalf,i + looking_arc - (kickback_pic / 2.) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),gs,o,pal);
|
||||
}
|
||||
if (*kb < 8)
|
||||
|
@ -814,7 +808,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
auto displaypistol = [&]()
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -877,7 +871,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
auto displayhandbomb = [&]()
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -937,7 +931,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
auto displayhandremote = [&]()
|
||||
{
|
||||
signed char remote_frames[] = { 0,1,1,2,1,1,0,0,0,0,0 };
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -958,7 +952,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
auto displaydevastator_ww = [&]
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -1019,7 +1013,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
auto displaydevastator = [&]
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -1059,7 +1053,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
//pin = (isWW2GI() || isWorldTour() || (duke3d_globalflags & DUKE3D_NO_WIDESCREEN_PINNING)) ? 0 : RS_ALIGN_R;
|
||||
auto pic = /*isWorldTour() ? FREEZEWIDE :*/ FREEZE;
|
||||
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -1068,7 +1062,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
{
|
||||
char cat_frames[] = { 0,0,1,1,2,2 };
|
||||
|
||||
if (sprite[p->i].pal != 1)
|
||||
if (p->GetActor()->s.pal != 1)
|
||||
{
|
||||
weapon_xoffset += rand() & 3;
|
||||
looking_arc += rand() & 3;
|
||||
|
@ -1090,7 +1084,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
{
|
||||
weapon_xoffset += 28;
|
||||
looking_arc += 18;
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -1121,7 +1115,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
else
|
||||
{
|
||||
// the 'active' display.
|
||||
if (sprite[p->i].pal != 1)
|
||||
if (p->GetActor()->s.pal != 1)
|
||||
{
|
||||
weapon_xoffset += rand() & 3;
|
||||
gun_pos += (rand() & 3);
|
||||
|
@ -1183,7 +1177,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
{
|
||||
weapon_xoffset += 28;
|
||||
looking_arc += 18;
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -1196,7 +1190,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (sprite[p->i].pal != 1)
|
||||
if (p->GetActor()->s.pal != 1)
|
||||
{
|
||||
weapon_xoffset += rand() & 3;
|
||||
gun_pos += (rand() & 3);
|
||||
|
@ -1259,7 +1253,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
auto shrinker = /*isWorldTour() ? SHRINKERWIDE :*/ SHRINKER;
|
||||
weapon_xoffset += 28;
|
||||
looking_arc += 18;
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -1288,7 +1282,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (sprite[p->i].pal != 1)
|
||||
if (p->GetActor()->s.pal != 1)
|
||||
{
|
||||
weapon_xoffset += rand() & 3;
|
||||
gun_pos += (rand() & 3);
|
||||
|
@ -1324,7 +1318,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
|
||||
auto displayflamethrower = [&]()
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
{
|
||||
|
@ -1342,7 +1336,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
else
|
||||
{
|
||||
static const uint8_t cat_frames[] = { 0, 0, 1, 1, 2, 2 };
|
||||
if (sprite[p->i].pal != 1)
|
||||
if (p->GetActor()->s.pal != 1)
|
||||
{
|
||||
weapon_xoffset += krand() & 1;
|
||||
looking_arc += krand() & 1;
|
||||
|
|
|
@ -29,6 +29,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
#include "ns.h"
|
||||
#include "global.h"
|
||||
#include "names_r.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -68,7 +69,7 @@ void displaymasks_r(int snum, double smoothratio)
|
|||
{
|
||||
short p;
|
||||
|
||||
if (sprite[ps[snum].i].pal == 1)
|
||||
if (ps[snum].GetActor()->s.pal == 1)
|
||||
p = 1;
|
||||
else
|
||||
p = sector[ps[snum].cursectnum].floorpal;
|
||||
|
@ -132,10 +133,10 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
if (shadedsector[p->cursectnum] == 1)
|
||||
gs = 16;
|
||||
else
|
||||
gs = sprite[p->i].shade;
|
||||
gs = p->GetActor()->s.shade;
|
||||
if(gs > 24) gs = 24;
|
||||
|
||||
if(p->newowner >= 0 || ud.camerasprite >= 0 || p->over_shoulder_on > 0 || (sprite[p->i].pal != 1 && sprite[p->i].extra <= 0))
|
||||
if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0))
|
||||
return;
|
||||
|
||||
int opos = p->oweapon_pos * p->oweapon_pos;
|
||||
|
@ -145,7 +146,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
weapon_xoffset = (160)-90;
|
||||
weapon_xoffset -= calcSinTableValue((weapon_sway / 2.) + 512) / (1024. + 512.);
|
||||
weapon_xoffset -= 58 + p->weapon_ang;
|
||||
if( sprite[p->i].xrepeat < 8 )
|
||||
if( p->GetActor()->s.xrepeat < 8 )
|
||||
gun_pos -= fabs(calcSinTableValue(weapon_sway * 4.) / 512.);
|
||||
else gun_pos -= fabs(calcSinTableValue(weapon_sway / 2.) / 1024.);
|
||||
|
||||
|
@ -158,7 +159,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
j = 14-p->quick_kick;
|
||||
if(j != 14)
|
||||
{
|
||||
if(sprite[p->i].pal == 1)
|
||||
if(p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = p->palookup;
|
||||
|
@ -213,7 +214,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
else
|
||||
temp_kb = MOTOHIT;
|
||||
}
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -280,7 +281,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
temp_kb = BOATHIT;
|
||||
}
|
||||
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -300,12 +301,12 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
return;
|
||||
}
|
||||
|
||||
if( sprite[p->i].xrepeat < 8 )
|
||||
if( p->GetActor()->s.xrepeat < 8 )
|
||||
{
|
||||
static int fistsign;
|
||||
if(p->jetpack_on == 0 )
|
||||
{
|
||||
i = sprite[p->i].xvel;
|
||||
i = p->GetActor()->s.xvel;
|
||||
looking_arc += 32-(i>>1);
|
||||
fistsign += i>>1;
|
||||
}
|
||||
|
@ -324,7 +325,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
{
|
||||
int pin = 0;
|
||||
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -480,7 +481,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
}
|
||||
else if ((krand() & 15) == 5)
|
||||
{
|
||||
S_PlayActorSound(327, p->i);
|
||||
S_PlayActorSound(327, p->GetActor());
|
||||
rdmyospal((weapon_xoffset + 210) - look_anghalf,
|
||||
looking_arc + 222 - gun_pos, RPGGUN2 + 7, gs, o | pin, pal);
|
||||
chickenphase = 6;
|
||||
|
@ -509,7 +510,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
{
|
||||
weapon_xoffset -= 8;
|
||||
|
||||
if (sprite[p->i].pal == 1)
|
||||
if (p->GetActor()->s.pal == 1)
|
||||
pal = 1;
|
||||
else
|
||||
pal = sector[p->cursectnum].floorpal;
|
||||
|
@ -624,7 +625,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
if (*kb > 0)
|
||||
gun_pos -= calcSinTableValue((*kb) << 7) / 4096.;
|
||||
|
||||
if (*kb > 0 && sprite[p->i].pal != 1) weapon_xoffset += 1 - (rand() & 3);
|
||||
if (*kb > 0 && p->GetActor()->s.pal != 1) weapon_xoffset += 1 - (rand() & 3);
|
||||
|
||||
switch (*kb)
|
||||
{
|
||||
|
@ -837,7 +838,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (sprite[p->i].pal != 1)
|
||||
if (p->GetActor()->s.pal != 1)
|
||||
{
|
||||
weapon_xoffset += rand() & 3;
|
||||
gun_pos += (rand() & 3);
|
||||
|
|
|
@ -37,14 +37,14 @@ inline int bossguy(spritetype const* const pSprite)
|
|||
return bossguypic(pSprite->picnum);
|
||||
}
|
||||
|
||||
inline int actorflag(int spritenum, int mask)
|
||||
inline int actorflag(DDukeActor * actor, int mask)
|
||||
{
|
||||
return (((actorinfo[sprite[spritenum].picnum].flags/* ^ hittype[spritenum].flags*/) & mask) != 0);
|
||||
return (((actorinfo[actor->s.picnum].flags) & mask) != 0);
|
||||
}
|
||||
|
||||
inline int actorfella(int spnum)
|
||||
inline int actorfella(DDukeActor* actor)
|
||||
{
|
||||
return actorflag(spnum, SFLAG_KILLCOUNT);
|
||||
return actorflag(actor, SFLAG_KILLCOUNT);
|
||||
}
|
||||
|
||||
inline void setflag(int flag, const std::initializer_list<short>& types)
|
||||
|
@ -68,16 +68,16 @@ inline void settileflag(int flag, const std::initializer_list<short>& types)
|
|||
}
|
||||
}
|
||||
|
||||
inline bool wallswitchcheck(int s)
|
||||
inline bool wallswitchcheck(DDukeActor* s)
|
||||
{
|
||||
return !!(tileinfo[sprite[s].picnum].flags & TFLAG_WALLSWITCH);
|
||||
return !!(tileinfo[s->s.picnum].flags & TFLAG_WALLSWITCH);
|
||||
}
|
||||
|
||||
inline int checkcursectnums(int se)
|
||||
{
|
||||
int i;
|
||||
for(i=connecthead;i>=0;i=connectpoint2[i])
|
||||
if((unsigned)ps[i].i < MAXSPRITES && sprite[ps[i].i].sectnum == se ) return i;
|
||||
if(ps[i].GetActor() && ps[i].GetActor()->s.sectnum == se ) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ static InputPacket loc; // input accumulation buffer.
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void hud_input(int snum)
|
||||
void hud_input(int plnum)
|
||||
{
|
||||
int i, k;
|
||||
uint8_t dainv;
|
||||
|
@ -63,10 +63,11 @@ void hud_input(int snum)
|
|||
short unk;
|
||||
|
||||
unk = 0;
|
||||
p = &ps[snum];
|
||||
p = &ps[plnum];
|
||||
auto pact = p->GetActor();
|
||||
|
||||
i = p->aim_mode;
|
||||
p->aim_mode = !PlayerInput(snum, SB_AIMMODE);
|
||||
p->aim_mode = !PlayerInput(plnum, SB_AIMMODE);
|
||||
if (p->aim_mode < i)
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
|
||||
|
@ -75,39 +76,39 @@ void hud_input(int snum)
|
|||
|
||||
if (isRR())
|
||||
{
|
||||
if (PlayerInput(snum, SB_QUICK_KICK) && p->last_pissed_time == 0)
|
||||
if (PlayerInput(plnum, SB_QUICK_KICK) && p->last_pissed_time == 0)
|
||||
{
|
||||
if (!isRRRA() || sprite[p->i].extra > 0)
|
||||
if (!isRRRA() || p->GetActor()->s.extra > 0)
|
||||
{
|
||||
p->last_pissed_time = 4000;
|
||||
S_PlayActorSound(437, p->i);
|
||||
if (sprite[p->i].extra <= max_player_health - max_player_health / 10)
|
||||
S_PlayActorSound(437, pact);
|
||||
if (p->GetActor()->s.extra <= max_player_health - max_player_health / 10)
|
||||
{
|
||||
sprite[p->i].extra += 2;
|
||||
p->last_extra = sprite[p->i].extra;
|
||||
p->GetActor()->s.extra += 2;
|
||||
p->last_extra = p->GetActor()->s.extra;
|
||||
}
|
||||
else if (sprite[p->i].extra < max_player_health)
|
||||
sprite[p->i].extra = max_player_health;
|
||||
else if (p->GetActor()->s.extra < max_player_health)
|
||||
p->GetActor()->s.extra = max_player_health;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PlayerInput(snum, SB_QUICK_KICK) && p->quick_kick == 0 && (p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0))
|
||||
if (PlayerInput(plnum, SB_QUICK_KICK) && p->quick_kick == 0 && (p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_QUICKKICK, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
|
||||
OnEvent(EVENT_QUICKKICK, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0)
|
||||
{
|
||||
p->quick_kick = 14;
|
||||
if (!p->quick_kick_msg && snum == screenpeek) FTA(QUOTE_MIGHTY_FOOT, p);
|
||||
if (!p->quick_kick_msg && plnum == screenpeek) FTA(QUOTE_MIGHTY_FOOT, p);
|
||||
p->quick_kick_msg = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!PlayerInput(snum, SB_QUICK_KICK)) p->quick_kick_msg = false;
|
||||
if (!PlayerInput(plnum, SB_QUICK_KICK)) p->quick_kick_msg = false;
|
||||
|
||||
if (!PlayerInputBits(snum, SB_INTERFACE_BITS))
|
||||
if (!PlayerInputBits(plnum, SB_INTERFACE_BITS))
|
||||
p->interface_toggle_flag = 0;
|
||||
else if (p->interface_toggle_flag == 0)
|
||||
{
|
||||
|
@ -115,43 +116,42 @@ void hud_input(int snum)
|
|||
|
||||
// Don't go on if paused or dead.
|
||||
if (paused) return;
|
||||
if (sprite[p->i].extra <= 0) return;
|
||||
if (p->GetActor()->s.extra <= 0) return;
|
||||
|
||||
// Activate an inventory item. This just forwards to the other inventory bits. If the inventory selector was taken out of the playsim this could be removed.
|
||||
if (PlayerInput(snum, SB_INVUSE) && p->newowner == -1)
|
||||
if (PlayerInput(plnum, SB_INVUSE) && p->newOwner == nullptr)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_INVENTORY, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
|
||||
OnEvent(EVENT_INVENTORY, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0)
|
||||
{
|
||||
if (p->inven_icon > ICON_NONE && p->inven_icon <= ICON_HEATS) PlayerSetItemUsed(snum, p->inven_icon);
|
||||
if (p->inven_icon > ICON_NONE && p->inven_icon <= ICON_HEATS) PlayerSetItemUsed(plnum, p->inven_icon);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isRR() && PlayerUseItem(snum, ICON_HEATS))
|
||||
if (!isRR() && PlayerUseItem(plnum, ICON_HEATS))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_USENIGHTVISION, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0 && p->heat_amount > 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
|
||||
OnEvent(EVENT_USENIGHTVISION, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0 && p->heat_amount > 0)
|
||||
{
|
||||
p->heat_on = !p->heat_on;
|
||||
setpal(p);
|
||||
p->inven_icon = 5;
|
||||
S_PlayActorSound(NITEVISION_ONOFF, p->i);
|
||||
S_PlayActorSound(NITEVISION_ONOFF, pact);
|
||||
FTA(106 + (!p->heat_on), p);
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerUseItem(snum, ICON_STEROIDS))
|
||||
if (PlayerUseItem(plnum, ICON_STEROIDS))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_USESTEROIDS, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
|
||||
OnEvent(EVENT_USESTEROIDS, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0)
|
||||
{
|
||||
if (p->steroids_amount == 400)
|
||||
{
|
||||
p->steroids_amount--;
|
||||
S_PlayActorSound(DUKE_TAKEPILLS, p->i);
|
||||
S_PlayActorSound(DUKE_TAKEPILLS, pact);
|
||||
p->inven_icon = ICON_STEROIDS;
|
||||
FTA(12, p);
|
||||
}
|
||||
|
@ -159,11 +159,11 @@ void hud_input(int snum)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PlayerInput(snum, SB_INVPREV) || PlayerInput(snum, SB_INVNEXT))
|
||||
if (PlayerInput(plnum, SB_INVPREV) || PlayerInput(plnum, SB_INVNEXT))
|
||||
{
|
||||
p->invdisptime = 26 * 2;
|
||||
|
||||
if (PlayerInput(snum, SB_INVNEXT)) k = 1;
|
||||
if (PlayerInput(plnum, SB_INVNEXT)) k = 1;
|
||||
else k = 0;
|
||||
|
||||
dainv = p->inven_icon;
|
||||
|
@ -225,17 +225,17 @@ void hud_input(int snum)
|
|||
else dainv = 0;
|
||||
|
||||
// These events force us to keep the inventory selector in the playsim as opposed to the UI where it really belongs.
|
||||
if (PlayerInput(snum, SB_INVPREV))
|
||||
if (PlayerInput(plnum, SB_INVPREV))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, dainv, -1, snum);
|
||||
OnEvent(EVENT_INVENTORYLEFT, -1, snum, -1);
|
||||
dainv = GetGameVarID(g_iReturnVarID, -1, snum);
|
||||
SetGameVarID(g_iReturnVarID, dainv, nullptr, plnum);
|
||||
OnEvent(EVENT_INVENTORYLEFT, plnum, nullptr, -1);
|
||||
dainv = GetGameVarID(g_iReturnVarID, nullptr, plnum);
|
||||
}
|
||||
if (PlayerInput(snum, SB_INVNEXT))
|
||||
if (PlayerInput(plnum, SB_INVNEXT))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, dainv, -1, snum);
|
||||
OnEvent(EVENT_INVENTORYRIGHT, -1, snum, -1);
|
||||
dainv = GetGameVarID(g_iReturnVarID, -1, snum);
|
||||
SetGameVarID(g_iReturnVarID, dainv, nullptr, plnum);
|
||||
OnEvent(EVENT_INVENTORYRIGHT, plnum, nullptr, -1);
|
||||
dainv = GetGameVarID(g_iReturnVarID, nullptr, plnum);
|
||||
}
|
||||
p->inven_icon = dainv;
|
||||
// Someone must have really hated constant data, doing this with a switch/case (and of course also with literal numbers...)
|
||||
|
@ -243,14 +243,14 @@ void hud_input(int snum)
|
|||
if (dainv >= 1 && dainv < 8) FTA(invquotes[dainv - 1], p);
|
||||
}
|
||||
|
||||
int weap = PlayerNewWeapon(snum);
|
||||
int weap = PlayerNewWeapon(plnum);
|
||||
if (weap > 1 && p->kickback_pic > 0)
|
||||
p->wantweaponfire = weap - 1;
|
||||
|
||||
// Here we have to be extra careful that the weapons do not get mixed up, so let's keep the code for Duke and RR completely separate.
|
||||
fi.selectweapon(snum, weap);
|
||||
fi.selectweapon(plnum, weap);
|
||||
|
||||
if (PlayerInput(snum, SB_HOLSTER))
|
||||
if (PlayerInput(plnum, SB_HOLSTER))
|
||||
{
|
||||
if (p->curr_weapon > KNEE_WEAPON)
|
||||
{
|
||||
|
@ -269,11 +269,11 @@ void hud_input(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
if (PlayerUseItem(snum, ICON_HOLODUKE) && (isRR() || p->newowner == -1))
|
||||
if (PlayerUseItem(plnum, ICON_HOLODUKE) && (isRR() || p->newOwner == nullptr))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_HOLODUKEON, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
|
||||
OnEvent(EVENT_HOLODUKEON, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0)
|
||||
{
|
||||
if (!isRR())
|
||||
{
|
||||
|
@ -283,15 +283,15 @@ void hud_input(int snum)
|
|||
{
|
||||
p->inven_icon = 3;
|
||||
|
||||
i =
|
||||
auto pactor =
|
||||
EGS(p->cursectnum,
|
||||
p->posx,
|
||||
p->posy,
|
||||
p->posz + (30 << 8), TILE_APLAYER, -64, 0, 0, p->angle.ang.asbuild(), 0, 0, -1, 10);
|
||||
hittype[i].temp_data[3] = hittype[i].temp_data[4] = 0;
|
||||
p->holoduke_on = &hittype[i];
|
||||
sprite[i].yvel = snum;
|
||||
sprite[i].extra = 0;
|
||||
p->posz + (30 << 8), TILE_APLAYER, -64, 0, 0, p->angle.ang.asbuild(), 0, 0, nullptr, 10);
|
||||
pactor->temp_data[3] = pactor->temp_data[4] = 0;
|
||||
p->holoduke_on = pactor;
|
||||
pactor->s.yvel = plnum;
|
||||
pactor->s.extra = 0;
|
||||
FTA(QUOTE_HOLODUKE_ON, p);
|
||||
S_PlayActorSound(TELEPORTER, p->holoduke_on);
|
||||
}
|
||||
|
@ -307,82 +307,82 @@ void hud_input(int snum)
|
|||
}
|
||||
else // In RR this means drinking whiskey.
|
||||
{
|
||||
if (p->holoduke_amount > 0 && sprite[p->i].extra < max_player_health)
|
||||
if (p->holoduke_amount > 0 && p->GetActor()->s.extra < max_player_health)
|
||||
{
|
||||
p->holoduke_amount -= 400;
|
||||
sprite[p->i].extra += 5;
|
||||
if (sprite[p->i].extra > max_player_health)
|
||||
sprite[p->i].extra = max_player_health;
|
||||
p->GetActor()->s.extra += 5;
|
||||
if (p->GetActor()->s.extra > max_player_health)
|
||||
p->GetActor()->s.extra = max_player_health;
|
||||
|
||||
p->drink_amt += 5;
|
||||
p->inven_icon = 3;
|
||||
if (p->holoduke_amount == 0)
|
||||
checkavailinven(p);
|
||||
|
||||
if (p->drink_amt < 99 && !S_CheckActorSoundPlaying(p->i, 425))
|
||||
S_PlayActorSound(425, p->i);
|
||||
if (p->drink_amt < 99 && !S_CheckActorSoundPlaying(pact, 425))
|
||||
S_PlayActorSound(425, pact);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isRR() && PlayerUseItem(snum, ICON_HEATS) && p->newowner == -1)
|
||||
if (isRR() && PlayerUseItem(plnum, ICON_HEATS) && p->newOwner == nullptr)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_USENIGHTVISION, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
|
||||
OnEvent(EVENT_USENIGHTVISION, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0)
|
||||
{
|
||||
if (p->yehaa_timer == 0)
|
||||
{
|
||||
p->yehaa_timer = 126;
|
||||
S_PlayActorSound(390, p->i);
|
||||
S_PlayActorSound(390, pact);
|
||||
p->noise_radius = 16384;
|
||||
madenoise(snum);
|
||||
madenoise(plnum);
|
||||
if (sector[p->cursectnum].lotag == 857)
|
||||
{
|
||||
if (sprite[p->i].extra <= max_player_health)
|
||||
if (p->GetActor()->s.extra <= max_player_health)
|
||||
{
|
||||
sprite[p->i].extra += 10;
|
||||
if (sprite[p->i].extra >= max_player_health)
|
||||
sprite[p->i].extra = max_player_health;
|
||||
p->GetActor()->s.extra += 10;
|
||||
if (p->GetActor()->s.extra >= max_player_health)
|
||||
p->GetActor()->s.extra = max_player_health;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sprite[p->i].extra + 1 <= max_player_health)
|
||||
if (p->GetActor()->s.extra + 1 <= max_player_health)
|
||||
{
|
||||
sprite[p->i].extra++;
|
||||
p->GetActor()->s.extra++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerUseItem(snum, ICON_FIRSTAID))
|
||||
if (PlayerUseItem(plnum, ICON_FIRSTAID))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_USEMEDKIT, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
|
||||
OnEvent(EVENT_USEMEDKIT, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0)
|
||||
{
|
||||
if (p->firstaid_amount > 0 && sprite[p->i].extra < max_player_health)
|
||||
if (p->firstaid_amount > 0 && p->GetActor()->s.extra < max_player_health)
|
||||
{
|
||||
if (!isRR())
|
||||
{
|
||||
int j = max_player_health - sprite[p->i].extra;
|
||||
int j = max_player_health - p->GetActor()->s.extra;
|
||||
|
||||
if ((unsigned int)p->firstaid_amount > j)
|
||||
{
|
||||
p->firstaid_amount -= j;
|
||||
sprite[p->i].extra = max_player_health;
|
||||
p->GetActor()->s.extra = max_player_health;
|
||||
p->inven_icon = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite[p->i].extra += p->firstaid_amount;
|
||||
p->GetActor()->s.extra += p->firstaid_amount;
|
||||
p->firstaid_amount = 0;
|
||||
checkavailinven(p);
|
||||
}
|
||||
S_PlayActorSound(DUKE_USEMEDKIT, p->i);
|
||||
S_PlayActorSound(DUKE_USEMEDKIT, pact);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -390,32 +390,32 @@ void hud_input(int snum)
|
|||
if (p->firstaid_amount > j)
|
||||
{
|
||||
p->firstaid_amount -= j;
|
||||
sprite[p->i].extra += j;
|
||||
if (sprite[p->i].extra > max_player_health)
|
||||
sprite[p->i].extra = max_player_health;
|
||||
p->GetActor()->s.extra += j;
|
||||
if (p->GetActor()->s.extra > max_player_health)
|
||||
p->GetActor()->s.extra = max_player_health;
|
||||
p->inven_icon = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite[p->i].extra += p->firstaid_amount;
|
||||
p->GetActor()->s.extra += p->firstaid_amount;
|
||||
p->firstaid_amount = 0;
|
||||
checkavailinven(p);
|
||||
}
|
||||
if (sprite[p->i].extra > max_player_health)
|
||||
sprite[p->i].extra = max_player_health;
|
||||
if (p->GetActor()->s.extra > max_player_health)
|
||||
p->GetActor()->s.extra = max_player_health;
|
||||
p->drink_amt += 10;
|
||||
if (p->drink_amt <= 100 && !S_CheckActorSoundPlaying(p->i, DUKE_USEMEDKIT))
|
||||
S_PlayActorSound(DUKE_USEMEDKIT, p->i);
|
||||
if (p->drink_amt <= 100 && !S_CheckActorSoundPlaying(pact, DUKE_USEMEDKIT))
|
||||
S_PlayActorSound(DUKE_USEMEDKIT, pact);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerUseItem(snum, ICON_JETPACK) && (isRR() || p->newowner == -1))
|
||||
if (PlayerUseItem(plnum, ICON_JETPACK) && (isRR() || p->newOwner == nullptr))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_USEJETPACK, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
|
||||
OnEvent(EVENT_USEJETPACK, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0)
|
||||
{
|
||||
if (!isRR())
|
||||
{
|
||||
|
@ -426,17 +426,17 @@ void hud_input(int snum)
|
|||
{
|
||||
p->inven_icon = 4;
|
||||
|
||||
S_StopSound(-1, p->i, CHAN_VOICE); // this will stop the falling scream
|
||||
S_PlayActorSound(DUKE_JETPACK_ON, p->i);
|
||||
S_StopSound(-1, pact, CHAN_VOICE); // this will stop the falling scream
|
||||
S_PlayActorSound(DUKE_JETPACK_ON, pact);
|
||||
FTA(QUOTE_JETPACK_ON, p);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->hard_landing = 0;
|
||||
p->poszv = 0;
|
||||
S_PlayActorSound(DUKE_JETPACK_OFF, p->i);
|
||||
S_StopSound(DUKE_JETPACK_IDLE, p->i);
|
||||
S_StopSound(DUKE_JETPACK_ON, p->i);
|
||||
S_PlayActorSound(DUKE_JETPACK_OFF, pact);
|
||||
S_StopSound(DUKE_JETPACK_IDLE, pact);
|
||||
S_StopSound(DUKE_JETPACK_ON, pact);
|
||||
FTA(QUOTE_JETPACK_OFF, p);
|
||||
}
|
||||
}
|
||||
|
@ -445,10 +445,10 @@ void hud_input(int snum)
|
|||
else
|
||||
{
|
||||
// eat cow pie
|
||||
if (p->jetpack_amount > 0 && sprite[p->i].extra < max_player_health)
|
||||
if (p->jetpack_amount > 0 && p->GetActor()->s.extra < max_player_health)
|
||||
{
|
||||
if (!S_CheckActorSoundPlaying(p->i, 429))
|
||||
S_PlayActorSound(429, p->i);
|
||||
if (!S_CheckActorSoundPlaying(pact, 429))
|
||||
S_PlayActorSound(429, pact);
|
||||
|
||||
p->jetpack_amount -= 100;
|
||||
if (p->drink_amt > 0)
|
||||
|
@ -465,12 +465,12 @@ void hud_input(int snum)
|
|||
p->eat = 100;
|
||||
}
|
||||
|
||||
sprite[p->i].extra += 5;
|
||||
p->GetActor()->s.extra += 5;
|
||||
|
||||
p->inven_icon = 4;
|
||||
|
||||
if (sprite[p->i].extra > max_player_health)
|
||||
sprite[p->i].extra = max_player_health;
|
||||
if (p->GetActor()->s.extra > max_player_health)
|
||||
p->GetActor()->s.extra = max_player_health;
|
||||
|
||||
if (p->jetpack_amount <= 0)
|
||||
checkavailinven(p);
|
||||
|
@ -479,11 +479,11 @@ void hud_input(int snum)
|
|||
}
|
||||
}
|
||||
|
||||
if (PlayerInput(snum, SB_TURNAROUND) && p->angle.spin.asbam() == 0 && p->on_crane == nullptr)
|
||||
if (PlayerInput(plnum, SB_TURNAROUND) && p->angle.spin.asbam() == 0 && p->on_crane == nullptr)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, -1, snum);
|
||||
OnEvent(EVENT_TURNAROUND, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) != 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, nullptr, plnum);
|
||||
OnEvent(EVENT_TURNAROUND, plnum, nullptr, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, nullptr, plnum) != 0)
|
||||
{
|
||||
p->sync.actions &= ~SB_TURNAROUND;
|
||||
}
|
||||
|
@ -510,7 +510,8 @@ enum
|
|||
MAXANGVEL = 1024, // 127
|
||||
MAXHORIZVEL = 256, // 127
|
||||
|
||||
MAXVELMOTO = 120
|
||||
MAXVELMOTO = 120,
|
||||
VEHICLETURN = 20
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -521,7 +522,12 @@ enum
|
|||
|
||||
static void processInputBits(player_struct *p, ControlInfo* const hidInput)
|
||||
{
|
||||
ApplyGlobalInput(loc, hidInput);
|
||||
// Set-up crouch bools.
|
||||
int const sectorLotag = p->cursectnum != -1 ? sector[p->cursectnum].lotag : 0;
|
||||
bool const crouchable = sectorLotag != ST_2_UNDERWATER && (sectorLotag != ST_1_ABOVE_WATER || p->spritebridge);
|
||||
bool const disableToggle = p->jetpack_on || (!crouchable && p->on_ground) || (isRRRA() && (p->OnMotorcycle || p->OnBoat));
|
||||
|
||||
ApplyGlobalInput(loc, hidInput, crouchable, disableToggle);
|
||||
if (isRR() && (loc.actions & SB_CROUCH)) loc.actions &= ~SB_JUMP;
|
||||
|
||||
if (p->OnMotorcycle || p->OnBoat)
|
||||
|
@ -535,38 +541,11 @@ static void processInputBits(player_struct *p, ControlInfo* const hidInput)
|
|||
if (buttonMap.ButtonDown(gamefunc_Quick_Kick)) // this shares a bit with another function so cannot be in the common code.
|
||||
loc.actions |= SB_QUICK_KICK;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch) || p->crouch_toggle)
|
||||
{
|
||||
loc.actions |= SB_CROUCH;
|
||||
}
|
||||
if ((isRR() && p->drink_amt > 88)) loc.actions |= SB_LOOK_LEFT;
|
||||
if ((isRR() && p->drink_amt > 99)) loc.actions |= SB_LOOK_DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// split off so that it can later be integrated into the other games more easily.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void checkCrouchToggle(player_struct* p)
|
||||
{
|
||||
int const sectorLotag = p->cursectnum != -1 ? sector[p->cursectnum].lotag : 0;
|
||||
int const crouchable = sectorLotag != ST_2_UNDERWATER && (sectorLotag != ST_1_ABOVE_WATER || p->spritebridge);
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch))
|
||||
{
|
||||
p->crouch_toggle = !p->crouch_toggle && crouchable;
|
||||
|
||||
if (crouchable)
|
||||
buttonMap.ClearButton(gamefunc_Toggle_Crouch);
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Crouch) || buttonMap.ButtonDown(gamefunc_Jump) || p->jetpack_on || (!crouchable && p->on_ground))
|
||||
p->crouch_toggle = 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -586,67 +565,70 @@ int getticssincelastupdate()
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static double motoApplyTurn(player_struct* p, int turnl, int turnr, int bike_turn, bool goback, double factor)
|
||||
static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool const kbdLeft, bool const kbdRight, double const factor)
|
||||
{
|
||||
int turnvel = 0;
|
||||
double turnvel = 0;
|
||||
p->oTiltStatus = p->TiltStatus;
|
||||
|
||||
if (p->MotoSpeed == 0 || !p->on_ground)
|
||||
{
|
||||
turnheldtime = 0;
|
||||
lastcontroltime = 0;
|
||||
if (turnl)
|
||||
|
||||
if (kbdLeft || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
|
||||
{
|
||||
p->TiltStatus -= (float)factor;
|
||||
p->TiltStatus -= factor;
|
||||
if (p->TiltStatus < -10)
|
||||
p->TiltStatus = -10;
|
||||
}
|
||||
else if (turnr)
|
||||
else if (kbdRight || hidInput->mouseturnx > 0 || hidInput->dyaw > 0)
|
||||
{
|
||||
p->TiltStatus += (float)factor;
|
||||
p->TiltStatus += factor;
|
||||
if (p->TiltStatus > 10)
|
||||
p->TiltStatus = 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int tics = getticssincelastupdate();
|
||||
if (turnl || turnr || p->moto_drink != 0)
|
||||
if (kbdLeft || kbdRight || p->moto_drink || hidInput->mouseturnx || hidInput->dyaw)
|
||||
{
|
||||
if (turnl || p->moto_drink < 0)
|
||||
auto const baseVel = (buttonMap.ButtonDown(gamefunc_Move_Backward) || hidInput->dz < 0) && p->MotoSpeed <= 0 ? -VEHICLETURN : VEHICLETURN;
|
||||
int tics = getticssincelastupdate();
|
||||
|
||||
if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
|
||||
{
|
||||
turnheldtime += tics;
|
||||
p->TiltStatus -= (float)factor;
|
||||
p->TiltStatus -= factor;
|
||||
|
||||
if (p->TiltStatus < -10)
|
||||
p->TiltStatus = -10;
|
||||
if (turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0)
|
||||
{
|
||||
if (goback) turnvel += bike_turn ? 40 : 20;
|
||||
else turnvel += bike_turn ? -40 : -20;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (goback) turnvel += bike_turn ? 20 : 6;
|
||||
else turnvel += bike_turn ? -20 : -6;
|
||||
}
|
||||
|
||||
if (kbdLeft)
|
||||
turnvel -= turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.);
|
||||
|
||||
if (hidInput->mouseturnx < 0)
|
||||
turnvel -= sqrt((p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.)) * -(hidInput->mouseturnx / factor) * 2.);
|
||||
|
||||
if (hidInput->dyaw < 0)
|
||||
turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.)) * hidInput->dyaw;
|
||||
}
|
||||
|
||||
if (turnr || p->moto_drink > 0)
|
||||
if (kbdRight || p->moto_drink > 0 || hidInput->mouseturnx > 0 || hidInput->dyaw > 0)
|
||||
{
|
||||
turnheldtime += tics;
|
||||
p->TiltStatus += (float)factor;
|
||||
p->TiltStatus += factor;
|
||||
|
||||
if (p->TiltStatus > 10)
|
||||
p->TiltStatus = 10;
|
||||
if (turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0)
|
||||
{
|
||||
if (goback) turnvel += bike_turn ? -40 : -20;
|
||||
else turnvel += bike_turn ? 40 : 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (goback) turnvel += bike_turn ? -20 : -6;
|
||||
else turnvel += bike_turn ? 20 : 6;
|
||||
}
|
||||
|
||||
if (kbdRight)
|
||||
turnvel += turnheldtime >= TURBOTURNTIME && p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.);
|
||||
|
||||
if (hidInput->mouseturnx > 0)
|
||||
turnvel += sqrt((p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.)) * (hidInput->mouseturnx / factor) * 2.);
|
||||
|
||||
if (hidInput->dyaw > 0)
|
||||
turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * (3. / 10.)) * hidInput->dyaw;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -655,9 +637,9 @@ static double motoApplyTurn(player_struct* p, int turnl, int turnr, int bike_tur
|
|||
lastcontroltime = 0;
|
||||
|
||||
if (p->TiltStatus > 0)
|
||||
p->TiltStatus -= (float)factor;
|
||||
p->TiltStatus -= factor;
|
||||
else if (p->TiltStatus < 0)
|
||||
p->TiltStatus += (float)factor;
|
||||
p->TiltStatus += factor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -673,55 +655,59 @@ static double motoApplyTurn(player_struct* p, int turnl, int turnr, int bike_tur
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static double boatApplyTurn(player_struct *p, int turnl, int turnr, int boat_turn, double factor)
|
||||
static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool const kbdLeft, bool const kbdRight, double const factor)
|
||||
{
|
||||
int turnvel = 0;
|
||||
int tics = getticssincelastupdate();
|
||||
double turnvel = 0;
|
||||
p->oTiltStatus = p->TiltStatus;
|
||||
|
||||
if (p->MotoSpeed)
|
||||
{
|
||||
if (turnl || turnr || p->moto_drink != 0)
|
||||
if (kbdLeft || kbdRight || p->moto_drink || hidInput->mouseturnx || hidInput->dyaw)
|
||||
{
|
||||
if (turnl || p->moto_drink < 0)
|
||||
double const velScale = 6. / 19.;
|
||||
auto const baseVel = !p->NotOnWater ? VEHICLETURN : VEHICLETURN * velScale;
|
||||
int tics = getticssincelastupdate();
|
||||
|
||||
if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
|
||||
{
|
||||
turnheldtime += tics;
|
||||
|
||||
if (!p->NotOnWater)
|
||||
{
|
||||
p->TiltStatus -= (float)factor;
|
||||
p->TiltStatus -= factor;
|
||||
if (p->TiltStatus < -10)
|
||||
p->TiltStatus = -10;
|
||||
}
|
||||
if (turnheldtime >= TURBOTURNTIME)
|
||||
{
|
||||
if (p->NotOnWater) turnvel += boat_turn ? -12 : -6;
|
||||
else turnvel += boat_turn ? -40 : -20;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->NotOnWater) turnvel += boat_turn ? -4 : -2;
|
||||
else turnvel += boat_turn ? -12 : -6;
|
||||
}
|
||||
|
||||
if (kbdLeft)
|
||||
turnvel -= turnheldtime >= TURBOTURNTIME ? baseVel : baseVel * velScale;
|
||||
|
||||
if (hidInput->mouseturnx < 0)
|
||||
turnvel -= sqrt(baseVel * -(hidInput->mouseturnx / factor) * 2.);
|
||||
|
||||
if (hidInput->dyaw < 0)
|
||||
turnvel += baseVel * hidInput->dyaw;
|
||||
}
|
||||
|
||||
if (turnr || p->moto_drink > 0)
|
||||
if (kbdRight || p->moto_drink > 0 || hidInput->mouseturnx > 0 || hidInput->dyaw > 0)
|
||||
{
|
||||
turnheldtime += tics;
|
||||
|
||||
if (!p->NotOnWater)
|
||||
{
|
||||
p->TiltStatus += (float)factor;
|
||||
p->TiltStatus += factor;
|
||||
if (p->TiltStatus > 10)
|
||||
p->TiltStatus = 10;
|
||||
}
|
||||
if (turnheldtime >= TURBOTURNTIME)
|
||||
{
|
||||
if (p->NotOnWater) turnvel += boat_turn ? 12 : 6;
|
||||
else turnvel += boat_turn ? 40 : 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->NotOnWater) turnvel += boat_turn ? 4 : 2;
|
||||
else turnvel += boat_turn ? 12 : 6;
|
||||
}
|
||||
|
||||
if (kbdRight)
|
||||
turnvel += turnheldtime >= TURBOTURNTIME ? baseVel : baseVel * velScale;
|
||||
|
||||
if (hidInput->mouseturnx > 0)
|
||||
turnvel += sqrt(baseVel * (hidInput->mouseturnx / factor) * 2.);
|
||||
|
||||
if (hidInput->dyaw > 0)
|
||||
turnvel += baseVel * hidInput->dyaw;
|
||||
}
|
||||
}
|
||||
else if (!p->NotOnWater)
|
||||
|
@ -730,9 +716,9 @@ static double boatApplyTurn(player_struct *p, int turnl, int turnr, int boat_tur
|
|||
lastcontroltime = 0;
|
||||
|
||||
if (p->TiltStatus > 0)
|
||||
p->TiltStatus -= (float)factor;
|
||||
p->TiltStatus -= factor;
|
||||
else if (p->TiltStatus < 0)
|
||||
p->TiltStatus += (float)factor;
|
||||
p->TiltStatus += factor;
|
||||
}
|
||||
}
|
||||
else if (!p->NotOnWater)
|
||||
|
@ -741,9 +727,9 @@ static double boatApplyTurn(player_struct *p, int turnl, int turnr, int boat_tur
|
|||
lastcontroltime = 0;
|
||||
|
||||
if (p->TiltStatus > 0)
|
||||
p->TiltStatus -= (float)factor;
|
||||
p->TiltStatus -= factor;
|
||||
else if (p->TiltStatus < 0)
|
||||
p->TiltStatus += (float)factor;
|
||||
p->TiltStatus += factor;
|
||||
}
|
||||
|
||||
if (fabs(p->TiltStatus) < factor)
|
||||
|
@ -758,55 +744,35 @@ static double boatApplyTurn(player_struct *p, int turnl, int turnr, int boat_tur
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, InputPacket& input, double scaleAdjust)
|
||||
static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, InputPacket& input, double const scaleAdjust)
|
||||
{
|
||||
auto turnspeed = hidInput->mouseturnx + scaleAdjust * hidInput->dyaw * (1. / 32); // originally this was 64, not 32. Why the change?
|
||||
int turnl = buttonMap.ButtonDown(gamefunc_Turn_Left) || buttonMap.ButtonDown(gamefunc_Strafe_Left);
|
||||
int turnr = buttonMap.ButtonDown(gamefunc_Turn_Right) || buttonMap.ButtonDown(gamefunc_Strafe_Right);
|
||||
|
||||
// Cancel out micro-movement
|
||||
const double turn_threshold = 1 / 65536.;
|
||||
if (turnspeed < -turn_threshold)
|
||||
turnl = 1;
|
||||
else if (turnspeed > turn_threshold)
|
||||
turnr = 1;
|
||||
else
|
||||
turnspeed = 0;
|
||||
bool const kbdLeft = buttonMap.ButtonDown(gamefunc_Turn_Left) || buttonMap.ButtonDown(gamefunc_Strafe_Left);
|
||||
bool const kbdRight = buttonMap.ButtonDown(gamefunc_Turn_Right) || buttonMap.ButtonDown(gamefunc_Strafe_Right);
|
||||
p->vehTurnLeft = kbdLeft || hidInput->mouseturnx < 0 || hidInput->dyaw < 0;
|
||||
p->vehTurnRight = kbdRight || hidInput->mouseturnx > 0 || hidInput->dyaw > 0;
|
||||
|
||||
if (p->OnBoat || !p->moto_underwater)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Forward) || buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
loc.actions |= SB_JUMP;
|
||||
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
|
||||
p->vehicle_backwards = true;
|
||||
p->vehForwardScale = std::min((buttonMap.ButtonDown(gamefunc_Move_Forward) || buttonMap.ButtonDown(gamefunc_Strafe)) + hidInput->dz, 1.f);
|
||||
p->vehReverseScale = std::min(buttonMap.ButtonDown(gamefunc_Move_Backward) + -hidInput->dz, 1.f);
|
||||
|
||||
if (loc.actions & SB_RUN)
|
||||
loc.actions |= SB_CROUCH;
|
||||
}
|
||||
|
||||
if (turnl) p->vehicle_turnl = true;
|
||||
if (turnr) p->vehicle_turnr = true;
|
||||
|
||||
double turnvel;
|
||||
|
||||
if (p->OnMotorcycle)
|
||||
{
|
||||
bool backward = buttonMap.ButtonDown(gamefunc_Move_Backward) && p->MotoSpeed <= 0;
|
||||
|
||||
turnvel = motoApplyTurn(p, turnl, turnr, turnspeed, backward, scaleAdjust);
|
||||
input.avel = motoApplyTurn(p, hidInput, kbdLeft, kbdRight, scaleAdjust);
|
||||
if (p->moto_underwater) p->MotoSpeed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
turnvel = boatApplyTurn(p, turnl, turnr, turnspeed != 0, scaleAdjust);
|
||||
input.avel = boatApplyTurn(p, hidInput, kbdLeft, kbdRight, scaleAdjust);
|
||||
}
|
||||
|
||||
// What is this? Optimization for playing with a mouse which the original did not have?
|
||||
if (turnspeed)
|
||||
turnvel *= clamp(turnspeed * turnspeed, 0., 1.);
|
||||
|
||||
input.fvel = p->MotoSpeed;
|
||||
input.avel = turnvel * (45. / 256.);
|
||||
loc.avel = clamp(loc.avel + input.avel, -MAXANGVEL, MAXANGVEL);
|
||||
input.fvel = xs_CRoundToInt(p->MotoSpeed);
|
||||
input.avel *= (45. / 256.);
|
||||
loc.avel += input.avel;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -818,9 +784,9 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
|
|||
static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
|
||||
{
|
||||
auto p = &ps[playerNum];
|
||||
bool blocked = movementBlocked(playerNum) || sprite[p->i].extra <= 0 || (p->dead_flag && !ud.god);
|
||||
bool blocked = movementBlocked(playerNum) || p->GetActor()->s.extra <= 0 || (p->dead_flag && !ud.god);
|
||||
|
||||
if (blocked && ps[playerNum].newowner < 0)
|
||||
if (blocked && ps[playerNum].newOwner == nullptr)
|
||||
{
|
||||
// neutralize all movement when blocked or in automap follow mode
|
||||
loc.fvel = loc.svel = 0;
|
||||
|
@ -845,7 +811,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
|
|||
loc.svel = input.svel = 0;
|
||||
}
|
||||
|
||||
if (p->on_crane == nullptr && p->newowner == -1)
|
||||
if (p->on_crane == nullptr && p->newOwner == nullptr)
|
||||
{
|
||||
// input.avel already added to loc in processMovement()
|
||||
loc.avel = clamp(loc.avel, -MAXANGVEL, MAXANGVEL);
|
||||
|
@ -859,7 +825,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
|
|||
loc.avel = input.avel = 0;
|
||||
}
|
||||
|
||||
if (p->newowner == -1 && !(p->sync.actions & SB_CENTERVIEW))
|
||||
if (p->newOwner == nullptr && !(p->sync.actions & SB_CENTERVIEW))
|
||||
{
|
||||
// input.horz already added to loc in processMovement()
|
||||
loc.horz = clamp(loc.horz, -MAXHORIZVEL, MAXHORIZVEL);
|
||||
|
@ -898,12 +864,11 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
|
||||
if (isRRRA() && (p->OnMotorcycle || p->OnBoat))
|
||||
{
|
||||
p->crouch_toggle = 0;
|
||||
processInputBits(p, hidInput);
|
||||
processVehicleInput(p, hidInput, input, scaleAdjust);
|
||||
FinalizeInput(myconnectindex, input, true);
|
||||
|
||||
if (!cl_syncinput && sprite[p->i].extra > 0)
|
||||
if (!cl_syncinput && p->GetActor()->s.extra > 0)
|
||||
{
|
||||
apply_seasick(p, scaleAdjust);
|
||||
}
|
||||
|
@ -912,18 +877,17 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
{
|
||||
processInputBits(p, hidInput);
|
||||
processMovement(&input, &loc, hidInput, scaleAdjust, p->drink_amt);
|
||||
checkCrouchToggle(p);
|
||||
FinalizeInput(myconnectindex, input, false);
|
||||
}
|
||||
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
if (sprite[p->i].extra > 0)
|
||||
if (p->GetActor()->s.extra > 0)
|
||||
{
|
||||
// Do these in the same order as the old code.
|
||||
calcviewpitch(p, scaleAdjust);
|
||||
processavel(p, &input.avel);
|
||||
applylook(&p->angle, input.avel, &p->sync.actions, scaleAdjust, p->crouch_toggle || p->sync.actions & SB_CROUCH);
|
||||
applylook(&p->angle, input.avel, &p->sync.actions, scaleAdjust);
|
||||
sethorizon(&p->horizon.horiz, input.horz, &p->sync.actions, scaleAdjust);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,10 +100,10 @@ void restoreinterpolations() //Stick at end of drawscreen
|
|||
}
|
||||
|
||||
|
||||
void setsectinterpolate(int i)
|
||||
void setsectinterpolate(int sectnum)
|
||||
{
|
||||
int j, k, startwall,endwall;
|
||||
auto sect = §or[sprite[i].sectnum];
|
||||
auto sect = §or[sectnum];
|
||||
|
||||
startwall = sect->wallptr;
|
||||
endwall = startwall+sect->wallnum;
|
||||
|
@ -124,10 +124,10 @@ void setsectinterpolate(int i)
|
|||
}
|
||||
}
|
||||
|
||||
void clearsectinterpolate(short i)
|
||||
void clearsectinterpolate(int sectnum)
|
||||
{
|
||||
short j,startwall,endwall;
|
||||
auto sect = §or[sprite[i].sectnum];
|
||||
auto sect = §or[sectnum];
|
||||
|
||||
startwall = sect->wallptr;
|
||||
endwall = startwall + sect->wallnum;
|
||||
|
|
|
@ -387,6 +387,7 @@ x(NUKEBARRELDENTED, 1305)
|
|||
x(NUKEBARRELLEAKED, 1306)
|
||||
x(CANWITHSOMETHING, 1309)
|
||||
x(MONEY, 1310)
|
||||
x(FEATHER, 1310)
|
||||
x(BANNER, 1313)
|
||||
x(EXPLODINGBARREL, 1315)
|
||||
x(EXPLODINGBARREL2, 1316)
|
||||
|
|
|
@ -26,6 +26,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
//-------------------------------------------------------------------------
|
||||
#include "ns.h"
|
||||
#include "duke3d.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -39,20 +40,21 @@ int madenoise(int snum)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int wakeup(int i, int snum)
|
||||
int wakeup(DDukeActor* ac, int snum)
|
||||
{
|
||||
player_struct *p;
|
||||
int radius;
|
||||
p = &ps[snum];
|
||||
auto spr = &ac->s;
|
||||
if (!p->donoise)
|
||||
return 0;
|
||||
if (sprite[i].pal == 30 || sprite[i].pal == 32 || sprite[i].pal == 33 || (isRRRA() && sprite[i].pal == 8))
|
||||
if (spr->pal == 30 || spr->pal == 32 || spr->pal == 33 || (isRRRA() && spr->pal == 8))
|
||||
return 0;
|
||||
|
||||
radius = p->noise_radius;
|
||||
|
||||
if (p->noise_x - radius < sprite[i].x && p->noise_x + radius > sprite[i].x
|
||||
&& p->noise_y - radius < sprite[i].y && p->noise_y + radius > sprite[i].y)
|
||||
if (p->noise_x - radius < spr->x && p->noise_x + radius > spr->x
|
||||
&& p->noise_y - radius < spr->y && p->noise_y + radius > spr->y)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -58,16 +58,17 @@ void PlayerColorChanged(void)
|
|||
if (ud.recstat != 0)
|
||||
return;
|
||||
|
||||
auto& pp = ps[myconnectindex];
|
||||
if (ud.multimode > 1)
|
||||
{
|
||||
//Net_SendClientInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
ps[myconnectindex].palookup = ud.user_pals[myconnectindex] = playercolor2lookup(playercolor);
|
||||
pp.palookup = ud.user_pals[myconnectindex] = playercolor2lookup(playercolor);
|
||||
}
|
||||
if (sprite[ps[myconnectindex].i].picnum == TILE_APLAYER && sprite[ps[myconnectindex].i].pal != 1)
|
||||
sprite[ps[myconnectindex].i].pal = ud.user_pals[myconnectindex];
|
||||
if (pp.GetActor()->s.picnum == TILE_APLAYER && pp.GetActor()->s.pal != 1)
|
||||
pp.GetActor()->s.pal = ud.user_pals[myconnectindex];
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -124,7 +125,7 @@ void calcviewpitch(player_struct *p, double factor)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void setpal(struct player_struct* p)
|
||||
int setpal(struct player_struct* p)
|
||||
{
|
||||
int palette;
|
||||
if (p->DrugMode) palette = DRUGPAL;
|
||||
|
@ -133,7 +134,7 @@ void setpal(struct player_struct* p)
|
|||
else if (sector[p->cursectnum].ceilingpicnum >= TILE_FLOORSLIME && sector[p->cursectnum].ceilingpicnum <= TILE_FLOORSLIME + 2) palette = SLIMEPAL;
|
||||
else if (sector[p->cursectnum].lotag == ST_2_UNDERWATER) palette = WATERPAL;
|
||||
else palette = BASEPAL;
|
||||
p->palette = palette;
|
||||
return palette;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -146,9 +147,10 @@ void quickkill(struct player_struct* p)
|
|||
{
|
||||
SetPlayerPal(p, PalEntry(48, 48, 48, 48));
|
||||
|
||||
sprite[p->i].extra = 0;
|
||||
sprite[p->i].cstat |= 32768;
|
||||
if (ud.god == 0) fi.guts(&sprite[p->i], TILE_JIBS6, 8, myconnectindex);
|
||||
auto pa = p->GetActor();
|
||||
pa->s.extra = 0;
|
||||
pa->s.cstat |= 32768;
|
||||
if (ud.god == 0) fi.guts(pa, TILE_JIBS6, 8, myconnectindex);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -198,9 +200,9 @@ void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n)
|
|||
if (sect >= 0)
|
||||
{
|
||||
if (sector[sect].lotag == 2)
|
||||
EGS(sect, x1, y1, z1, TILE_WATERBUBBLE, -32, 4 + (krand() & 3), 4 + (krand() & 3), krand() & 2047, 0, 0, ps[0].i, 5);
|
||||
EGS(sect, x1, y1, z1, TILE_WATERBUBBLE, -32, 4 + (krand() & 3), 4 + (krand() & 3), krand() & 2047, 0, 0, ps[0].GetActor(), 5);
|
||||
else
|
||||
EGS(sect, x1, y1, z1, TILE_SMALLSMOKE, -32, 14, 14, 0, 0, 0, ps[0].i, 5);
|
||||
EGS(sect, x1, y1, z1, TILE_SMALLSMOKE, -32, 14, 14, 0, 0, 0, ps[0].GetActor(), 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,18 +213,19 @@ void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int hits(int i)
|
||||
int hits(DDukeActor* actor)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
int sx, sy, sz;
|
||||
short sect;
|
||||
short hw, hs;
|
||||
short hw;
|
||||
int zoff;
|
||||
DDukeActor* d;
|
||||
|
||||
if (sp->picnum == TILE_APLAYER) zoff = (40 << 8);
|
||||
else zoff = 0;
|
||||
|
||||
hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, &hs, &sx, &sy, &sz, CLIPMASK1);
|
||||
hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, &d, &sx, &sy, &sz, CLIPMASK1);
|
||||
|
||||
return (FindDistance2D(sx - sp->x, sy - sp->y));
|
||||
}
|
||||
|
@ -233,20 +236,20 @@ int hits(int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int hitasprite(int i, short* hitsp)
|
||||
int hitasprite(DDukeActor* actor, DDukeActor** hitsp)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
int sx, sy, sz, zoff;
|
||||
short sect, hw;
|
||||
|
||||
if (badguy(&sprite[i]))
|
||||
if (badguy(actor))
|
||||
zoff = (42 << 8);
|
||||
else if (sp->picnum == TILE_APLAYER) zoff = (39 << 8);
|
||||
else zoff = 0;
|
||||
|
||||
hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, hitsp, &sx, &sy, &sz, CLIPMASK1);
|
||||
|
||||
if (hw >= 0 && (wall[hw].cstat & 16) && badguy(&sprite[i]))
|
||||
if (hw >= 0 && (wall[hw].cstat & 16) && badguy(actor))
|
||||
return((1 << 30));
|
||||
|
||||
return (FindDistance2D(sx - sp->x, sy - sp->y));
|
||||
|
@ -261,10 +264,11 @@ int hitasprite(int i, short* hitsp)
|
|||
int hitawall(struct player_struct* p, int* hitw)
|
||||
{
|
||||
int sx, sy, sz;
|
||||
short sect, hs, hitw1;
|
||||
short sect, hitw1;
|
||||
DDukeActor* d;
|
||||
|
||||
hitscan(p->posx, p->posy, p->posz, p->cursectnum,
|
||||
sintable[(p->angle.ang.asbuild() + 512) & 2047], sintable[p->angle.ang.asbuild() & 2047], 0, §, &hitw1, &hs, &sx, &sy, &sz, CLIPMASK0);
|
||||
sintable[(p->angle.ang.asbuild() + 512) & 2047], sintable[p->angle.ang.asbuild() & 2047], 0, §, &hitw1, &d, &sx, &sy, &sz, CLIPMASK0);
|
||||
*hitw = hitw1;
|
||||
|
||||
return (FindDistance2D(sx - p->posx, sy - p->posy));
|
||||
|
@ -277,13 +281,14 @@ int hitawall(struct player_struct* p, int* hitw)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int aim(spritetype* s, int aang)
|
||||
DDukeActor* aim(DDukeActor* actor, int aang)
|
||||
{
|
||||
char gotshrinker, gotfreezer;
|
||||
int i, j, a, k, cans;
|
||||
int a, k, cans;
|
||||
int aimstats[] = { STAT_PLAYER, STAT_DUMMYPLAYER, STAT_ACTOR, STAT_ZOMBIEACTOR };
|
||||
int dx1, dy1, dx2, dy2, dx3, dy3, smax, sdist;
|
||||
int xv, yv;
|
||||
auto s = &actor->s;
|
||||
|
||||
a = s->ang;
|
||||
|
||||
|
@ -294,7 +299,7 @@ int aim(spritetype* s, int aang)
|
|||
{
|
||||
// The chickens in RRRA are homing and must always autoaim.
|
||||
if (!isRRRA() || ps[s->yvel].curr_weapon != CHICKEN_WEAPON)
|
||||
return -1;
|
||||
return nullptr;
|
||||
}
|
||||
else if (ps[s->yvel].auto_aim == 2)
|
||||
{
|
||||
|
@ -309,12 +314,12 @@ int aim(spritetype* s, int aang)
|
|||
}
|
||||
if (weap > CHAINGUN_WEAPON || weap == KNEE_WEAPON)
|
||||
{
|
||||
return -1;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
j = -1;
|
||||
DDukeActor* aimed = nullptr;
|
||||
// if(s->picnum == TILE_APLAYER && ps[s->yvel].aim_mode) return -1;
|
||||
|
||||
if (isRR())
|
||||
|
@ -345,13 +350,13 @@ int aim(spritetype* s, int aang)
|
|||
|
||||
for (k = 0; k < 4; k++)
|
||||
{
|
||||
if (j >= 0)
|
||||
if (aimed)
|
||||
break;
|
||||
|
||||
StatIterator it(aimstats[k]);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
DukeStatIterator it(aimstats[k]);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &act->s;
|
||||
if (sp->xrepeat > 0 && sp->extra >= 0 && (sp->cstat & (257 + 32768)) == 257)
|
||||
if (badguy(sp) || k < 2)
|
||||
{
|
||||
|
@ -386,7 +391,7 @@ int aim(spritetype* s, int aang)
|
|||
if (a && cans)
|
||||
{
|
||||
smax = sdist;
|
||||
j = i;
|
||||
aimed = act;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +399,7 @@ int aim(spritetype* s, int aang)
|
|||
}
|
||||
}
|
||||
|
||||
return j;
|
||||
return aimed;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -403,7 +408,7 @@ int aim(spritetype* s, int aang)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void dokneeattack(int snum, int pi, const std::initializer_list<int> & respawnlist)
|
||||
void dokneeattack(int snum, const std::initializer_list<int> & respawnlist)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
|
||||
|
@ -418,10 +423,10 @@ void dokneeattack(int snum, int pi, const std::initializer_list<int> & respawnli
|
|||
p->holster_weapon = 0;
|
||||
if (p->weapon_pos < 0)
|
||||
p->weapon_pos = -p->weapon_pos;
|
||||
if (p->actorsqu != nullptr && dist(&sprite[pi], &p->actorsqu->s) < 1400)
|
||||
if (p->actorsqu != nullptr && dist(p->GetActor(), p->actorsqu) < 1400)
|
||||
{
|
||||
fi.guts(&p->actorsqu->s, TILE_JIBS6, 7, myconnectindex);
|
||||
fi.spawn(p->actorsqu->GetIndex(), TILE_BLOODPOOL);
|
||||
fi.guts(p->actorsqu, TILE_JIBS6, 7, myconnectindex);
|
||||
spawn(p->actorsqu, TILE_BLOODPOOL);
|
||||
S_PlayActorSound(SQUISHED, p->actorsqu);
|
||||
if (isIn(p->actorsqu->s.picnum, respawnlist))
|
||||
{
|
||||
|
@ -456,8 +461,8 @@ void dokneeattack(int snum, int pi, const std::initializer_list<int> & respawnli
|
|||
int makepainsounds(int snum, int type)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
auto pi = p->i;
|
||||
auto s = &sprite[pi];
|
||||
auto actor = p->GetActor();
|
||||
auto s = &actor->s;
|
||||
int k = 0;
|
||||
|
||||
switch (type)
|
||||
|
@ -469,12 +474,12 @@ int makepainsounds(int snum, int type)
|
|||
k = 1;
|
||||
else
|
||||
{
|
||||
if (!S_CheckActorSoundPlaying(pi, DUKE_LONGTERM_PAIN))
|
||||
S_PlayActorSound(DUKE_LONGTERM_PAIN, pi);
|
||||
if (!S_CheckActorSoundPlaying(actor, DUKE_LONGTERM_PAIN))
|
||||
S_PlayActorSound(DUKE_LONGTERM_PAIN, actor);
|
||||
SetPlayerPal(p, PalEntry(32, 64, 64, 64));
|
||||
s->extra -= 1 + (krand() & 3);
|
||||
if (!S_CheckActorSoundPlaying(pi, SHORT_CIRCUIT))
|
||||
S_PlayActorSound(SHORT_CIRCUIT, pi);
|
||||
if (!S_CheckActorSoundPlaying(actor, SHORT_CIRCUIT))
|
||||
S_PlayActorSound(SHORT_CIRCUIT, actor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -485,8 +490,8 @@ int makepainsounds(int snum, int type)
|
|||
k = 1;
|
||||
else
|
||||
{
|
||||
if (!S_CheckActorSoundPlaying(pi, DUKE_LONGTERM_PAIN))
|
||||
S_PlayActorSound(DUKE_LONGTERM_PAIN, pi);
|
||||
if (!S_CheckActorSoundPlaying(actor, DUKE_LONGTERM_PAIN))
|
||||
S_PlayActorSound(DUKE_LONGTERM_PAIN, actor);
|
||||
SetPlayerPal(p, PalEntry(32, 0, 8, 0));
|
||||
s->extra -= 1 + (krand() & 3);
|
||||
}
|
||||
|
@ -499,8 +504,8 @@ int makepainsounds(int snum, int type)
|
|||
k = 1;
|
||||
else
|
||||
{
|
||||
if (!S_CheckActorSoundPlaying(pi, DUKE_LONGTERM_PAIN))
|
||||
S_PlayActorSound(DUKE_LONGTERM_PAIN, pi);
|
||||
if (!S_CheckActorSoundPlaying(actor, DUKE_LONGTERM_PAIN))
|
||||
S_PlayActorSound(DUKE_LONGTERM_PAIN, actor);
|
||||
SetPlayerPal(p, PalEntry(32, 8, 0, 0));
|
||||
s->extra -= 1 + (krand() & 3);
|
||||
}
|
||||
|
@ -514,7 +519,7 @@ int makepainsounds(int snum, int type)
|
|||
s->extra -= 2;
|
||||
else
|
||||
s->extra -= 4;
|
||||
S_PlayActorSound(DUKE_LONGTERM_PAIN, pi);
|
||||
S_PlayActorSound(DUKE_LONGTERM_PAIN, actor);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -530,36 +535,40 @@ int makepainsounds(int snum, int type)
|
|||
void footprints(int snum)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
auto pi = p->i;
|
||||
auto s = &sprite[pi];
|
||||
auto actor = p->GetActor();
|
||||
auto s = &actor->s;
|
||||
auto psect = s->sectnum;
|
||||
|
||||
if (p->footprintcount > 0 && p->on_ground)
|
||||
if ((sector[p->cursectnum].floorstat & 2) != 2)
|
||||
{
|
||||
int j;
|
||||
SectIterator it(psect);
|
||||
while ((j = it.NextIndex()) >= 0)
|
||||
int j = -1;
|
||||
DukeSectIterator it(psect);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
if (sprite[j].picnum == TILE_FOOTPRINTS || sprite[j].picnum == TILE_FOOTPRINTS2 || sprite[j].picnum == TILE_FOOTPRINTS3 || sprite[j].picnum == TILE_FOOTPRINTS4)
|
||||
if (abs(sprite[j].x - p->posx) < 384)
|
||||
if (abs(sprite[j].y - p->posy) < 384)
|
||||
if (act->s.picnum == TILE_FOOTPRINTS || act->s.picnum == TILE_FOOTPRINTS2 || act->s.picnum == TILE_FOOTPRINTS3 || act->s.picnum == TILE_FOOTPRINTS4)
|
||||
if (abs(act->s.x - p->posx) < 384)
|
||||
if (abs(act->s.y - p->posy) < 384)
|
||||
{
|
||||
j = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j < 0)
|
||||
{
|
||||
p->footprintcount--;
|
||||
if (sector[p->cursectnum].lotag == 0 && sector[p->cursectnum].hitag == 0)
|
||||
{
|
||||
DDukeActor* fprint;
|
||||
switch (krand() & 3)
|
||||
{
|
||||
case 0: j = fi.spawn(pi, TILE_FOOTPRINTS); break;
|
||||
case 1: j = fi.spawn(pi, TILE_FOOTPRINTS2); break;
|
||||
case 2: j = fi.spawn(pi, TILE_FOOTPRINTS3); break;
|
||||
default: j = fi.spawn(pi, TILE_FOOTPRINTS4); break;
|
||||
case 0: fprint = spawn(actor, TILE_FOOTPRINTS); break;
|
||||
case 1: fprint = spawn(actor, TILE_FOOTPRINTS2); break;
|
||||
case 2: fprint = spawn(actor, TILE_FOOTPRINTS3); break;
|
||||
default: fprint = spawn(actor, TILE_FOOTPRINTS4); break;
|
||||
}
|
||||
sprite[j].pal = p->footprintpal;
|
||||
sprite[j].shade = p->footprintshade;
|
||||
fprint->s.pal = p->footprintpal;
|
||||
fprint->s.shade = p->footprintshade;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -581,8 +590,8 @@ inline void backupplayer(player_struct* p)
|
|||
void playerisdead(int snum, int psectlotag, int fz, int cz)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
auto pi = p->i;
|
||||
auto s = &sprite[pi];
|
||||
auto actor = p->GetActor();
|
||||
auto s = &actor->s;
|
||||
|
||||
if (p->dead_flag == 0)
|
||||
{
|
||||
|
@ -603,8 +612,8 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
|
|||
p->jetpack_on = 0;
|
||||
p->holoduke_on = nullptr;
|
||||
|
||||
if (!isRR())S_StopSound(DUKE_JETPACK_IDLE, pi);
|
||||
S_StopSound(-1, pi, CHAN_VOICE);
|
||||
if (!isRR())S_StopSound(DUKE_JETPACK_IDLE, actor);
|
||||
S_StopSound(-1, actor, CHAN_VOICE);
|
||||
|
||||
|
||||
if (s->pal != 1 && (s->cstat & 32768) == 0) s->cstat = 0;
|
||||
|
@ -655,9 +664,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
|
|||
s->zvel = -348;
|
||||
}
|
||||
|
||||
clipmove(&p->posx, &p->posy,
|
||||
&p->posz, &p->cursectnum,
|
||||
0, 0, 164L, (4L << 8), (4L << 8), CLIPMASK0);
|
||||
clipmove(&p->posx, &p->posy, &p->posz, &p->cursectnum, 0, 0, 164, (4 << 8), (4 << 8), CLIPMASK0);
|
||||
// p->bobcounter += 32;
|
||||
}
|
||||
|
||||
|
@ -667,7 +674,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
|
|||
|
||||
updatesector(p->posx, p->posy, &p->cursectnum);
|
||||
|
||||
pushmove(&p->posx, &p->posy, &p->posz, &p->cursectnum, 128L, (4L << 8), (20L << 8), CLIPMASK0);
|
||||
pushmove(&p->posx, &p->posy, &p->posz, &p->cursectnum, 128L, (4 << 8), (20 << 8), CLIPMASK0);
|
||||
|
||||
if (fz > cz + (16 << 8) && s->pal != 1)
|
||||
p->angle.rotscrnang = buildlook(p->dead_flag + ((fz + p->posz) >> 7));
|
||||
|
@ -741,9 +748,9 @@ void playerCrouch(int snum)
|
|||
{
|
||||
auto p = &ps[snum];
|
||||
// crouching
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_CROUCH, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_CROUCH, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum) == 0)
|
||||
{
|
||||
p->posz += (2048 + 768);
|
||||
p->crack_time = CRACK_TIME;
|
||||
|
@ -757,9 +764,9 @@ void playerJump(int snum, int fz, int cz)
|
|||
{
|
||||
if ((fz - cz) > (56 << 8))
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_JUMP, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_JUMP, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum) == 0)
|
||||
{
|
||||
p->jumping_counter = 1;
|
||||
p->jumping_toggle = 1;
|
||||
|
@ -904,9 +911,9 @@ void checklook(int snum, ESyncBits actions)
|
|||
|
||||
if ((actions & SB_LOOK_LEFT) && !p->OnMotorcycle)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_LOOKLEFT, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_LOOKLEFT, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum) != 0)
|
||||
{
|
||||
actions &= ~SB_LOOK_LEFT;
|
||||
}
|
||||
|
@ -914,9 +921,9 @@ void checklook(int snum, ESyncBits actions)
|
|||
|
||||
if ((actions & SB_LOOK_RIGHT) && !p->OnMotorcycle)
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_LOOKRIGHT, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_LOOKRIGHT, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum) != 0)
|
||||
{
|
||||
actions &= ~SB_LOOK_RIGHT;
|
||||
}
|
||||
|
@ -933,9 +940,9 @@ void checklook(int snum, ESyncBits actions)
|
|||
void playerCenterView(int snum)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_RETURNTOCENTER, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_RETURNTOCENTER, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum) == 0)
|
||||
{
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
|
@ -948,9 +955,9 @@ void playerCenterView(int snum)
|
|||
void playerLookUp(int snum, ESyncBits actions)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_LOOKUP, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_LOOKUP, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum) == 0)
|
||||
{
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
|
@ -963,9 +970,9 @@ void playerLookUp(int snum, ESyncBits actions)
|
|||
void playerLookDown(int snum, ESyncBits actions)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_LOOKDOWN, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_LOOKDOWN, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum) == 0)
|
||||
{
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
|
@ -978,9 +985,9 @@ void playerLookDown(int snum, ESyncBits actions)
|
|||
void playerAimUp(int snum, ESyncBits actions)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_AIMUP, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_AIMUP, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum) != 0)
|
||||
{
|
||||
p->sync.actions &= ~SB_AIM_UP;
|
||||
}
|
||||
|
@ -989,9 +996,9 @@ void playerAimUp(int snum, ESyncBits actions)
|
|||
void playerAimDown(int snum, ESyncBits actions)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
SetGameVarID(g_iReturnVarID, 0, p->i, snum);
|
||||
OnEvent(EVENT_AIMDOWN, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_AIMDOWN, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum) != 0)
|
||||
{
|
||||
p->sync.actions &= ~SB_AIM_DOWN;
|
||||
}
|
||||
|
@ -1025,7 +1032,7 @@ bool movementBlocked(int snum)
|
|||
p->hard_landing ||
|
||||
p->access_incs > 0 ||
|
||||
p->knee_incs > 0 ||
|
||||
p->newowner >= 0 ||
|
||||
p->newOwner != nullptr ||
|
||||
(blockingweapon() && p->kickback_pic > 1 && p->kickback_pic < weapondelay()));
|
||||
}
|
||||
|
||||
|
@ -1062,13 +1069,14 @@ int haskey(int sect, int snum)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST)
|
||||
void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST)
|
||||
{
|
||||
spritetype* const s = &sprite[i];
|
||||
spritetype* const s = &actor->s;
|
||||
int sect = s->sectnum;
|
||||
int zvel;
|
||||
short hitsect, hitspr, hitwall, k;
|
||||
short hitsect, hitwall;
|
||||
int hitx, hity, hitz;
|
||||
DDukeActor* d;
|
||||
|
||||
if (p >= 0)
|
||||
sa += 64 - (krand() & 127);
|
||||
|
@ -1079,7 +1087,7 @@ void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, i
|
|||
hitscan(sx, sy, sz, sect,
|
||||
sintable[(sa + 512) & 2047],
|
||||
sintable[sa & 2047], zvel << 6,
|
||||
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
&hitsect, &hitwall, &d, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
// oh my...
|
||||
if (FindDistance2D(sx - hitx, sy - hity) < 1024 &&
|
||||
|
@ -1095,10 +1103,10 @@ void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, i
|
|||
{
|
||||
if (wall[hitwall].nextsector >= 0)
|
||||
{
|
||||
SectIterator it(wall[hitwall].nextsector);
|
||||
while ((k = it.NextIndex()) >= 0)
|
||||
DukeSectIterator it(wall[hitwall].nextsector);
|
||||
while (auto act2 = it.Next())
|
||||
{
|
||||
if (sprite[k].statnum == 3 && sprite[k].lotag == 13)
|
||||
if (act2->s.statnum == STAT_EFFECTOR && act2->s.lotag == SE_13_EXPLOSIVE)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1109,17 +1117,17 @@ void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, i
|
|||
|
||||
if (wall[hitwall].hitag == 0)
|
||||
{
|
||||
k = fi.spawn(i, atwith);
|
||||
sprite[k].xvel = -12;
|
||||
sprite[k].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
|
||||
sprite[k].x = hitx;
|
||||
sprite[k].y = hity;
|
||||
sprite[k].z = hitz;
|
||||
sprite[k].cstat |= (krand() & 4);
|
||||
ssp(k, CLIPMASK0);
|
||||
setsprite(k, sprite[k].x, sprite[k].y, sprite[k].z);
|
||||
auto spawned = spawn(actor, atwith);
|
||||
spawned->s.xvel = -12;
|
||||
spawned->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
|
||||
spawned->s.x = hitx;
|
||||
spawned->s.y = hity;
|
||||
spawned->s.z = hitz;
|
||||
spawned->s.cstat |= (krand() & 4);
|
||||
ssp(spawned, CLIPMASK0);
|
||||
setsprite(spawned, spawned->s.pos);
|
||||
if (s->picnum == OOZFILTER || s->picnum == NEWBEAST)
|
||||
sprite[k].pal = 6;
|
||||
spawned->s.pal = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1136,19 +1144,20 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
|
|||
{
|
||||
spritetype* sp;
|
||||
int i, nx, ny, nz, hx, hy, hitx, hity, hitz;
|
||||
short bakcstat, hitsect, hitwall, hitsprite, daang;
|
||||
short bakcstat, hitsect, hitwall, daang;
|
||||
DDukeActor* hitsprt;
|
||||
|
||||
nx = (sintable[(ang + 1536) & 2047] >> 4);
|
||||
ny = (sintable[(ang + 1024) & 2047] >> 4);
|
||||
nz = q16horiz >> 9;
|
||||
|
||||
sp = &sprite[pp->i];
|
||||
sp = &pp->GetActor()->s;
|
||||
|
||||
bakcstat = sp->cstat;
|
||||
sp->cstat &= (short)~0x101;
|
||||
|
||||
updatesectorz(*vx, *vy, *vz, vsectnum);
|
||||
hitscan(*vx, *vy, *vz, *vsectnum, nx, ny, nz, &hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
hitscan(*vx, *vy, *vz, *vsectnum, nx, ny, nz, &hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1);
|
||||
|
||||
if (*vsectnum < 0)
|
||||
{
|
||||
|
@ -1169,7 +1178,7 @@ bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum,
|
|||
if (abs(nx) > abs(ny)) hx -= mulscale28(nx, i);
|
||||
else hy -= mulscale28(ny, i);
|
||||
}
|
||||
else if (hitsprite < 0)
|
||||
else if (!hitsprt)
|
||||
{
|
||||
if (abs(nx) > abs(ny)) hx -= (nx >> 5);
|
||||
else hy -= (ny >> 5);
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -49,52 +49,52 @@ int operateTripbomb(int snum);
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void DoFire(struct player_struct *p, short snum)
|
||||
void DoFire(struct player_struct* p, short snum)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(aplWeaponWorksLike[p->curr_weapon][snum]!=KNEE_WEAPON)
|
||||
if (aplWeaponWorksLike[p->curr_weapon][snum] != KNEE_WEAPON)
|
||||
{
|
||||
p->ammo_amount[p->curr_weapon]--;
|
||||
}
|
||||
|
||||
if(aplWeaponFireSound[p->curr_weapon][snum])
|
||||
|
||||
if (aplWeaponFireSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponFireSound[p->curr_weapon][snum],p->i);
|
||||
S_PlayActorSound(aplWeaponFireSound[p->curr_weapon][snum], p->GetActor());
|
||||
}
|
||||
|
||||
SetGameVarID(g_iWeaponVarID,p->curr_weapon,p->i,snum);
|
||||
SetGameVarID(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum);
|
||||
fi.shoot(p->i,aplWeaponShoots[p->curr_weapon][snum]);
|
||||
for(i=1;i<aplWeaponShotsPerBurst[p->curr_weapon][snum];i++)
|
||||
|
||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->GetActor(), snum);
|
||||
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], p->GetActor(), snum);
|
||||
fi.shoot(p->GetActor(), aplWeaponShoots[p->curr_weapon][snum]);
|
||||
for (i = 1; i < aplWeaponShotsPerBurst[p->curr_weapon][snum]; i++)
|
||||
{
|
||||
fi.shoot(p->i,aplWeaponShoots[p->curr_weapon][snum]);
|
||||
if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AMMOPERSHOT)
|
||||
fi.shoot(p->GetActor(), aplWeaponShoots[p->curr_weapon][snum]);
|
||||
if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AMMOPERSHOT)
|
||||
{
|
||||
p->ammo_amount[p->curr_weapon]--;
|
||||
}
|
||||
}
|
||||
|
||||
if(! (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE ))
|
||||
|
||||
if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE))
|
||||
{
|
||||
// make them visible if not set...
|
||||
lastvisinc = ud.levelclock+32;
|
||||
lastvisinc = ud.levelclock + 32;
|
||||
p->visibility = 0;
|
||||
}
|
||||
|
||||
if( //!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_CHECKATRELOAD) &&
|
||||
aplWeaponReload[p->curr_weapon][snum] > aplWeaponTotalTime[p->curr_weapon][snum]
|
||||
&& p->ammo_amount[p->curr_weapon] > 0
|
||||
&& (aplWeaponClip[p->curr_weapon][snum])
|
||||
&& ((p->ammo_amount[p->curr_weapon]%(aplWeaponClip[p->curr_weapon][snum]))==0)
|
||||
)
|
||||
|
||||
if ( //!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_CHECKATRELOAD) &&
|
||||
aplWeaponReload[p->curr_weapon][snum] > aplWeaponTotalTime[p->curr_weapon][snum]
|
||||
&& p->ammo_amount[p->curr_weapon] > 0
|
||||
&& (aplWeaponClip[p->curr_weapon][snum])
|
||||
&& ((p->ammo_amount[p->curr_weapon] % (aplWeaponClip[p->curr_weapon][snum])) == 0)
|
||||
)
|
||||
{
|
||||
// do clip check...
|
||||
p->kickback_pic=aplWeaponTotalTime[p->curr_weapon][snum];
|
||||
p->kickback_pic = aplWeaponTotalTime[p->curr_weapon][snum];
|
||||
// is same as p->kickback_pic....
|
||||
}
|
||||
|
||||
if(aplWeaponWorksLike[p->curr_weapon][snum]!=KNEE_WEAPON)
|
||||
if (aplWeaponWorksLike[p->curr_weapon][snum] != KNEE_WEAPON)
|
||||
{
|
||||
checkavailweapon(p);
|
||||
}
|
||||
|
@ -108,27 +108,26 @@ void DoFire(struct player_struct *p, short snum)
|
|||
|
||||
void DoSpawn(struct player_struct *p, short snum)
|
||||
{
|
||||
int j;
|
||||
if(!aplWeaponSpawn[p->curr_weapon][snum])
|
||||
return;
|
||||
|
||||
j = fi.spawn(p->i, aplWeaponSpawn[p->curr_weapon][snum]);
|
||||
auto j = spawn(p->GetActor(), aplWeaponSpawn[p->curr_weapon][snum]);
|
||||
|
||||
if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE2 ) )
|
||||
{
|
||||
// like shotgun shells
|
||||
sprite[j].ang += 1024;
|
||||
j->s.ang += 1024;
|
||||
ssp(j,CLIPMASK0);
|
||||
sprite[j].ang += 1024;
|
||||
j->s.ang += 1024;
|
||||
// p->kickback_pic++;
|
||||
}
|
||||
else if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE3 ) )
|
||||
{
|
||||
// like chaingun shells
|
||||
sprite[j].ang += 1024;
|
||||
sprite[j].ang &= 2047;
|
||||
sprite[j].xvel += 32;
|
||||
sprite[j].z += (3<<8);
|
||||
j->s.ang += 1024;
|
||||
j->s.ang &= 2047;
|
||||
j->s.xvel += 32;
|
||||
j->s.z += (3<<8);
|
||||
ssp(j,CLIPMASK0);
|
||||
}
|
||||
|
||||
|
@ -143,7 +142,7 @@ void DoSpawn(struct player_struct *p, short snum)
|
|||
void fireweapon_ww(int snum)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
int pi = p->i;
|
||||
auto pact = p->GetActor();
|
||||
|
||||
p->crack_time = CRACK_TIME;
|
||||
|
||||
|
@ -158,11 +157,11 @@ void fireweapon_ww(int snum)
|
|||
}
|
||||
else
|
||||
{
|
||||
SetGameVarID(g_iReturnVarID, 0, pi, snum);
|
||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, pi, snum);
|
||||
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], pi, snum);
|
||||
OnEvent(EVENT_FIRE, pi, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pi, snum) == 0)
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->GetActor(), snum);
|
||||
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], p->GetActor(), snum);
|
||||
OnEvent(EVENT_FIRE, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum) == 0)
|
||||
{
|
||||
switch (aplWeaponWorksLike[p->curr_weapon][snum])
|
||||
{
|
||||
|
@ -173,7 +172,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -182,7 +181,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -193,7 +192,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -205,7 +204,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -216,7 +215,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -226,7 +225,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -237,7 +236,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -248,7 +247,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -259,7 +258,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -270,7 +269,7 @@ void fireweapon_ww(int snum)
|
|||
p->hbomb_hold_delay = !p->hbomb_hold_delay;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -281,7 +280,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -292,7 +291,7 @@ void fireweapon_ww(int snum)
|
|||
p->kickback_pic = 1;
|
||||
if (aplWeaponInitialSound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponInitialSound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -310,8 +309,8 @@ void fireweapon_ww(int snum)
|
|||
void operateweapon_ww(int snum, ESyncBits actions, int psect)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
int pi = p->i;
|
||||
int i, j, k;
|
||||
auto pact = p->GetActor();
|
||||
int i, k;
|
||||
int psectlotag = sector[psect].lotag;
|
||||
|
||||
// already firing...
|
||||
|
@ -342,33 +341,33 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
|
|||
i = -512 - mulscale16(p->horizon.sum().asq16(), 20);
|
||||
}
|
||||
|
||||
j = EGS(p->cursectnum,
|
||||
auto j = EGS(p->cursectnum,
|
||||
p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6),
|
||||
p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6),
|
||||
p->posz, HEAVYHBOMB, -16, 9, 9,
|
||||
p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)), i, pi, 1);
|
||||
p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)), i, p->GetActor(), 1);
|
||||
|
||||
{
|
||||
int lGrenadeLifetime = GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, -1, snum);
|
||||
int lGrenadeLifetimeVar = GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, -1, snum);
|
||||
int lGrenadeLifetime = GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, nullptr, snum);
|
||||
int lGrenadeLifetimeVar = GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, snum);
|
||||
// set timer. blows up when at zero....
|
||||
sprite[j].extra = lGrenadeLifetime
|
||||
j->s.extra = lGrenadeLifetime
|
||||
+ mulscale(krand(), lGrenadeLifetimeVar, 14)
|
||||
- lGrenadeLifetimeVar;
|
||||
}
|
||||
|
||||
if (k == 15)
|
||||
{
|
||||
sprite[j].yvel = 3;
|
||||
sprite[j].z += (8 << 8);
|
||||
j->s.yvel = 3;
|
||||
j->s.z += (8 << 8);
|
||||
}
|
||||
|
||||
k = hits(pi);
|
||||
k = hits(p->GetActor());
|
||||
if (k < 512)
|
||||
{
|
||||
sprite[j].ang += 1024;
|
||||
sprite[j].zvel /= 3;
|
||||
sprite[j].xvel /= 3;
|
||||
j->s.ang += 1024;
|
||||
j->s.zvel /= 3;
|
||||
j->s.xvel /= 3;
|
||||
}
|
||||
|
||||
p->hbomb_on = 1;
|
||||
|
@ -404,9 +403,9 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
|
|||
lastvisinc = ud.levelclock + 32;
|
||||
p->visibility = 0;
|
||||
}
|
||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->i, snum);
|
||||
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum);
|
||||
fi.shoot(pi, aplWeaponShoots[p->curr_weapon][snum]);
|
||||
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->GetActor(), snum);
|
||||
SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], p->GetActor(), snum);
|
||||
fi.shoot(p->GetActor(), aplWeaponShoots[p->curr_weapon][snum]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -444,7 +443,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
|
|||
{
|
||||
if (aplWeaponSound2Sound[p->curr_weapon][snum])
|
||||
{
|
||||
S_PlayActorSound(aplWeaponSound2Sound[p->curr_weapon][snum], pi);
|
||||
S_PlayActorSound(aplWeaponSound2Sound[p->curr_weapon][snum], pact);
|
||||
}
|
||||
}
|
||||
if (p->kickback_pic == aplWeaponSpawnTime[p->curr_weapon][snum])
|
||||
|
@ -501,12 +500,12 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
|
|||
|
||||
if (p->kickback_pic == (aplWeaponTotalTime[p->curr_weapon][snum] + 1))
|
||||
{ // eject shortly after 'total time'
|
||||
S_PlayActorSound(EJECT_CLIP, pi);
|
||||
S_PlayActorSound(EJECT_CLIP, pact);
|
||||
}
|
||||
else if (p->kickback_pic == (aplWeaponReload[p->curr_weapon][snum] - (i / 3)))
|
||||
{
|
||||
// insert occurs 2/3 of way through reload delay
|
||||
S_PlayActorSound(INSERT_CLIP, pi);
|
||||
S_PlayActorSound(INSERT_CLIP, pact);
|
||||
}
|
||||
|
||||
if (p->kickback_pic >= (aplWeaponReload[p->curr_weapon][snum]))
|
||||
|
|
|
@ -102,7 +102,8 @@ void fakedomovethings(void)
|
|||
{
|
||||
input *syn;
|
||||
struct player_struct *p;
|
||||
int i, j, k, doubvel, fz, cz, hz, lz, x, y;
|
||||
int i, j, k, doubvel, fz, cz, x, y;
|
||||
Collision clz, chz;
|
||||
short psect, psectlotag, tempsect, backcstat;
|
||||
uint8_t shrunk, spritebridge;
|
||||
ESyncBits actions;
|
||||
|
@ -111,8 +112,8 @@ void fakedomovethings(void)
|
|||
|
||||
p = &ps[myconnectindex];
|
||||
|
||||
backcstat = sprite[p->i].cstat;
|
||||
sprite[p->i].cstat &= ~257;
|
||||
backcstat = p->GetActor()->s.cstat;
|
||||
p->GetActor()->s.cstat &= ~257;
|
||||
|
||||
actions = syn->actions;
|
||||
|
||||
|
@ -120,7 +121,7 @@ void fakedomovethings(void)
|
|||
psectlotag = sector[psect].lotag;
|
||||
spritebridge = 0;
|
||||
|
||||
shrunk = (sprite[p->i].yrepeat < (isRR()? 8 : 32));
|
||||
shrunk = (p->GetActor()->s.yrepeat < (isRR()? 8 : 32));
|
||||
|
||||
if( ud.clipping == 0 && ( sector[psect].floorpicnum == MIRROR || psect < 0 || psect >= MAXSECTORS) )
|
||||
{
|
||||
|
@ -138,11 +139,11 @@ void fakedomovethings(void)
|
|||
omyz = myz;
|
||||
omyang = myang;
|
||||
|
||||
getzrange(myx,myy,myz,psect,&cz,&hz,&fz,&lz,163L,CLIPMASK0);
|
||||
getzrange(myx,myy,myz,psect,&cz,chz,&fz,clz,163L,CLIPMASK0);
|
||||
|
||||
j = getflorzofslope(psect,myx,myy);
|
||||
|
||||
if( (lz&49152) == 16384 && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8) )
|
||||
if(clz.type == kHitSector && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8) )
|
||||
psectlotag = 0;
|
||||
|
||||
if( p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2) )
|
||||
|
@ -163,33 +164,31 @@ void fakedomovethings(void)
|
|||
if (myhorizoff > 0) myhorizoff -= ((myhorizoff>>3)+1);
|
||||
else if (myhorizoff < 0) myhorizoff += (((-myhorizoff)>>3)+1);
|
||||
|
||||
if(hz >= 0 && (hz&49152) == 49152)
|
||||
if(chz.type == kHitSprite)
|
||||
{
|
||||
hz &= (MAXSPRITES-1);
|
||||
if (sprite[hz].statnum == 1 && sprite[hz].extra >= 0)
|
||||
if (chz.actor->s.statnum == 1 && chz.actor->s.extra >= 0)
|
||||
{
|
||||
hz = 0;
|
||||
chz.type = kHitNone;
|
||||
cz = getceilzofslope(psect,myx,myy);
|
||||
}
|
||||
}
|
||||
|
||||
if(lz >= 0 && (lz&49152) == 49152)
|
||||
if (clz.type == kHitSprite)
|
||||
{
|
||||
j = lz&(MAXSPRITES-1);
|
||||
if ((sprite[j].cstat&33) == 33)
|
||||
if ((clz.actor->s.cstat&33) == 33)
|
||||
{
|
||||
psectlotag = 0;
|
||||
spritebridge = 1;
|
||||
}
|
||||
if(badguy(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(sprite[p->i].z-sprite[j].z) < (84<<8) )
|
||||
if(badguy(chz.actor) && chz.actor->s.xrepeat > 24 && klabs(p->GetActor()->s.z- chz.actor->s.z) < (84<<8) )
|
||||
{
|
||||
j = getangle( sprite[j].x-myx,sprite[j].y-myy);
|
||||
j = getangle(chz.actor->s.x-myx, chz.actor->s.y-myy);
|
||||
myxvel -= sintable[(j+512)&2047]<<4;
|
||||
myyvel -= sintable[j&2047]<<4;
|
||||
}
|
||||
}
|
||||
|
||||
if( sprite[p->i].extra <= 0 )
|
||||
if( p->GetActor()->s.extra <= 0 )
|
||||
{
|
||||
if( psectlotag == 2 )
|
||||
{
|
||||
|
@ -525,7 +524,7 @@ ENDFAKEPROCESSINPUT:
|
|||
myhorizbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myhoriz;
|
||||
fakemovefifoplc++;
|
||||
|
||||
sprite[p->i].cstat = backcstat;
|
||||
p->GetActor()->s.cstat = backcstat;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ void resetplayerstats(int snum)
|
|||
// p->select_dir = 0;
|
||||
p->extra_extra8 = 0;
|
||||
p->show_empty_weapon= 0;
|
||||
p->dummyplayersprite=-1;
|
||||
p->dummyplayersprite=nullptr;
|
||||
p->crack_time = 0;
|
||||
p->hbomb_hold_delay = 0;
|
||||
p->transporter_hold = 0;
|
||||
|
@ -121,14 +121,13 @@ void resetplayerstats(int snum)
|
|||
p->airleft = 15*26;
|
||||
p->rapid_fire_hold = 0;
|
||||
p->toggle_key_flag = 0;
|
||||
p->access_spritenum = -1;
|
||||
p->access_spritenum = nullptr;
|
||||
if(ud.multimode > 1 && ud.coop != 1 )
|
||||
p->got_access = 7;
|
||||
else p->got_access = 0;
|
||||
p->random_club_frame= 0;
|
||||
p->on_warping_sector = 0;
|
||||
p->spritebridge = 0;
|
||||
p->palette = 0;
|
||||
|
||||
if(p->steroids_amount < 400 )
|
||||
{
|
||||
|
@ -142,7 +141,7 @@ void resetplayerstats(int snum)
|
|||
p->angle.olook_ang = p->angle.look_ang = buildlook(512 - ((currentLevel->levelNumber & 1) << 10));
|
||||
p->angle.orotscrnang = p->angle.rotscrnang = buildlook(0);
|
||||
|
||||
p->newowner =-1;
|
||||
p->newOwner =nullptr;
|
||||
p->jumping_counter = 0;
|
||||
p->hard_landing = 0;
|
||||
p->posxv = 0; //!!
|
||||
|
@ -166,7 +165,6 @@ void resetplayerstats(int snum)
|
|||
p->knuckle_incs = 1;
|
||||
p->fist_incs = 0;
|
||||
p->knee_incs = 0;
|
||||
setpal(p);
|
||||
p->stairs = 0;
|
||||
p->noise_x = 0;
|
||||
p->noise_y = 0;
|
||||
|
@ -297,7 +295,7 @@ void resetweapons(int snum)
|
|||
p->gotweapon.Set(SLINGBLADE_WEAPON);
|
||||
p->ammo_amount[SLINGBLADE_WEAPON] = 1;
|
||||
}
|
||||
OnEvent(EVENT_RESETWEAPONS, -1, snum, -1);
|
||||
OnEvent(EVENT_RESETWEAPONS, snum, nullptr, -1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -370,7 +368,7 @@ void resetinventory(int snum)
|
|||
ufocnt = 0;
|
||||
hulkspawn = 2;
|
||||
}
|
||||
OnEvent(EVENT_RESETINVENTORY, snum, p->i);
|
||||
OnEvent(EVENT_RESETINVENTORY, snum, p->GetActor());
|
||||
}
|
||||
|
||||
|
||||
|
@ -416,9 +414,9 @@ void resetprestat(int snum,int g)
|
|||
parallaxtype = 0;
|
||||
randomseed = 17L;
|
||||
paused = 0;
|
||||
ud.camerasprite =-1;
|
||||
ud.cameraactor =nullptr;
|
||||
tempwallptr = 0;
|
||||
camsprite =-1;
|
||||
camsprite =nullptr;
|
||||
earthquaketime = 0;
|
||||
|
||||
WindTime = 0;
|
||||
|
@ -426,7 +424,7 @@ void resetprestat(int snum,int g)
|
|||
fakebubba_spawn = 0;
|
||||
RRRA_ExitedLevel = 0;
|
||||
BellTime = 0;
|
||||
BellSprite = 0;
|
||||
BellSprite = nullptr;
|
||||
|
||||
numinterpolations = 0;
|
||||
//startofdynamicinterpolations = 0;
|
||||
|
@ -572,10 +570,10 @@ void resetpspritevars(int g)
|
|||
|
||||
which_palookup = 9;
|
||||
j = connecthead;
|
||||
StatIterator it(STAT_PLAYER);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
DukeStatIterator it(STAT_PLAYER);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
s = &sprite[i];
|
||||
s = &act->s;
|
||||
|
||||
if (numplayersprites == MAXPLAYERS)
|
||||
I_Error("Too many player sprites (max 16.)");
|
||||
|
@ -595,7 +593,7 @@ void resetpspritevars(int g)
|
|||
numplayersprites++;
|
||||
if (j >= 0)
|
||||
{
|
||||
s->owner = i;
|
||||
act->SetOwner(act);
|
||||
s->shade = 0;
|
||||
s->xrepeat = isRR() ? 24 : 42;
|
||||
s->yrepeat = isRR() ? 17 : 36;
|
||||
|
@ -626,13 +624,13 @@ void resetpspritevars(int g)
|
|||
else
|
||||
s->pal = ps[j].palookup = ud.user_pals[j];
|
||||
|
||||
ps[j].i = i;
|
||||
ps[j].i = act->GetIndex();
|
||||
ps[j].frag_ps = j;
|
||||
hittype[i].owner = i;
|
||||
act->SetOwner(act);
|
||||
|
||||
hittype[i].bposx = ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x;
|
||||
hittype[i].bposy = ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y;
|
||||
hittype[i].bposz = ps[j].oposz = ps[j].posz = s->z;
|
||||
act->bposx = ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x;
|
||||
act->bposy = ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y;
|
||||
act->bposz = ps[j].oposz = ps[j].posz = s->z;
|
||||
ps[j].angle.oang = ps[j].angle.ang = buildang(s->ang);
|
||||
|
||||
updatesector(s->x, s->y, &ps[j].cursectnum);
|
||||
|
@ -640,7 +638,7 @@ void resetpspritevars(int g)
|
|||
j = connectpoint2[j];
|
||||
|
||||
}
|
||||
else deletesprite(i);
|
||||
else deletesprite(act);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -677,7 +675,7 @@ void prelevel_common(int g)
|
|||
RRRA_ExitedLevel = 0;
|
||||
mamaspawn_count = 15;
|
||||
BellTime = 0;
|
||||
BellSprite = 0;
|
||||
BellSprite = nullptr;
|
||||
|
||||
// RRRA E2L1 fog handling.
|
||||
fogactive = 0;
|
||||
|
@ -742,8 +740,8 @@ void resettimevars(void)
|
|||
{
|
||||
cloudclock = 0;
|
||||
ud.levelclock = 0;
|
||||
if (camsprite >= 0)
|
||||
hittype[camsprite].temp_data[0] = 0;
|
||||
if (camsprite != nullptr)
|
||||
camsprite->temp_data[0] = 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -950,7 +948,7 @@ void enterlevel(MapRecord *mi, int gamemode)
|
|||
|
||||
for (int i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
int pn = sector[sprite[ps[i].i].sectnum].floorpicnum;
|
||||
int pn = sector[ps[i].GetActor()->s.sectnum].floorpicnum;
|
||||
if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA)
|
||||
{
|
||||
resetweapons(i);
|
||||
|
@ -962,7 +960,6 @@ void enterlevel(MapRecord *mi, int gamemode)
|
|||
}
|
||||
}
|
||||
resetmys();
|
||||
setpal(&ps[myconnectindex]);
|
||||
|
||||
everyothertime = 0;
|
||||
global_random = 0;
|
||||
|
@ -1063,7 +1060,6 @@ void exitlevel(MapRecord *nextlevel)
|
|||
{
|
||||
bool endofgame = nextlevel == nullptr;
|
||||
STAT_Update(endofgame);
|
||||
setpal(&ps[myconnectindex]);
|
||||
StopCommentary();
|
||||
|
||||
dobonus(endofgame? -1 : 0, [=](bool)
|
||||
|
|
|
@ -52,17 +52,17 @@ inline void tloadtile(int tilenum, int palnum = 0)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void cachespritenum(int i)
|
||||
static void cachespritenum(spritetype *spr)
|
||||
{
|
||||
int maxc;
|
||||
int j;
|
||||
int pal = sprite[i].pal;
|
||||
int pal = spr->pal;
|
||||
|
||||
if(ud.monsters_off && badguy(&sprite[i])) return;
|
||||
if(ud.monsters_off && badguy(spr)) return;
|
||||
|
||||
maxc = 1;
|
||||
|
||||
switch(sprite[i].picnum)
|
||||
switch(spr->picnum)
|
||||
{
|
||||
case HYDRENT:
|
||||
tloadtile(BROKEFIREHYDRENT);
|
||||
|
@ -164,7 +164,7 @@ static void cachespritenum(int i)
|
|||
break;
|
||||
}
|
||||
|
||||
for(j = sprite[i].picnum; j < (sprite[i].picnum+maxc); j++)
|
||||
for(j = spr->picnum; j < (spr->picnum+maxc); j++)
|
||||
tloadtile(j, pal);
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ static void cachegoodsprites(void)
|
|||
|
||||
void cacheit_d(void)
|
||||
{
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
cachegoodsprites();
|
||||
|
||||
|
@ -251,13 +251,13 @@ void cacheit_d(void)
|
|||
tloadtile(LA + 1);
|
||||
tloadtile(LA + 2);
|
||||
}
|
||||
}
|
||||
|
||||
SectIterator it(i);
|
||||
while ((j = it.NextIndex()) >= 0)
|
||||
{
|
||||
if (sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat & 32768) == 0)
|
||||
cachespritenum(j);
|
||||
DukeSectIterator it(i);
|
||||
while (auto j = it.Next())
|
||||
{
|
||||
if (j->s.xrepeat != 0 && j->s.yrepeat != 0 && (j->s.cstat & 32768) == 0)
|
||||
cachespritenum(&j->s);
|
||||
}
|
||||
}
|
||||
|
||||
precacheMarkedTiles();
|
||||
|
@ -276,11 +276,11 @@ void prelevel_d(int g)
|
|||
|
||||
prelevel_common(g);
|
||||
|
||||
StatIterator it(STAT_DEFAULT);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
DukeStatIterator it(STAT_DEFAULT);
|
||||
while (auto ac = it.Next())
|
||||
{
|
||||
auto si = &sprite[i];
|
||||
LoadActor(i, -1, -1);
|
||||
auto si = &ac->s;
|
||||
LoadActor(ac, -1, -1);
|
||||
|
||||
if (si->lotag == -1 && (si->cstat & 16))
|
||||
{
|
||||
|
@ -291,7 +291,7 @@ void prelevel_d(int g)
|
|||
{
|
||||
case GPSPEED:
|
||||
sector[si->sectnum].extra = si->lotag;
|
||||
deletesprite(i);
|
||||
deletesprite(ac);
|
||||
break;
|
||||
|
||||
case CYCLER:
|
||||
|
@ -304,34 +304,39 @@ void prelevel_d(int g)
|
|||
cyclers[numcyclers][4] = si->hitag;
|
||||
cyclers[numcyclers][5] = (si->ang == 1536);
|
||||
numcyclers++;
|
||||
deletesprite(i);
|
||||
deletesprite(ac);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < MAXSPRITES; i++)
|
||||
{
|
||||
auto spr = &sprite[i];
|
||||
if (spr->statnum < MAXSTATUS)
|
||||
{
|
||||
if (spr->picnum == SECTOREFFECTOR && spr->lotag == SE_14_SUBWAY_CAR)
|
||||
continue;
|
||||
spawn(nullptr, i);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXSPRITES; i++)
|
||||
{
|
||||
if (sprite[i].statnum < MAXSTATUS)
|
||||
auto spr = &sprite[i];
|
||||
if (spr->statnum < MAXSTATUS)
|
||||
{
|
||||
if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == SE_14_SUBWAY_CAR)
|
||||
continue;
|
||||
fi.spawn(-1, i);
|
||||
if (spr->picnum == SECTOREFFECTOR && spr->lotag == SE_14_SUBWAY_CAR)
|
||||
spawn(nullptr, i);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXSPRITES; i++)
|
||||
if (sprite[i].statnum < MAXSTATUS)
|
||||
{
|
||||
if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == SE_14_SUBWAY_CAR)
|
||||
fi.spawn(-1, i);
|
||||
}
|
||||
|
||||
lotaglist = 0;
|
||||
|
||||
it.Reset(STAT_DEFAULT);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
{
|
||||
switch (sprite[i].picnum)
|
||||
auto spr = &sprite[i];
|
||||
switch (spr->picnum)
|
||||
{
|
||||
case DIPSWITCH + 1:
|
||||
case DIPSWITCH2 + 1:
|
||||
|
@ -347,21 +352,21 @@ void prelevel_d(int g)
|
|||
case LOCKSWITCH1 + 1:
|
||||
case POWERSWITCH2 + 1:
|
||||
for (j = 0; j < lotaglist; j++)
|
||||
if (sprite[i].lotag == lotags[j])
|
||||
if (spr->lotag == lotags[j])
|
||||
break;
|
||||
|
||||
if (j == lotaglist)
|
||||
{
|
||||
lotags[lotaglist] = sprite[i].lotag;
|
||||
lotags[lotaglist] = spr->lotag;
|
||||
lotaglist++;
|
||||
if (lotaglist > 64)
|
||||
I_Error("Too many switches (64 max).");
|
||||
|
||||
StatIterator it1(STAT_EFFECTOR);
|
||||
while ((j = it1.NextIndex()) >= 0)
|
||||
DukeStatIterator it1(STAT_EFFECTOR);
|
||||
while (auto ac = it1.Next())
|
||||
{
|
||||
if (sprite[j].lotag == 12 && sprite[j].hitag == sprite[i].lotag)
|
||||
hittype[j].temp_data[0] = 1;
|
||||
if (ac->s.lotag == 12 && ac->s.hitag == spr->lotag)
|
||||
ac->temp_data[0] = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -51,17 +51,17 @@ static inline void tloadtile(int tilenum, int palnum = 0)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void cachespritenum(short i)
|
||||
static void cachespritenum(spritetype *spr)
|
||||
{
|
||||
char maxc;
|
||||
short j;
|
||||
int pal = sprite[i].pal;
|
||||
int pal = spr->pal;
|
||||
|
||||
if (ud.monsters_off && badguy(&sprite[i])) return;
|
||||
if (ud.monsters_off && badguy(spr)) return;
|
||||
|
||||
maxc = 1;
|
||||
|
||||
switch (sprite[i].picnum)
|
||||
switch (spr->picnum)
|
||||
{
|
||||
case HYDRENT:
|
||||
tloadtile(BROKEFIREHYDRENT);
|
||||
|
@ -70,7 +70,7 @@ static void cachespritenum(short i)
|
|||
break;
|
||||
case RRTILE2121:
|
||||
case RRTILE2122:
|
||||
tloadtile(sprite[i].picnum, pal);
|
||||
tloadtile(spr->picnum, pal);
|
||||
break;
|
||||
case TOILET:
|
||||
tloadtile(TOILETBROKE);
|
||||
|
@ -126,7 +126,7 @@ static void cachespritenum(short i)
|
|||
break;
|
||||
case COW:
|
||||
maxc = 56;
|
||||
for (j = sprite[i].picnum; j < (sprite[i].picnum + maxc); j++)
|
||||
for (j = spr->picnum; j < (spr->picnum + maxc); j++)
|
||||
tloadtile(j, pal);
|
||||
maxc = 0;
|
||||
break;
|
||||
|
@ -278,7 +278,7 @@ static void cachespritenum(short i)
|
|||
break;
|
||||
case VIXEN:
|
||||
maxc = 214;
|
||||
for (j = sprite[i].picnum; j < sprite[i].picnum + maxc; j++)
|
||||
for (j = spr->picnum; j < spr->picnum + maxc; j++)
|
||||
tloadtile(j, pal);
|
||||
maxc = 0;
|
||||
break;
|
||||
|
@ -287,7 +287,7 @@ static void cachespritenum(short i)
|
|||
{
|
||||
|
||||
maxc = 54;
|
||||
for (j = sprite[i].picnum; j < sprite[i].picnum + maxc; j++)
|
||||
for (j = spr->picnum; j < spr->picnum + maxc; j++)
|
||||
tloadtile(j, pal);
|
||||
maxc = 100;
|
||||
for (j = SBMOVE; j < SBMOVE + maxc; j++)
|
||||
|
@ -297,7 +297,7 @@ static void cachespritenum(short i)
|
|||
break;
|
||||
case HULK:
|
||||
maxc = 40;
|
||||
for (j = sprite[i].picnum - 41; j < sprite[i].picnum + maxc - 41; j++)
|
||||
for (j = spr->picnum - 41; j < spr->picnum + maxc - 41; j++)
|
||||
tloadtile(j, pal);
|
||||
for (j = HULKJIBA; j <= HULKJIBC + 4; j++)
|
||||
tloadtile(j, pal);
|
||||
|
@ -305,7 +305,7 @@ static void cachespritenum(short i)
|
|||
break;
|
||||
case MINION:
|
||||
maxc = 141;
|
||||
for (j = sprite[i].picnum; j < sprite[i].picnum + maxc; j++)
|
||||
for (j = spr->picnum; j < spr->picnum + maxc; j++)
|
||||
tloadtile(j, pal);
|
||||
for (j = MINJIBA; j <= MINJIBC + 4; j++)
|
||||
tloadtile(j, pal);
|
||||
|
@ -315,7 +315,7 @@ static void cachespritenum(short i)
|
|||
|
||||
}
|
||||
|
||||
for (j = sprite[i].picnum; j < (sprite[i].picnum + maxc); j++)
|
||||
for (j = spr->picnum; j < (spr->picnum + maxc); j++)
|
||||
tloadtile(j, pal);
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ static void cachegoodsprites(void)
|
|||
|
||||
void cacheit_r(void)
|
||||
{
|
||||
short i,j;
|
||||
int i;
|
||||
|
||||
cachegoodsprites();
|
||||
|
||||
|
@ -426,13 +426,13 @@ void cacheit_r(void)
|
|||
tloadtile(LA + 1);
|
||||
tloadtile(LA + 2);
|
||||
}
|
||||
}
|
||||
|
||||
SectIterator it(i);
|
||||
while ((j = it.NextIndex()) >= 0)
|
||||
{
|
||||
if(sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat&32768) == 0)
|
||||
cachespritenum(j);
|
||||
DukeSectIterator it(i);
|
||||
while (auto j = it.Next())
|
||||
{
|
||||
if(j->s.xrepeat != 0 && j->s.yrepeat != 0 && (j->s.cstat&32768) == 0)
|
||||
cachespritenum(&j->s);
|
||||
}
|
||||
}
|
||||
precacheMarkedTiles();
|
||||
}
|
||||
|
@ -451,7 +451,6 @@ void prelevel_r(int g)
|
|||
short startwall;
|
||||
short endwall;
|
||||
short lotaglist;
|
||||
short k;
|
||||
short lotags[65];
|
||||
int speed;
|
||||
int dist;
|
||||
|
@ -469,18 +468,19 @@ void prelevel_r(int g)
|
|||
|
||||
for (j = 0; j < MAXSPRITES; j++)
|
||||
{
|
||||
if (sprite[j].pal == 100)
|
||||
auto spr = &sprite[j];
|
||||
if (spr->pal == 100)
|
||||
{
|
||||
if (numplayers > 1)
|
||||
deletesprite(j);
|
||||
else
|
||||
sprite[j].pal = 0;
|
||||
spr->pal = 0;
|
||||
}
|
||||
else if (sprite[j].pal == 101)
|
||||
else if (spr->pal == 101)
|
||||
{
|
||||
sprite[j].extra = 0;
|
||||
sprite[j].hitag = 1;
|
||||
sprite[j].pal = 0;
|
||||
spr->extra = 0;
|
||||
spr->hitag = 1;
|
||||
spr->pal = 0;
|
||||
changespritestat(j, 118);
|
||||
}
|
||||
}
|
||||
|
@ -495,19 +495,20 @@ void prelevel_r(int g)
|
|||
{
|
||||
case 41:
|
||||
{
|
||||
SectIterator it(i);
|
||||
while ((k = it.NextIndex()) >= 0)
|
||||
DukeSectIterator it(i);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
if (sprite[k].picnum == RRTILE11)
|
||||
auto spr = &act->s;
|
||||
if (spr->picnum == RRTILE11)
|
||||
{
|
||||
dist = sprite[k].lotag << 4;
|
||||
speed = sprite[k].hitag;
|
||||
deletesprite(k);
|
||||
dist = spr->lotag << 4;
|
||||
speed = spr->hitag;
|
||||
deletesprite(act);
|
||||
}
|
||||
if (sprite[k].picnum == RRTILE38)
|
||||
if (spr->picnum == RRTILE38)
|
||||
{
|
||||
sound = sprite[k].lotag;
|
||||
deletesprite(k);
|
||||
sound = spr->lotag;
|
||||
deletesprite(act);
|
||||
}
|
||||
}
|
||||
for (j = 0; j < numsectors; j++)
|
||||
|
@ -525,29 +526,30 @@ void prelevel_r(int g)
|
|||
{
|
||||
short ii;
|
||||
int childsectnum = -1;
|
||||
SectIterator it(i);
|
||||
while ((k = it.NextIndex()) >= 0)
|
||||
DukeSectIterator it(i);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
auto sj = &sprite[k];
|
||||
auto sj = &act->s;
|
||||
if (sj->picnum == RRTILE64)
|
||||
{
|
||||
dist = sj->lotag << 4;
|
||||
speed = sj->hitag;
|
||||
for (ii = 0; ii < MAXSPRITES; ii++)
|
||||
{
|
||||
if (sprite[ii].picnum == RRTILE66)
|
||||
if (sprite[ii].lotag == sj->sectnum)
|
||||
auto spr = &sprite[ii];
|
||||
if (spr->picnum == RRTILE66)
|
||||
if (spr->lotag == sj->sectnum)
|
||||
{
|
||||
childsectnum = sprite[ii].sectnum;
|
||||
childsectnum = spr->sectnum;
|
||||
deletesprite(ii);
|
||||
}
|
||||
}
|
||||
deletesprite(k);
|
||||
deletesprite(act);
|
||||
}
|
||||
if (sj->picnum == RRTILE65)
|
||||
{
|
||||
sound = sj->lotag;
|
||||
deletesprite(k);
|
||||
deletesprite(act);
|
||||
}
|
||||
}
|
||||
addminecart(dist, speed, i, sector[i].hitag, sound, childsectnum);
|
||||
|
@ -556,11 +558,11 @@ void prelevel_r(int g)
|
|||
}
|
||||
}
|
||||
|
||||
StatIterator it(STAT_DEFAULT);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
DukeStatIterator it(STAT_DEFAULT);
|
||||
while (auto ac = it.Next())
|
||||
{
|
||||
auto si = &sprite[i];
|
||||
LoadActor(i, -1, -1);
|
||||
auto si = &ac->s;
|
||||
LoadActor(ac, -1, -1);
|
||||
|
||||
if (si->lotag == -1 && (si->cstat & 16))
|
||||
{
|
||||
|
@ -575,7 +577,7 @@ void prelevel_r(int g)
|
|||
|
||||
case GPSPEED:
|
||||
sector[si->sectnum].extra = si->lotag;
|
||||
deletesprite(i);
|
||||
deletesprite(ac);
|
||||
break;
|
||||
|
||||
case CYCLER:
|
||||
|
@ -588,22 +590,22 @@ void prelevel_r(int g)
|
|||
cyclers[numcyclers][4] = si->hitag;
|
||||
cyclers[numcyclers][5] = (si->ang == 1536);
|
||||
numcyclers++;
|
||||
deletesprite(i);
|
||||
deletesprite(ac);
|
||||
break;
|
||||
|
||||
case RRTILE18:
|
||||
addtorch(i);
|
||||
deletesprite(i);
|
||||
addtorch(si);
|
||||
deletesprite(ac);
|
||||
break;
|
||||
|
||||
case RRTILE35:
|
||||
addlightning(i);
|
||||
deletesprite(i);
|
||||
addlightning(si);
|
||||
deletesprite(ac);
|
||||
break;
|
||||
|
||||
case RRTILE68:
|
||||
shadedsector[si->sectnum] = 1;
|
||||
deletesprite(i);
|
||||
deletesprite(ac);
|
||||
break;
|
||||
|
||||
case RRTILE67:
|
||||
|
@ -628,30 +630,32 @@ void prelevel_r(int g)
|
|||
|
||||
for (i = 0; i < MAXSPRITES; i++)
|
||||
{
|
||||
if (sprite[i].picnum == RRTILE19)
|
||||
auto spr = &sprite[i];
|
||||
if (spr->picnum == RRTILE19)
|
||||
{
|
||||
if (geocnt > 64)
|
||||
I_Error("Too many geometry effects");
|
||||
if (sprite[i].hitag == 0)
|
||||
if (spr->hitag == 0)
|
||||
{
|
||||
geosector[geocnt] = sprite[i].sectnum;
|
||||
geosector[geocnt] = spr->sectnum;
|
||||
for (j = 0; j < MAXSPRITES; j++)
|
||||
{
|
||||
if (sprite[i].lotag == sprite[j].lotag && j != i && sprite[j].picnum == RRTILE19)
|
||||
auto spj = &sprite[j];
|
||||
if (spr->lotag == spj->lotag && j != i && spj->picnum == RRTILE19)
|
||||
{
|
||||
if (sprite[j].hitag == 1)
|
||||
if (spj->hitag == 1)
|
||||
{
|
||||
geosectorwarp[geocnt] = sprite[j].sectnum;
|
||||
geox[geocnt] = sprite[i].x - sprite[j].x;
|
||||
geoy[geocnt] = sprite[i].y - sprite[j].y;
|
||||
//geoz[geocnt] = sprite[i].z - sprite[j].z;
|
||||
geosectorwarp[geocnt] = spj->sectnum;
|
||||
geox[geocnt] = spr->x - spj->x;
|
||||
geoy[geocnt] = spr->y - spj->y;
|
||||
//geoz[geocnt] = spr->z - spj->z;
|
||||
}
|
||||
if (sprite[j].hitag == 2)
|
||||
if (spj->hitag == 2)
|
||||
{
|
||||
geosectorwarp2[geocnt] = sprite[j].sectnum;
|
||||
geox2[geocnt] = sprite[i].x - sprite[j].x;
|
||||
geoy2[geocnt] = sprite[i].y - sprite[j].y;
|
||||
//geoz2[geocnt] = sprite[i].z - sprite[j].z;
|
||||
geosectorwarp2[geocnt] = spj->sectnum;
|
||||
geox2[geocnt] = spr->x - spj->x;
|
||||
geoy2[geocnt] = spr->y - spj->y;
|
||||
//geoz2[geocnt] = spr->z - spj->z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -662,26 +666,28 @@ void prelevel_r(int g)
|
|||
|
||||
for (i = 0; i < MAXSPRITES; i++)
|
||||
{
|
||||
if (sprite[i].statnum < MAXSTATUS)
|
||||
auto spr = &sprite[i];
|
||||
if (spr->statnum < MAXSTATUS)
|
||||
{
|
||||
if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14)
|
||||
if (spr->picnum == SECTOREFFECTOR && spr->lotag == 14)
|
||||
continue;
|
||||
fi.spawn(-1, i);
|
||||
spawn(nullptr, i);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXSPRITES; i++)
|
||||
{
|
||||
if (sprite[i].statnum < MAXSTATUS)
|
||||
auto spr = &sprite[i];
|
||||
if (spr->statnum < MAXSTATUS)
|
||||
{
|
||||
if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 14)
|
||||
fi.spawn(-1, i);
|
||||
if (spr->picnum == SECTOREFFECTOR && spr->lotag == 14)
|
||||
spawn(nullptr, i);
|
||||
}
|
||||
if (sprite[i].picnum == RRTILE19)
|
||||
if (spr->picnum == RRTILE19)
|
||||
deletesprite(i);
|
||||
if (sprite[i].picnum == RRTILE34)
|
||||
if (spr->picnum == RRTILE34)
|
||||
{
|
||||
sectorextra[sprite[i].sectnum] = sprite[i].lotag;
|
||||
sectorextra[spr->sectnum] = spr->lotag;
|
||||
deletesprite(i);
|
||||
}
|
||||
}
|
||||
|
@ -689,9 +695,10 @@ void prelevel_r(int g)
|
|||
lotaglist = 0;
|
||||
|
||||
it.Reset(STAT_DEFAULT);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
while (auto ac = it.Next())
|
||||
{
|
||||
switch (sprite[i].picnum)
|
||||
auto spr = &ac->s;
|
||||
switch (spr->picnum)
|
||||
{
|
||||
case RRTILE8464 + 1:
|
||||
if (!isRRRA()) break;
|
||||
|
@ -712,21 +719,21 @@ void prelevel_r(int g)
|
|||
case NUKEBUTTON + 1:
|
||||
|
||||
for (j = 0; j < lotaglist; j++)
|
||||
if (sprite[i].lotag == lotags[j])
|
||||
if (spr->lotag == lotags[j])
|
||||
break;
|
||||
|
||||
if (j == lotaglist)
|
||||
{
|
||||
lotags[lotaglist] = sprite[i].lotag;
|
||||
lotags[lotaglist] = spr->lotag;
|
||||
lotaglist++;
|
||||
if (lotaglist > 64)
|
||||
I_Error("Too many switches (64 max).");
|
||||
|
||||
StatIterator it1(STAT_EFFECTOR);
|
||||
while ((j = it1.NextIndex()) >= 0)
|
||||
DukeStatIterator it1(STAT_EFFECTOR);
|
||||
while (auto j = it1.Next())
|
||||
{
|
||||
if (sprite[j].lotag == 12 && sprite[j].hitag == sprite[i].lotag)
|
||||
hittype[j].temp_data[0] = 1;
|
||||
if (j->s.lotag == 12 && j->s.hitag == spr->lotag)
|
||||
j->temp_data[0] = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -31,6 +31,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
|||
#include "v_video.h"
|
||||
#include "prediction.h"
|
||||
#include "automap.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
@ -57,104 +58,118 @@ static int tempsectorz[MAXSECTORS];
|
|||
static int tempsectorpicnum[MAXSECTORS];
|
||||
//short tempcursectnum;
|
||||
|
||||
void SE40_Draw(int tag, int spnum, int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
|
||||
void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
|
||||
{
|
||||
int i, j = 0, k = 0;
|
||||
int floor1, floor2 = 0, ok = 0, fofmode = 0;
|
||||
int ok = 0, fofmode = 0;
|
||||
int offx, offy;
|
||||
spritetype* floor1, *floor2 = nullptr;
|
||||
|
||||
if (sprite[spnum].ang != 512) return;
|
||||
if (spr->ang != 512) return;
|
||||
|
||||
i = FOF; //Effect TILE
|
||||
tileDelete(FOF);
|
||||
if (!(gotpic[i >> 3] & (1 << (i & 7)))) return;
|
||||
gotpic[i >> 3] &= ~(1 << (i & 7));
|
||||
|
||||
floor1 = spnum;
|
||||
floor1 = spr;
|
||||
|
||||
if (sprite[spnum].lotag == tag + 2) fofmode = tag + 0;
|
||||
if (sprite[spnum].lotag == tag + 3) fofmode = tag + 1;
|
||||
if (sprite[spnum].lotag == tag + 4) fofmode = tag + 0;
|
||||
if (sprite[spnum].lotag == tag + 5) fofmode = tag + 1;
|
||||
if (spr->lotag == tag + 2) fofmode = tag + 0;
|
||||
if (spr->lotag == tag + 3) fofmode = tag + 1;
|
||||
if (spr->lotag == tag + 4) fofmode = tag + 0;
|
||||
if (spr->lotag == tag + 5) fofmode = tag + 1;
|
||||
|
||||
ok++;
|
||||
|
||||
for (j = 0; j < MAXSPRITES; j++)
|
||||
DukeStatIterator it(STAT_RAROR);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
auto spr = &act->s;
|
||||
if (
|
||||
sprite[j].picnum == 1 &&
|
||||
sprite[j].lotag == fofmode &&
|
||||
sprite[j].hitag == sprite[floor1].hitag
|
||||
) {
|
||||
floor1 = j; fofmode = sprite[j].lotag; ok++; break;
|
||||
spr->picnum == SECTOREFFECTOR &&
|
||||
spr->lotag == fofmode &&
|
||||
spr->hitag == floor1->hitag
|
||||
)
|
||||
{
|
||||
floor1 = spr;
|
||||
fofmode = spr->lotag;
|
||||
ok++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if(ok==1) { Message("no floor1",RED); return; }
|
||||
|
||||
if (fofmode == tag + 0) k = tag + 1; else k = tag + 0;
|
||||
|
||||
for (j = 0; j < MAXSPRITES; j++)
|
||||
it.Reset(STAT_RAROR);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
auto spr = &act->s;
|
||||
if (
|
||||
sprite[j].picnum == 1 &&
|
||||
sprite[j].lotag == k &&
|
||||
sprite[j].hitag == sprite[floor1].hitag
|
||||
) {
|
||||
floor2 = j; ok++; break;
|
||||
spr->picnum == SECTOREFFECTOR &&
|
||||
spr->lotag == k &&
|
||||
spr->hitag == floor1->hitag
|
||||
)
|
||||
{
|
||||
floor2 = spr;
|
||||
ok++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if(ok==2) { Message("no floor2",RED); return; }
|
||||
|
||||
for (j = 0; j < MAXSPRITES; j++) // raise ceiling or floor
|
||||
it.Reset(STAT_RAROR);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
if (sprite[j].picnum == 1 &&
|
||||
sprite[j].lotag == k + 2 &&
|
||||
sprite[j].hitag == sprite[floor1].hitag
|
||||
auto spr = &act->s;
|
||||
if (spr->picnum == SECTOREFFECTOR &&
|
||||
spr->lotag == k + 2 &&
|
||||
spr->hitag == floor1->hitag
|
||||
)
|
||||
{
|
||||
if (k == tag + 0)
|
||||
{
|
||||
tempsectorz[sprite[j].sectnum] = sector[sprite[j].sectnum].floorz;
|
||||
sector[sprite[j].sectnum].floorz += (((z - sector[sprite[j].sectnum].floorz) / 32768) + 1) * 32768;
|
||||
tempsectorpicnum[sprite[j].sectnum] = sector[sprite[j].sectnum].floorpicnum;
|
||||
sector[sprite[j].sectnum].floorpicnum = 13;
|
||||
tempsectorz[spr->sectnum] = sector[spr->sectnum].floorz;
|
||||
sector[spr->sectnum].floorz += (((z - sector[spr->sectnum].floorz) / 32768) + 1) * 32768;
|
||||
tempsectorpicnum[spr->sectnum] = sector[spr->sectnum].floorpicnum;
|
||||
sector[spr->sectnum].floorpicnum = 13;
|
||||
}
|
||||
if (k == tag + 1)
|
||||
{
|
||||
tempsectorz[sprite[j].sectnum] = sector[sprite[j].sectnum].ceilingz;
|
||||
sector[sprite[j].sectnum].ceilingz += (((z - sector[sprite[j].sectnum].ceilingz) / 32768) - 1) * 32768;
|
||||
tempsectorpicnum[sprite[j].sectnum] = sector[sprite[j].sectnum].ceilingpicnum;
|
||||
sector[sprite[j].sectnum].ceilingpicnum = 13;
|
||||
tempsectorz[spr->sectnum] = sector[spr->sectnum].ceilingz;
|
||||
sector[spr->sectnum].ceilingz += (((z - sector[spr->sectnum].ceilingz) / 32768) - 1) * 32768;
|
||||
tempsectorpicnum[spr->sectnum] = sector[spr->sectnum].ceilingpicnum;
|
||||
sector[spr->sectnum].ceilingpicnum = 13;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i = floor1;
|
||||
offx = x - sprite[i].x;
|
||||
offy = y - sprite[i].y;
|
||||
i = floor2;
|
||||
offx = x - floor1->x;
|
||||
offy = y - floor1->y;
|
||||
|
||||
renderDrawRoomsQ16(sprite[i].x + offx, sprite[i].y + offy, z, a.asq16(), h.asq16(), sprite[i].sectnum);
|
||||
fi.animatesprites(offx + sprite[i].x, offy + sprite[i].y, a.asbuild(), smoothratio);
|
||||
renderDrawRoomsQ16(floor2->x + offx, floor2->y + offy, z, a.asq16(), h.asq16(), floor2->sectnum);
|
||||
fi.animatesprites(offx + floor2->x, offy + floor2->y, a.asbuild(), smoothratio);
|
||||
renderDrawMasks();
|
||||
|
||||
for (j = 0; j < MAXSPRITES; j++) // restore ceiling or floor
|
||||
it.Reset(STAT_RAROR);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
if (sprite[j].picnum == 1 &&
|
||||
sprite[j].lotag == k + 2 &&
|
||||
sprite[j].hitag == sprite[floor1].hitag
|
||||
auto spr = &act->s;
|
||||
if (spr->picnum == 1 &&
|
||||
spr->lotag == k + 2 &&
|
||||
spr->hitag == floor1->hitag
|
||||
)
|
||||
{
|
||||
if (k == tag + 0)
|
||||
{
|
||||
sector[sprite[j].sectnum].floorz = tempsectorz[sprite[j].sectnum];
|
||||
sector[sprite[j].sectnum].floorpicnum = tempsectorpicnum[sprite[j].sectnum];
|
||||
sector[spr->sectnum].floorz = tempsectorz[spr->sectnum];
|
||||
sector[spr->sectnum].floorpicnum = tempsectorpicnum[spr->sectnum];
|
||||
}
|
||||
if (k == tag + 1)
|
||||
{
|
||||
sector[sprite[j].sectnum].ceilingz = tempsectorz[sprite[j].sectnum];
|
||||
sector[sprite[j].sectnum].ceilingpicnum = tempsectorpicnum[sprite[j].sectnum];
|
||||
sector[spr->sectnum].ceilingz = tempsectorz[spr->sectnum];
|
||||
sector[spr->sectnum].ceilingpicnum = tempsectorpicnum[spr->sectnum];
|
||||
}
|
||||
}// end if
|
||||
}// end for
|
||||
|
@ -170,15 +185,15 @@ void SE40_Draw(int tag, int spnum, int x, int y, int z, binangle a, fixedhoriz h
|
|||
|
||||
void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
|
||||
{
|
||||
int i, tag;
|
||||
int tag;
|
||||
if (!isRR()) tag = 40;
|
||||
else if (isRRRA()) tag = 150;
|
||||
else return;
|
||||
|
||||
StatIterator it(STAT_RAROR);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
DukeStatIterator it(STAT_RAROR);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
switch (sprite[i].lotag - tag + 40)
|
||||
switch (act->s.lotag - tag + 40)
|
||||
{
|
||||
// case 40:
|
||||
// case 41:
|
||||
|
@ -188,8 +203,8 @@ void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio)
|
|||
case 43:
|
||||
case 44:
|
||||
case 45:
|
||||
if (ps[screenpeek].cursectnum == sprite[i].sectnum)
|
||||
SE40_Draw(tag, i, x, y, z, a, h, smoothratio);
|
||||
if (ps[screenpeek].cursectnum == act->s.sectnum)
|
||||
SE40_Draw(tag, &act->s, x, y, z, a, h, smoothratio);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -243,9 +258,9 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static inline int16_t getcamspriteang(short const newowner, double const smoothratio)
|
||||
static inline int16_t getcamspriteang(DDukeActor* newOwner, double const smoothratio)
|
||||
{
|
||||
return hittype[newowner].tempang + xs_CRoundToInt(fmulscale16(((sprite[newowner].ang - hittype[newowner].tempang + 1024) & 2047) - 1024, smoothratio));
|
||||
return newOwner->tempang + xs_CRoundToInt(fmulscale16(((newOwner->s.ang - newOwner->tempang + 1024) & 2047) - 1024, smoothratio));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -258,17 +273,15 @@ void animatecamsprite(double smoothratio)
|
|||
{
|
||||
const int VIEWSCREEN_ACTIVE_DISTANCE = 8192;
|
||||
|
||||
if (camsprite < 0)
|
||||
if (camsprite == nullptr)
|
||||
return;
|
||||
|
||||
int spriteNum = camsprite;
|
||||
|
||||
auto p = &ps[screenpeek];
|
||||
auto sp = &sprite[spriteNum];
|
||||
auto sp = &camsprite->s;
|
||||
|
||||
if (p->newowner >= 0) sp->owner = p->newowner;
|
||||
if (p->newOwner != nullptr) camsprite->SetOwner(p->newOwner);
|
||||
|
||||
if (sp->owner >= 0 && dist(&sprite[p->i], sp) < VIEWSCREEN_ACTIVE_DISTANCE)
|
||||
if (camsprite->GetOwner() && dist(p->GetActor(), camsprite) < VIEWSCREEN_ACTIVE_DISTANCE)
|
||||
{
|
||||
auto tex = tileGetTexture(sp->picnum);
|
||||
TileFiles.MakeCanvas(TILE_VIEWSCR, tex->GetDisplayWidth(), tex->GetDisplayHeight());
|
||||
|
@ -278,8 +291,8 @@ void animatecamsprite(double smoothratio)
|
|||
|
||||
screen->RenderTextureView(canvas, [=](IntRect& rect)
|
||||
{
|
||||
auto camera = &sprite[sp->owner];
|
||||
auto ang = getcamspriteang(sp->owner, smoothratio);
|
||||
auto camera = &camsprite->GetOwner()->s;
|
||||
auto ang = getcamspriteang(camsprite->GetOwner(), smoothratio);
|
||||
// Note: no ROR or camera here for now - the current setup has no means to detect these things before rendering the scene itself.
|
||||
drawrooms(camera->x, camera->y, camera->z, ang, 100 + camera->shade, camera->sectnum); // why 'shade'...?
|
||||
display_mirror = 1; // should really be 'display external view'.
|
||||
|
@ -296,13 +309,17 @@ void animatecamsprite(double smoothratio)
|
|||
// RRRA's drug distortion effect
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
int DrugTimer;
|
||||
|
||||
void setdrugmode(player_struct *p, int oyrepeat)
|
||||
static int getdrugmode(player_struct *p, int oyrepeat)
|
||||
{
|
||||
if (playrunning())
|
||||
int now = I_GetBuildTime() >> 1; // this function works on a 60 fps setup.
|
||||
if (playrunning() && p->DrugMode > 0)
|
||||
{
|
||||
if (p->DrugMode > 0)
|
||||
if (now - DrugTimer > 4 || now - DrugTimer < 0) DrugTimer = now - 1;
|
||||
while (DrugTimer < now)
|
||||
{
|
||||
DrugTimer++;
|
||||
int var_8c;
|
||||
if (p->drug_stat[0] == 0)
|
||||
{
|
||||
|
@ -310,16 +327,13 @@ void setdrugmode(player_struct *p, int oyrepeat)
|
|||
var_8c = oyrepeat + p->drug_stat[1] * 5000;
|
||||
if (oyrepeat * 3 < var_8c)
|
||||
{
|
||||
renderSetAspect(oyrepeat * 3, yxaspect);
|
||||
p->drug_aspect = oyrepeat * 3;
|
||||
p->drug_stat[0] = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
renderSetAspect(var_8c, yxaspect);
|
||||
p->drug_aspect = var_8c;
|
||||
}
|
||||
setpal(p);
|
||||
}
|
||||
else if (p->drug_stat[0] == 3)
|
||||
{
|
||||
|
@ -327,18 +341,16 @@ void setdrugmode(player_struct *p, int oyrepeat)
|
|||
var_8c = oyrepeat + p->drug_stat[1] * 5000;
|
||||
if (var_8c < oyrepeat)
|
||||
{
|
||||
renderSetAspect(oyrepeat, yxaspect);
|
||||
p->DrugMode = 0;
|
||||
p->drug_stat[0] = 0;
|
||||
p->drug_stat[2] = 0;
|
||||
p->drug_stat[1] = 0;
|
||||
p->drug_aspect = oyrepeat;
|
||||
}
|
||||
else
|
||||
{
|
||||
renderSetAspect(var_8c, yxaspect);
|
||||
p->drug_aspect = var_8c;
|
||||
}
|
||||
setpal(p);
|
||||
}
|
||||
else if (p->drug_stat[0] == 2)
|
||||
{
|
||||
|
@ -349,9 +361,7 @@ void setdrugmode(player_struct *p, int oyrepeat)
|
|||
else
|
||||
{
|
||||
p->drug_stat[2]++;
|
||||
renderSetAspect(p->drug_stat[2] * 500 + oyrepeat * 3, yxaspect);
|
||||
p->drug_aspect = oyrepeat * 3 + p->drug_stat[2] * 500;
|
||||
setpal(p);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -366,17 +376,16 @@ void setdrugmode(player_struct *p, int oyrepeat)
|
|||
else
|
||||
{
|
||||
p->drug_stat[2]--;
|
||||
renderSetAspect(p->drug_stat[2] * 500 + oyrepeat * 3, yxaspect);
|
||||
p->drug_aspect = oyrepeat * 3 + p->drug_stat[2] * 500;
|
||||
setpal(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
return p->drug_aspect;
|
||||
}
|
||||
else if (p->DrugMode > 0)
|
||||
else
|
||||
{
|
||||
renderSetAspect(p->drug_aspect, yxaspect);
|
||||
setpal(p);
|
||||
DrugTimer = now;
|
||||
return oyrepeat;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,7 +398,6 @@ void setdrugmode(player_struct *p, int oyrepeat)
|
|||
static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixedhoriz choriz, int sect, int smoothratio)
|
||||
{
|
||||
short gs, tgsect, geosect, geoid = 0;
|
||||
int spr;
|
||||
renderDrawRoomsQ16(cposx, cposy, cposz, cang.asq16(), choriz.asq16(), sect);
|
||||
fi.animatesprites(cposx, cposy, cang.asbuild(), smoothratio);
|
||||
renderDrawMasks();
|
||||
|
@ -397,11 +405,11 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
|
|||
{
|
||||
tgsect = geosector[gs];
|
||||
|
||||
SectIterator it(tgsect);
|
||||
while ((spr = it.NextIndex()) >= 0)
|
||||
DukeSectIterator it(tgsect);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
changespritesect((short)spr, geosectorwarp[gs]);
|
||||
setsprite((short)spr, sprite[spr].x -= geox[gs], sprite[spr].y -= geoy[gs], sprite[spr].z);
|
||||
changespritesect(act, geosectorwarp[gs]);
|
||||
setsprite(act, act->s.x -= geox[gs], act->s.y -= geoy[gs], act->s.z);
|
||||
}
|
||||
if (geosector[gs] == sect)
|
||||
{
|
||||
|
@ -417,11 +425,11 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
|
|||
for (gs = 0; gs < geocnt; gs++)
|
||||
{
|
||||
tgsect = geosectorwarp[gs];
|
||||
SectIterator it(tgsect);
|
||||
while ((spr = it.NextIndex()) >= 0)
|
||||
DukeSectIterator it(tgsect);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
changespritesect((short)spr, geosector[gs]);
|
||||
setsprite((short)spr, sprite[spr].x += geox[gs], sprite[spr].y += geoy[gs], sprite[spr].z);
|
||||
changespritesect(act, geosector[gs]);
|
||||
setsprite(act, act->s.x += geox[gs], act->s.y += geoy[gs], act->s.z);
|
||||
}
|
||||
}
|
||||
fi.animatesprites(cposx, cposy, cang.asbuild(), smoothratio);
|
||||
|
@ -429,11 +437,11 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
|
|||
for (gs = 0; gs < geocnt; gs++)
|
||||
{
|
||||
tgsect = geosector[gs];
|
||||
SectIterator it(tgsect);
|
||||
while ((spr = it.NextIndex()) >= 0)
|
||||
DukeSectIterator it(tgsect);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
changespritesect((short)spr, geosectorwarp2[gs]);
|
||||
setsprite((short)spr, sprite[spr].x -= geox2[gs], sprite[spr].y -= geoy2[gs], sprite[spr].z);
|
||||
changespritesect(act, geosectorwarp2[gs]);
|
||||
setsprite(act, act->s.x -= geox2[gs], act->s.y -= geoy2[gs], act->s.z);
|
||||
}
|
||||
if (geosector[gs] == sect)
|
||||
{
|
||||
|
@ -449,11 +457,11 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed
|
|||
for (gs = 0; gs < geocnt; gs++)
|
||||
{
|
||||
tgsect = geosectorwarp2[gs];
|
||||
SectIterator it(tgsect);
|
||||
while ((spr = it.NextIndex()) >= 0)
|
||||
DukeSectIterator it(tgsect);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
changespritesect((short)spr, geosector[gs]);
|
||||
setsprite((short)spr, sprite[spr].x += geox2[gs], sprite[spr].y += geoy2[gs], sprite[spr].z);
|
||||
changespritesect(act, geosector[gs]);
|
||||
setsprite(act, act->s.x += geox2[gs], act->s.y += geoy2[gs], act->s.z);
|
||||
}
|
||||
}
|
||||
fi.animatesprites(cposx, cposy, cang.asbuild(), smoothratio);
|
||||
|
@ -500,19 +508,16 @@ void displayrooms(int snum, double smoothratio)
|
|||
setgamepalette(BASEPAL);
|
||||
animatecamsprite(smoothratio);
|
||||
|
||||
// The camera texture must be rendered with the base palette, so this is the only place where the current global palette can be set.
|
||||
// The setting here will be carried over to the rendering of the weapon sprites, but other 2D content will always default to the main palette.
|
||||
setgamepalette(p->palette);
|
||||
if (ud.camerasprite >= 0)
|
||||
if (ud.cameraactor)
|
||||
{
|
||||
spritetype* s;
|
||||
|
||||
s = &sprite[ud.camerasprite];
|
||||
s = &ud.cameraactor->s;
|
||||
|
||||
if (s->yvel < 0) s->yvel = -100;
|
||||
else if (s->yvel > 199) s->yvel = 300;
|
||||
|
||||
cang = buildang(hittype[ud.camerasprite].tempang + xs_CRoundToInt(fmulscale16(((s->ang + 1024 - hittype[ud.camerasprite].tempang) & 2047) - 1024, smoothratio)));
|
||||
cang = buildang(ud.cameraactor->tempang + xs_CRoundToInt(fmulscale16(((s->ang + 1024 - ud.cameraactor->tempang) & 2047) - 1024, smoothratio)));
|
||||
|
||||
auto bh = buildhoriz(s->yvel);
|
||||
se40code(s->x, s->y, s->z, cang, bh, smoothratio);
|
||||
|
@ -523,18 +528,14 @@ void displayrooms(int snum, double smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
int i = divscale22(1, isRR() ? 64 : sprite[p->i].yrepeat + 28);
|
||||
fixed_t dang = IntToFixed(1024);
|
||||
if (!isRRRA() || !p->DrugMode)
|
||||
{
|
||||
// Fixme: This should get the aspect ratio from the backend, not the current viewport size.
|
||||
int viewingRange = xs_CRoundToInt(double(i) * tan(r_fov * (pi::pi() / 360.)));
|
||||
renderSetAspect(mulscale16(viewingRange, viewingrange), yxaspect);
|
||||
}
|
||||
else
|
||||
{
|
||||
setdrugmode(p, i);
|
||||
}
|
||||
// Fixme: This should get the aspect ratio from the backend, not the current viewport size.
|
||||
int i = divscale22(1, isRR() ? 64 : p->GetActor()->s.yrepeat + 28);
|
||||
int viewingaspect = !isRRRA() || !p->DrugMode ? xs_CRoundToInt(double(i) * tan(r_fov * (pi::pi() / 360.))) : getdrugmode(p, i);
|
||||
renderSetAspect(mulscale16(viewingaspect, viewingrange), yxaspect);
|
||||
|
||||
// The camera texture must be rendered with the base palette, so this is the only place where the current global palette can be set.
|
||||
// The setting here will be carried over to the rendering of the weapon sprites, but other 2D content will always default to the main palette.
|
||||
setgamepalette(setpal(p));
|
||||
|
||||
// set screen rotation.
|
||||
rotscrnang = !cl_syncinput ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(smoothratio);
|
||||
|
@ -577,14 +578,15 @@ void displayrooms(int snum, double smoothratio)
|
|||
}
|
||||
}
|
||||
|
||||
if (p->newowner >= 0)
|
||||
if (p->newOwner != nullptr)
|
||||
{
|
||||
cang = buildang(getcamspriteang(p->newowner, smoothratio));
|
||||
choriz = buildhoriz(sprite[p->newowner].shade);
|
||||
cposx = sprite[p->newowner].pos.x;
|
||||
cposy = sprite[p->newowner].pos.y;
|
||||
cposz = sprite[p->newowner].pos.z;
|
||||
sect = sprite[p->newowner].sectnum;
|
||||
auto spr = &p->newOwner->s;
|
||||
cang = buildang(getcamspriteang(p->newOwner, smoothratio));
|
||||
choriz = buildhoriz(spr->shade);
|
||||
cposx = spr->pos.x;
|
||||
cposy = spr->pos.y;
|
||||
cposz = spr->pos.z;
|
||||
sect = spr->sectnum;
|
||||
rotscrnang = buildlook(0);
|
||||
smoothratio = MaxSmoothRatio;
|
||||
}
|
||||
|
@ -606,8 +608,8 @@ void displayrooms(int snum, double smoothratio)
|
|||
// do screen rotation.
|
||||
renderSetRollAngle(rotscrnang.asbam() / (double)(BAMUNIT));
|
||||
|
||||
cz = hittype[p->i].ceilingz;
|
||||
fz = hittype[p->i].floorz;
|
||||
cz = p->GetActor()->ceilingz;
|
||||
fz = p->GetActor()->floorz;
|
||||
|
||||
if (earthquaketime > 0 && p->on_ground == 1)
|
||||
{
|
||||
|
@ -615,9 +617,9 @@ void displayrooms(int snum, double smoothratio)
|
|||
cang += buildang((2 - ((earthquaketime) & 2)) << 2);
|
||||
}
|
||||
|
||||
if (sprite[p->i].pal == 1) cposz -= (18 << 8);
|
||||
if (p->GetActor()->s.pal == 1) cposz -= (18 << 8);
|
||||
|
||||
else if (p->spritebridge == 0 && p->newowner < 0)
|
||||
else if (p->spritebridge == 0 && p->newOwner == nullptr)
|
||||
{
|
||||
if (cposz < (p->truecz + (4 << 8))) cposz = cz + (4 << 8);
|
||||
else if (cposz > (p->truefz - (4 << 8))) cposz = fz - (4 << 8);
|
||||
|
|
|
@ -30,6 +30,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
#include "mapinfo.h"
|
||||
#include "duke3d.h"
|
||||
#include "gamestate.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
extern FixedBitArray<MAXSPRITES> activeSprites;
|
||||
|
||||
|
@ -60,22 +61,22 @@ static void recreateinterpolations()
|
|||
{
|
||||
numinterpolations = 0;
|
||||
|
||||
int k;
|
||||
StatIterator it(STAT_EFFECTOR);
|
||||
while ((k = it.NextIndex()) >= 0)
|
||||
DukeStatIterator it(STAT_EFFECTOR);
|
||||
while (auto k = it.Next())
|
||||
{
|
||||
switch (sprite[k].lotag)
|
||||
auto sectnum = k->s.sectnum;
|
||||
switch (k->s.lotag)
|
||||
{
|
||||
case SE_31_FLOOR_RISE_FALL:
|
||||
setinterpolation(§or[sprite[k].sectnum].floorz);
|
||||
setinterpolation(§or[sectnum].floorz);
|
||||
break;
|
||||
case SE_32_CEILING_RISE_FALL:
|
||||
setinterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
setinterpolation(§or[sectnum].ceilingz);
|
||||
break;
|
||||
case SE_17_WARP_ELEVATOR:
|
||||
case SE_25_PISTON:
|
||||
setinterpolation(§or[sprite[k].sectnum].floorz);
|
||||
setinterpolation(§or[sprite[k].sectnum].ceilingz);
|
||||
setinterpolation(§or[sectnum].floorz);
|
||||
setinterpolation(§or[sectnum].ceilingz);
|
||||
break;
|
||||
case SE_0_ROTATING_SECTOR:
|
||||
case SE_5_BOSS:
|
||||
|
@ -86,7 +87,7 @@ static void recreateinterpolations()
|
|||
case SE_16_REACTOR:
|
||||
case SE_26:
|
||||
case SE_30_TWO_WAY_TRAIN:
|
||||
setsectinterpolate(k);
|
||||
setsectinterpolate(sectnum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +133,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
|||
("angle", w.angle)
|
||||
("horizon", w.horizon)
|
||||
("gotweapon", w.gotweapon)
|
||||
("palette", w.palette)
|
||||
("pals", w.pals)
|
||||
("fricx", w.fric.x)
|
||||
("fricy", w.fric.y)
|
||||
|
@ -172,7 +172,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
|||
("tipincs", w.tipincs)
|
||||
("wantweaponfire", w.wantweaponfire)
|
||||
("holoduke_amount", w.holoduke_amount)
|
||||
("newowner", w.newowner)
|
||||
("newowner", w.newOwner)
|
||||
("hurt_delay", w.hurt_delay)
|
||||
("hbomb_hold_delay", w.hbomb_hold_delay)
|
||||
("jumping_counter", w.jumping_counter)
|
||||
|
@ -291,7 +291,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
|||
("moto_on_oil", w.moto_on_oil)
|
||||
("moto_on_mud", w.moto_on_mud)
|
||||
// new stuff
|
||||
("crouch_toggle", w.crouch_toggle)
|
||||
("actions", w.sync.actions)
|
||||
.EndObject();
|
||||
|
||||
|
@ -305,7 +304,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
|||
w.okickback_pic = w.kickback_pic;
|
||||
w.orandom_club_frame = w.random_club_frame;
|
||||
w.ohard_landing = w.hard_landing;
|
||||
w.sync.actions &= SB_CENTERVIEW; // this is the only bit we need to preserve.
|
||||
w.sync.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve.
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
@ -335,6 +334,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, weaponhit& w, weap
|
|||
("bposy", w.bposy, def->bposy)
|
||||
("bposz", w.bposz, def->bposz)
|
||||
("aflags", w.aflags, def->aflags)
|
||||
("saved_ammo", w.saved_ammo, def->saved_ammo)
|
||||
("temp_actor", w.temp_actor, def->temp_actor)
|
||||
("seek_actor", w.seek_actor, def->seek_actor)
|
||||
.Array("temp_data", w.temp_data, def->temp_data, 6)
|
||||
.EndObject();
|
||||
}
|
||||
|
@ -375,6 +377,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
("marker", ud.marker)
|
||||
("ffire", ud.ffire)
|
||||
("levelclock", ud.levelclock)
|
||||
("bomb_tag", ud.bomb_tag)
|
||||
|
||||
.Array("sectorextra", sectorextra, numsectors)
|
||||
("rtsplaying", rtsplaying)
|
||||
|
@ -471,7 +474,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
cameraclock = 0;
|
||||
ps[myconnectindex].over_shoulder_on = 1;
|
||||
}
|
||||
setpal(&ps[myconnectindex]);
|
||||
|
||||
memset(gotpic, 0, sizeof(gotpic));
|
||||
if (isRR()) cacheit_r(); else cacheit_d();
|
||||
|
|
|
@ -86,9 +86,9 @@ void DDukeCommonStatusBar::displayfragbar(void)
|
|||
|
||||
for (i = connecthead; i >= 0; i = connectpoint2[i])
|
||||
{
|
||||
m initext(21 + (73 * (i & 3)), 2 + ((i & 28) << 1), &ud.user_name[i][0], sprite[ps[i].i].pal, 2 + 8 + 16 + 128);
|
||||
m initext(21 + (73 * (i & 3)), 2 + ((i & 28) << 1), &ud.user_name[i][0], ps[i].GetActor()->s.pal, 2 + 8 + 16 + 128);
|
||||
sprintf(tempbuf, "%d", ps[i].frag - ps[i].fraggedself);
|
||||
m initext(17 + 50 + (73 * (i & 3)), 2 + ((i & 28) << 1), tempbuf, sprite[ps[i].i].pal, 2 + 8 + 16 + 128);
|
||||
m initext(17 + 50 + (73 * (i & 3)), 2 + ((i & 28) << 1), tempbuf, ps[i].GetActor()->s.pal, 2 + 8 + 16 + 128);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -42,6 +42,7 @@ source as it is released.
|
|||
#include "v_draw.h"
|
||||
#include "names_d.h"
|
||||
#include "texturemanager.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -68,7 +69,7 @@ public:
|
|||
SetSize(tilesiz[TILE_BOTTOMSTATUSBAR].y);
|
||||
scale = 1;
|
||||
|
||||
ammo_sprites = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO, RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO, TRIPBOMBSPRITE, FREEZEAMMO + 1, HBOMBAMMO, GROWAMMO/*, FLAMETHROWERAMMO + 1*/ };
|
||||
ammo_sprites = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO, RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO, TRIPBOMBSPRITE, FREEZEAMMO + 1, HBOMBAMMO, GROWAMMO, FLAMETHROWERAMMO + 1 };
|
||||
item_icons = { 0, FIRSTAID_ICON, STEROIDS_ICON, HOLODUKE_ICON, JETPACK_ICON, HEAT_ICON, AIRTANK_ICON, BOOT_ICON };
|
||||
}
|
||||
|
||||
|
@ -104,7 +105,7 @@ public:
|
|||
int GetMoraleOrShield(struct player_struct *p, int snum)
|
||||
{
|
||||
// special handling for WW2GI
|
||||
int lAmount = GetGameVar("PLR_MORALE", -1, p->i, snum);
|
||||
int lAmount = GetGameVar("PLR_MORALE", -1, p->GetActor(), snum);
|
||||
if (lAmount == -1) lAmount = p->shield_amount;
|
||||
return lAmount;
|
||||
}
|
||||
|
@ -131,7 +132,7 @@ public:
|
|||
imgScale = baseScale / img->GetDisplayHeight();
|
||||
DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale);
|
||||
|
||||
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (ud.levelclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2))
|
||||
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (ud.levelclock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
|
||||
{
|
||||
int s = -8;
|
||||
if (althud_flashing && p->last_extra > max_player_health)
|
||||
|
@ -233,7 +234,7 @@ public:
|
|||
// health
|
||||
//
|
||||
DrawGraphic(tileGetTexture(HEALTHBOX), 5, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
|
||||
int health = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
|
||||
int health = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
|
||||
FStringf format("%d", health);
|
||||
SBar_DrawString(this, digiFont, format, 20, -digiFont->mFont->GetHeight() * scale - 3, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
|
||||
|
||||
|
@ -409,7 +410,7 @@ public:
|
|||
}
|
||||
DrawWeaponAmounts(p, 96, top + 15.5);
|
||||
|
||||
int num = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
|
||||
int num = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
|
||||
format.Format("%d", num);
|
||||
SBar_DrawString(this, digiFont, format, 31, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1);
|
||||
format.Format("%d", GetMoraleOrShield(p, snum));
|
||||
|
|
|
@ -34,6 +34,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
#include "v_draw.h"
|
||||
#include "names_r.h"
|
||||
#include "texturemanager.h"
|
||||
#include "dukeactor.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -107,7 +108,7 @@ public:
|
|||
imgScale = baseScale / img->GetDisplayHeight();
|
||||
DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale);
|
||||
|
||||
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (ud.levelclock & 32) || (sprite[p->i].pal == 1 && p->last_extra < 2))
|
||||
if (!althud_flashing || p->last_extra > (max_player_health >> 2) || (ud.levelclock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2))
|
||||
{
|
||||
int s = -8;
|
||||
if (althud_flashing && p->last_extra > max_player_health)
|
||||
|
@ -227,7 +228,7 @@ public:
|
|||
// health
|
||||
//
|
||||
DrawGraphic(tileGetTexture(HEALTHBOX), 2, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale);
|
||||
int health = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
|
||||
int health = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
|
||||
FStringf format("%d", health);
|
||||
SBar_DrawString(this, digiFont, format, 21.5, -digiFont->mFont->GetHeight() * scale - 5.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
|
||||
|
||||
|
@ -376,7 +377,7 @@ public:
|
|||
if (p->keys[1]) DrawGraphic(key, 145, top + 21, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 0));
|
||||
}
|
||||
|
||||
int num = (sprite[p->i].pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
|
||||
int num = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra;
|
||||
format.Format("%d", num);
|
||||
SBar_DrawString(this, digiFont, format, 66.5, top + 16, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -39,6 +39,7 @@ source as it is released.
|
|||
#include "g_input.h"
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "dukeactor.h"
|
||||
#include "raze_music.h"
|
||||
#include "mapinfo.h"
|
||||
#include "raze_sound.h"
|
||||
|
@ -52,9 +53,21 @@ CVAR(Bool, wt_commentary, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
// These are needed until real objects can be used for actors.
|
||||
inline void* sndActor(DDukeActor* actor)
|
||||
{
|
||||
return actor ? &actor->s : nullptr;
|
||||
}
|
||||
|
||||
inline DDukeActor* getSndActor(const void* source)
|
||||
{
|
||||
// transitional conversation voodoo
|
||||
return source ? &hittype[((spritetype*)source) - sprite] : nullptr;
|
||||
}
|
||||
|
||||
TArray<FString> specialmusic;
|
||||
static FSoundID currentCommentarySound;
|
||||
static int currentCommentarySprite;
|
||||
static DDukeActor* currentCommentarySprite; // todo: GC this once actors become objects
|
||||
|
||||
|
||||
class DukeSoundEngine : public SoundEngine
|
||||
|
@ -90,7 +103,7 @@ public:
|
|||
{
|
||||
UnloadSound(schan->SoundID);
|
||||
currentCommentarySound = 0;
|
||||
sprite[currentCommentarySprite].picnum = DEVELOPERCOMMENTARY;
|
||||
currentCommentarySprite->s.picnum = DEVELOPERCOMMENTARY;
|
||||
I_SetRelativeVolume(1.0f);
|
||||
}
|
||||
SoundEngine::SoundDone(schan);
|
||||
|
@ -220,9 +233,9 @@ int S_DefineSound(unsigned index, const char *filename, int minpitch, int maxpit
|
|||
}
|
||||
|
||||
|
||||
inline bool S_IsAmbientSFX(int spriteNum)
|
||||
inline bool S_IsAmbientSFX(DDukeActor* actor)
|
||||
{
|
||||
return (sprite[spriteNum].picnum == MUSICANDSFX && sprite[spriteNum].lotag < 999);
|
||||
return (actor->s.picnum == MUSICANDSFX && actor->s.lotag < 999);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -231,13 +244,13 @@ inline bool S_IsAmbientSFX(int spriteNum)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static int GetPositionInfo(int spriteNum, int soundNum, int sectNum,
|
||||
static int GetPositionInfo(DDukeActor* actor, int soundNum, int sectNum,
|
||||
const vec3_t *cam, const vec3_t *pos, int *distPtr, FVector3 *sndPos)
|
||||
{
|
||||
// There's a lot of hackery going on here that could be mapped to rolloff and attenuation parameters.
|
||||
// However, ultimately rolloff would also just reposition the sound source so this can remain as it is.
|
||||
|
||||
auto sp = &sprite[spriteNum];
|
||||
auto sp = &actor->s;
|
||||
int orgsndist = 0, sndang = 0, sndist = 0, explosion = 0;
|
||||
auto const* snd = soundEngine->GetUserData(soundNum + 1);
|
||||
int userflags = snd ? snd[kFlags] : 0;
|
||||
|
@ -293,7 +306,7 @@ static int GetPositionInfo(int spriteNum, int soundNum, int sectNum,
|
|||
|
||||
void S_GetCamera(vec3_t** c, int32_t* ca, int32_t* cs)
|
||||
{
|
||||
if (ud.camerasprite == -1)
|
||||
if (ud.cameraactor == nullptr)
|
||||
{
|
||||
auto p = &ps[screenpeek];
|
||||
if (c) *c = &p->pos;
|
||||
|
@ -302,9 +315,9 @@ void S_GetCamera(vec3_t** c, int32_t* ca, int32_t* cs)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (c) *c = &sprite[ud.camerasprite].pos;
|
||||
if (cs) *cs = sprite[ud.camerasprite].sectnum;
|
||||
if (ca) *ca = sprite[ud.camerasprite].ang;
|
||||
if (c) *c = &ud.cameraactor->s.pos;
|
||||
if (cs) *cs = ud.cameraactor->s.sectnum;
|
||||
if (ca) *ca = ud.cameraactor->s.ang;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,11 +347,12 @@ void DukeSoundEngine::CalcPosVel(int type, const void* source, const float pt[3]
|
|||
}
|
||||
else if (type == SOURCE_Actor)
|
||||
{
|
||||
auto actor = (spritetype*)source;
|
||||
auto aactor = getSndActor(source);
|
||||
auto actor = aactor ? &aactor->s : nullptr;
|
||||
assert(actor != nullptr);
|
||||
if (actor != nullptr)
|
||||
{
|
||||
GetPositionInfo(int(actor - sprite), chanSound - 1, camsect, campos, &actor->pos, nullptr, pos);
|
||||
GetPositionInfo(aactor, chanSound - 1, camsect, campos, &actor->pos, nullptr, pos);
|
||||
/*
|
||||
if (vel) // DN3D does not properly maintain this.
|
||||
{
|
||||
|
@ -395,7 +409,7 @@ void GameInterface::UpdateSounds(void)
|
|||
listener.Environment = nullptr;
|
||||
listener.valid = false;
|
||||
}
|
||||
listener.ListenerObject = ud.camerasprite == -1 ? nullptr : &sprite[ud.camerasprite];
|
||||
listener.ListenerObject = ud.cameraactor == nullptr ? nullptr : &ud.cameraactor->s;
|
||||
soundEngine->SetListener(listener);
|
||||
}
|
||||
|
||||
|
@ -406,21 +420,19 @@ void GameInterface::UpdateSounds(void)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, EChanFlags flags)
|
||||
int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t* pos, int channel, EChanFlags flags)
|
||||
{
|
||||
if (sndnum == GENERIC_AMBIENCE1 || sndnum == DUMPSTER_MOVE)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
auto const pl = &ps[myconnectindex];
|
||||
if (!soundEngine->isValidSoundId(sndnum+1) || !SoundEnabled() || (unsigned)spriteNum >= MAXSPRITES || !playrunning() ||
|
||||
if (!soundEngine->isValidSoundId(sndnum+1) || !SoundEnabled() || actor == nullptr || !playrunning() ||
|
||||
(pl->timebeforeexit > 0 && pl->timebeforeexit <= REALGAMETICSPERSEC * 3)) return -1;
|
||||
|
||||
sndnum = GetReplacementSound(sndnum);
|
||||
int userflags = S_GetUserFlags(sndnum);
|
||||
|
||||
auto sp = &sprite[spriteNum];
|
||||
|
||||
if ((userflags & (SF_DTAG | SF_GLOBAL)) == SF_DTAG)
|
||||
{
|
||||
// Duke-Tag sound does not play in 3D.
|
||||
|
@ -429,7 +441,7 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh
|
|||
|
||||
if (userflags & SF_TALK)
|
||||
{
|
||||
if (snd_speech == 0 || (ud.multimode > 1 && sp->picnum == TILE_APLAYER && sp->yvel != screenpeek && ud.coop != 1)) return -1;
|
||||
if (snd_speech == 0 || (ud.multimode > 1 && actor->s.picnum == TILE_APLAYER && actor->s.yvel != screenpeek && ud.coop != 1)) return -1;
|
||||
bool foundone = soundEngine->EnumerateChannels([&](FSoundChan* chan)
|
||||
{
|
||||
auto sid = chan->OrgID;
|
||||
|
@ -443,8 +455,7 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh
|
|||
// Fixes a problem with quake06.voc in E3L4.
|
||||
if (ud.multimode == 1)
|
||||
{
|
||||
spriteNum = pl->i;
|
||||
auto sp = &sprite[spriteNum];
|
||||
actor = pl->GetActor();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,7 +466,7 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh
|
|||
int32_t camsect;
|
||||
|
||||
S_GetCamera(&campos, nullptr, &camsect);
|
||||
GetPositionInfo(spriteNum, sndnum, camsect, campos, pos, &sndist, &sndpos);
|
||||
GetPositionInfo(actor, sndnum, camsect, campos, pos, &sndist, &sndpos);
|
||||
int pitch = S_GetPitch(sndnum);
|
||||
|
||||
bool explosion = ((userflags & (SF_GLOBAL | SF_DTAG)) == (SF_GLOBAL | SF_DTAG)) || ((sndnum == PIPEBOMB_EXPLODE || sndnum == LASERTRIP_EXPLODE || sndnum == RPG_EXPLODE));
|
||||
|
@ -468,7 +479,7 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh
|
|||
}
|
||||
else
|
||||
{
|
||||
if (sndist > 32767 && sp->picnum != MUSICANDSFX && (userflags & (SF_LOOP | SF_MSFX)) == 0)
|
||||
if (sndist > 32767 && actor->s.picnum != MUSICANDSFX && (userflags & (SF_LOOP | SF_MSFX)) == 0)
|
||||
return -1;
|
||||
|
||||
if (underwater && (userflags & SF_TALK) == 0)
|
||||
|
@ -476,8 +487,8 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh
|
|||
}
|
||||
|
||||
bool is_playing = soundEngine->GetSoundPlayingInfo(SOURCE_Any, nullptr, sndnum+1);
|
||||
if (is_playing && sp->picnum != MUSICANDSFX)
|
||||
S_StopSound(sndnum, spriteNum);
|
||||
if (is_playing && actor->s.picnum != MUSICANDSFX)
|
||||
S_StopSound(sndnum, actor);
|
||||
|
||||
int const repeatp = (userflags & SF_LOOP);
|
||||
|
||||
|
@ -494,7 +505,7 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh
|
|||
else attenuation = (userflags & (SF_GLOBAL | SF_DTAG)) == SF_GLOBAL ? ATTN_NONE : ATTN_NORM;
|
||||
|
||||
if (userflags & SF_LOOP) flags |= CHANF_LOOP;
|
||||
auto chan = soundEngine->StartSound(SOURCE_Actor, &sprite[spriteNum], &sndpos, CHAN_AUTO, flags, sndnum+1, attenuation == ATTN_NONE? 0.8f : 1.f, attenuation, nullptr, S_ConvertPitch(pitch));
|
||||
auto chan = soundEngine->StartSound(SOURCE_Actor, sndActor(actor), &sndpos, CHAN_AUTO, flags, sndnum+1, attenuation == ATTN_NONE? 0.8f : 1.f, attenuation, nullptr, S_ConvertPitch(pitch));
|
||||
return chan ? 0 : -1;
|
||||
}
|
||||
|
||||
|
@ -527,51 +538,46 @@ int S_PlaySound(int sndnum, int channel, EChanFlags flags, float vol)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int S_PlayActorSound(int soundNum, int spriteNum, int channel, EChanFlags flags)
|
||||
int S_PlayActorSound(int soundNum, DDukeActor* actor, int channel, EChanFlags flags)
|
||||
{
|
||||
return (unsigned)spriteNum >= MAXSPRITES ? S_PlaySound(soundNum, channel, flags) :
|
||||
S_PlaySound3D(soundNum, spriteNum, &sprite[spriteNum].pos, channel, flags);
|
||||
return (actor == nullptr ? S_PlaySound(soundNum, channel, flags) :
|
||||
S_PlaySound3D(soundNum, actor, &actor->s.pos, channel, flags));
|
||||
}
|
||||
|
||||
void S_RelinkActorSound(int from, int to)
|
||||
void S_RelinkActorSound(DDukeActor* from, DDukeActor* to)
|
||||
{
|
||||
FVector3 pos = GetSoundPos(&sprite[from].pos);
|
||||
soundEngine->RelinkSound(SOURCE_Actor, &sprite[from], to == -1 ? nullptr : &sprite[to], &pos);
|
||||
FVector3 pos = GetSoundPos(&from->s.pos);
|
||||
soundEngine->RelinkSound(SOURCE_Actor, sndActor(from), sndActor(to), &pos);
|
||||
}
|
||||
|
||||
void S_StopSound(int sndNum, int sprNum, int channel)
|
||||
void S_StopSound(int sndNum, DDukeActor* actor, int channel)
|
||||
{
|
||||
if (sprNum < -1 || sprNum >= MAXSPRITES) return;
|
||||
|
||||
sndNum = GetReplacementSound(sndNum);
|
||||
|
||||
|
||||
if (sprNum == -1) soundEngine->StopSoundID(sndNum+1);
|
||||
if (!actor) soundEngine->StopSoundID(sndNum+1);
|
||||
else
|
||||
{
|
||||
if (channel == -1) soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], -1, sndNum + 1);
|
||||
else soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], channel, -1);
|
||||
if (channel == -1) soundEngine->StopSound(SOURCE_Actor, sndActor(actor), -1, sndNum + 1);
|
||||
else soundEngine->StopSound(SOURCE_Actor, actor, channel, -1);
|
||||
|
||||
// StopSound kills the actor reference so this cannot be delayed until ChannelEnded gets called. At that point the actor may also not be valid anymore.
|
||||
if (S_IsAmbientSFX(sprNum) && sector[sprite[sprNum].sectnum].lotag < 3) // ST_2_UNDERWATER
|
||||
hittype[sprNum].temp_data[0] = 0;
|
||||
if (S_IsAmbientSFX(actor) && sector[actor->s.sectnum].lotag < 3) // ST_2_UNDERWATER
|
||||
actor->temp_data[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset)
|
||||
void S_ChangeSoundPitch(int soundNum, DDukeActor* actor, int pitchoffset)
|
||||
{
|
||||
if (spriteNum < -1 || spriteNum >= MAXSPRITES) return;
|
||||
|
||||
soundNum = GetReplacementSound(soundNum);
|
||||
|
||||
double expitch = pow(2, pitchoffset / 1200.); // I hope I got this right that ASS uses a linear scale where 1200 is a full octave.
|
||||
if (spriteNum == -1)
|
||||
if (!actor)
|
||||
{
|
||||
soundEngine->ChangeSoundPitch(SOURCE_Unattached, nullptr, CHAN_AUTO, expitch, soundNum+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
soundEngine->ChangeSoundPitch(SOURCE_Actor, &sprite[spriteNum], CHAN_AUTO, expitch, soundNum+1);
|
||||
soundEngine->ChangeSoundPitch(SOURCE_Actor, sndActor(actor), CHAN_AUTO, expitch, soundNum+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -581,20 +587,19 @@ void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int S_CheckActorSoundPlaying(int spriteNum, int soundNum, int channel)
|
||||
int S_CheckActorSoundPlaying(DDukeActor* actor, int soundNum, int channel)
|
||||
{
|
||||
soundNum = GetReplacementSound(soundNum);
|
||||
|
||||
if (spriteNum == -1) return soundEngine->GetSoundPlayingInfo(SOURCE_Any, nullptr, soundNum+1);
|
||||
if ((unsigned)spriteNum >= MAXSPRITES) return false;
|
||||
return soundEngine->IsSourcePlayingSomething(SOURCE_Actor, &sprite[spriteNum], channel, soundNum+1);
|
||||
if (actor == nullptr) return soundEngine->GetSoundPlayingInfo(SOURCE_Any, nullptr, soundNum+1);
|
||||
return soundEngine->IsSourcePlayingSomething(SOURCE_Actor, sndActor(actor), channel, soundNum+1);
|
||||
}
|
||||
|
||||
// Check if actor <i> is playing any sound.
|
||||
int S_CheckAnyActorSoundPlaying(int spriteNum)
|
||||
int S_CheckAnyActorSoundPlaying(DDukeActor* actor)
|
||||
{
|
||||
if ((unsigned)spriteNum >= MAXSPRITES) return false;
|
||||
return soundEngine->IsSourcePlayingSomething(SOURCE_Actor, &sprite[spriteNum], CHAN_AUTO, 0);
|
||||
if (!actor) return false;
|
||||
return soundEngine->IsSourcePlayingSomething(SOURCE_Actor, sndActor(actor), CHAN_AUTO, 0);
|
||||
}
|
||||
|
||||
int S_CheckSoundPlaying(int soundNum)
|
||||
|
@ -815,7 +820,7 @@ void StopCommentary()
|
|||
}
|
||||
}
|
||||
|
||||
bool StartCommentary(int tag, int sprnum)
|
||||
bool StartCommentary(int tag, DDukeActor* actor)
|
||||
{
|
||||
if (wt_commentary && Commentaries.Size() > tag && Commentaries[tag].IsNotEmpty())
|
||||
{
|
||||
|
@ -833,7 +838,7 @@ bool StartCommentary(int tag, int sprnum)
|
|||
StopCommentary();
|
||||
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_VOICE, CHANF_UI | CHANF_TRANSIENT | CHANF_OVERLAP, id, 1.f, 0.f);
|
||||
currentCommentarySound = id;
|
||||
currentCommentarySprite = sprnum;
|
||||
currentCommentarySprite = actor;
|
||||
I_SetRelativeVolume(0.25f);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -40,19 +40,19 @@ int S_DefineSound(unsigned index, const char* filename, int ps, int pe, int pr,
|
|||
void S_WorldTourMappingsForOldSounds();
|
||||
|
||||
int S_PlaySound(int num, int channel = CHAN_AUTO, EChanFlags flags = 0, float vol =0.8f);
|
||||
int S_PlaySound3D(int num, int spriteNum, const vec3_t* pos, int channel = CHAN_AUTO, EChanFlags flags = 0);
|
||||
int S_PlayActorSound(int soundNum, int spriteNum, int channel = CHAN_AUTO, EChanFlags flags = 0);
|
||||
void S_RelinkActorSound(int from, int to);
|
||||
int S_PlaySound3D(int num, DDukeActor* spriteNum, const vec3_t* pos, int channel = CHAN_AUTO, EChanFlags flags = 0);
|
||||
int S_PlayActorSound(int soundNum, DDukeActor* spriteNum, int channel = CHAN_AUTO, EChanFlags flags = 0);
|
||||
void S_RelinkActorSound(DDukeActor* from, DDukeActor* to);
|
||||
void S_MenuSound(void);
|
||||
|
||||
void S_StopSound(int sndNum, int sprNum = -1, int flags = -1);
|
||||
void S_StopSound(int sndNum, DDukeActor* spr = nullptr, int flags = -1);
|
||||
|
||||
int S_CheckSoundPlaying(int soundNum);
|
||||
inline int S_CheckSoundPlaying(int sprnum, int soundNum) { return S_CheckSoundPlaying(soundNum); }
|
||||
int S_CheckActorSoundPlaying(int spriteNum, int soundNum, int channel = 0);
|
||||
int S_CheckAnyActorSoundPlaying(int spriteNum);
|
||||
int S_CheckActorSoundPlaying(DDukeActor* spriteNum, int soundNum, int channel = 0);
|
||||
int S_CheckAnyActorSoundPlaying(DDukeActor* spriteNum);
|
||||
|
||||
void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset);
|
||||
void S_ChangeSoundPitch(int soundNum, DDukeActor* spriteNum, int pitchoffset);
|
||||
int S_GetUserFlags(int sndnum);
|
||||
|
||||
inline bool S_IsSoundValid(int num)
|
||||
|
@ -72,7 +72,7 @@ void S_ContinueLevelMusic(void);
|
|||
void S_ParseDeveloperCommentary();
|
||||
|
||||
void StopCommentary();
|
||||
bool StartCommentary(int tag, int sprnum);
|
||||
bool StartCommentary(int tag, DDukeActor* sprnum);
|
||||
|
||||
extern TArray<FString> specialmusic;
|
||||
|
||||
|
|
|
@ -48,11 +48,8 @@ BEGIN_DUKE_NS
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, short s_ow, signed char s_ss)
|
||||
DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, DDukeActor* s_ow, signed char s_ss)
|
||||
{
|
||||
//if (isRR() && s_ow < 0 && !force) // should never happen, the only owner-less spawn outside of map start is for the Holoduke, which is Duke only
|
||||
//return 0;
|
||||
|
||||
int const i = insertsprite(whatsect, s_ss);
|
||||
|
||||
if (i < 0)
|
||||
|
@ -77,7 +74,6 @@ short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s
|
|||
s->ang = s_a;
|
||||
s->xvel = s_ve;
|
||||
s->zvel = s_zv;
|
||||
s->owner = s_ow;
|
||||
s->xoffset = 0;
|
||||
s->yoffset = 0;
|
||||
s->yvel = 0;
|
||||
|
@ -85,21 +81,30 @@ short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s
|
|||
s->pal = 0;
|
||||
s->lotag = 0;
|
||||
|
||||
act->picnum = sprite[s_ow].picnum;
|
||||
|
||||
act->lastvx = 0;
|
||||
act->lastvy = 0;
|
||||
|
||||
act->timetosleep = 0;
|
||||
act->actorstayput = -1;
|
||||
act->extra = -1;
|
||||
act->owner = s_ow;
|
||||
act->cgg = 0;
|
||||
act->movflag = 0;
|
||||
act->tempang = 0;
|
||||
act->dispicnum = 0;
|
||||
act->floorz = hittype[s_ow].floorz;
|
||||
act->ceilingz = hittype[s_ow].ceilingz;
|
||||
act->SetHitOwner(s_ow);
|
||||
act->SetOwner(s_ow);
|
||||
|
||||
if (s_ow)
|
||||
{
|
||||
act->picnum = s_ow->s.picnum;
|
||||
act->floorz = s_ow->floorz;
|
||||
act->ceilingz = s_ow->ceilingz;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
memset(act->temp_data, 0, sizeof(act->temp_data));
|
||||
if (actorinfo[s_pn].scriptaddress)
|
||||
{
|
||||
|
@ -121,7 +126,7 @@ short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s
|
|||
spriteext[i] = {};
|
||||
spritesmooth[i] = {};
|
||||
|
||||
return(i);
|
||||
return act;
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,18 +136,19 @@ short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int initspriteforspawn(int j, int pn, const std::initializer_list<int> &excludes)
|
||||
int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_list<int> &excludes)
|
||||
{
|
||||
int i;
|
||||
spritetype* sp;
|
||||
int* t;
|
||||
int i;
|
||||
|
||||
if (j >= 0)
|
||||
if (actj)
|
||||
{
|
||||
i = EGS(sprite[j].sectnum, sprite[j].x, sprite[j].y, sprite[j].z, pn, 0, 0, 0, 0, 0, 0, j, 0);
|
||||
hittype[i].picnum = sprite[j].picnum;
|
||||
sp = &sprite[i];
|
||||
t = hittype[i].temp_data;
|
||||
auto spawned = EGS(actj->s.sectnum, actj->s.x, actj->s.y, actj->s.z, pn, 0, 0, 0, 0, 0, 0, actj, 0);
|
||||
spawned->picnum = actj->s.picnum;
|
||||
sp = &spawned->s;
|
||||
t = spawned->temp_data;
|
||||
i = spawned->GetIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -159,7 +165,8 @@ int initspriteforspawn(int j, int pn, const std::initializer_list<int> &excludes
|
|||
act->bposy = sp->y;
|
||||
act->bposz = sp->z;
|
||||
|
||||
sp->owner = act->owner = i;
|
||||
act->SetOwner(act);
|
||||
act->SetHitOwner(act);
|
||||
act->cgg = 0;
|
||||
act->movflag = 0;
|
||||
act->tempang = 0;
|
||||
|
@ -172,12 +179,13 @@ int initspriteforspawn(int j, int pn, const std::initializer_list<int> &excludes
|
|||
act->actorstayput = -1;
|
||||
|
||||
t[0] = t[1] = t[2] = t[3] = t[4] = t[5] = 0;
|
||||
act->temp_actor = nullptr;
|
||||
|
||||
if (sp->cstat & 48)
|
||||
if (!isIn(sp->picnum, excludes) && (sp->cstat & 48))
|
||||
{
|
||||
if (sp->shade == 127) return i;
|
||||
if (wallswitchcheck(i) && (sp->cstat & 16))
|
||||
if (wallswitchcheck(act) && (sp->cstat & 16))
|
||||
{
|
||||
if (sp->picnum != TILE_ACCESSSWITCH && sp->picnum != TILE_ACCESSSWITCH2 && sp->pal)
|
||||
{
|
||||
|
@ -227,19 +235,18 @@ int initspriteforspawn(int j, int pn, const std::initializer_list<int> &excludes
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void spawninitdefault(int j, int i)
|
||||
void spawninitdefault(DDukeActor* actj, DDukeActor *act)
|
||||
{
|
||||
auto act = &hittype[i];
|
||||
auto sp = &act->s;
|
||||
auto sect = sp->sectnum;
|
||||
|
||||
if (actorinfo[sp->picnum].scriptaddress)
|
||||
{
|
||||
if (j == -1 && sp->lotag > ud.player_skill)
|
||||
if (actj == nullptr && sp->lotag > ud.player_skill)
|
||||
{
|
||||
// make it go away...
|
||||
sp->xrepeat = sp->yrepeat = 0;
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(act, STAT_MISC);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -247,43 +254,43 @@ void spawninitdefault(int j, int i)
|
|||
if (sp->xrepeat == 0 || sp->yrepeat == 0)
|
||||
sp->xrepeat = sp->yrepeat = 1;
|
||||
|
||||
if (actorflag(i, SFLAG_BADGUY))
|
||||
if (actorflag(act, SFLAG_BADGUY))
|
||||
{
|
||||
if (ud.monsters_off == 1)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0;
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(act, STAT_MISC);
|
||||
return;
|
||||
}
|
||||
|
||||
makeitfall(i);
|
||||
makeitfall(act);
|
||||
|
||||
if (actorflag(i, SFLAG_BADGUYSTAYPUT))
|
||||
if (actorflag(act, SFLAG_BADGUYSTAYPUT))
|
||||
act->actorstayput = sp->sectnum;
|
||||
|
||||
if (!isRR() || actorflag(i, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill.
|
||||
if (!isRR() || actorflag(act, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill.
|
||||
ps[myconnectindex].max_actors_killed++;
|
||||
|
||||
sp->clipdist = 80;
|
||||
if (j >= 0)
|
||||
if (actj)
|
||||
{
|
||||
if (sprite[j].picnum == RESPAWN)
|
||||
act->tempang = sp->pal = sprite[j].pal;
|
||||
changespritestat(i, STAT_ACTOR);
|
||||
if (actj->s.picnum == RESPAWN)
|
||||
act->tempang = sp->pal = actj->s.pal;
|
||||
changespritestat(act, STAT_ACTOR);
|
||||
}
|
||||
else changespritestat(i, STAT_ZOMBIEACTOR);
|
||||
else changespritestat(act, STAT_ZOMBIEACTOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
sp->clipdist = 40;
|
||||
sp->owner = i;
|
||||
changespritestat(i, STAT_ACTOR);
|
||||
act->SetOwner(act);
|
||||
changespritestat(act, STAT_ACTOR);
|
||||
}
|
||||
|
||||
act->timetosleep = 0;
|
||||
|
||||
if (j >= 0)
|
||||
sp->ang = sprite[j].ang;
|
||||
if (actj)
|
||||
sp->ang = actj->s.ang;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,19 +300,20 @@ void spawninitdefault(int j, int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void spawntransporter(int j, int i, bool beam)
|
||||
void spawntransporter(DDukeActor *actj, DDukeActor* acti, bool beam)
|
||||
{
|
||||
if (j == -1) return;
|
||||
auto sp = &sprite[i];
|
||||
if (actj == nullptr) return;
|
||||
auto sp = &acti->s;
|
||||
auto spj = &actj->s;
|
||||
if (beam)
|
||||
{
|
||||
sp->xrepeat = 31;
|
||||
sp->yrepeat = 1;
|
||||
sp->z = sector[sprite[j].sectnum].floorz - (40 << 8);
|
||||
sp->z = sector[spj->sectnum].floorz - (40 << 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sprite[j].statnum == 4)
|
||||
if (spj->statnum == 4)
|
||||
{
|
||||
sp->xrepeat = 8;
|
||||
sp->yrepeat = 8;
|
||||
|
@ -314,19 +322,19 @@ void spawntransporter(int j, int i, bool beam)
|
|||
{
|
||||
sp->xrepeat = 48;
|
||||
sp->yrepeat = 64;
|
||||
if (sprite[j].statnum == 10 || badguy(&sprite[j]))
|
||||
if (spj->statnum == 10 || badguy(spj))
|
||||
sp->z -= (32 << 8);
|
||||
}
|
||||
}
|
||||
|
||||
sp->shade = -127;
|
||||
sp->cstat = 128 | 2;
|
||||
sp->ang = sprite[j].ang;
|
||||
sp->ang = spj->ang;
|
||||
|
||||
sp->xvel = 128;
|
||||
changespritestat(i, STAT_MISC);
|
||||
ssp(i, CLIPMASK0);
|
||||
setsprite(i, sp->x, sp->y, sp->z);
|
||||
changespritestat(acti, STAT_MISC);
|
||||
ssp(acti, CLIPMASK0);
|
||||
setsprite(acti, sp->x, sp->y, sp->z);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -335,9 +343,9 @@ void spawntransporter(int j, int i, bool beam)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int spawnbloodpoolpart1(int j, int i)
|
||||
int spawnbloodpoolpart1(DDukeActor *actj, DDukeActor* acti)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &acti->s;
|
||||
short s1 = sp->sectnum;
|
||||
|
||||
updatesector(sp->x + 108, sp->y + 108, &s1);
|
||||
|
@ -352,18 +360,18 @@ int spawnbloodpoolpart1(int j, int i)
|
|||
updatesector(sp->x - 108, sp->y + 108, &s1);
|
||||
if (s1 >= 0 && sector[s1].floorz != sector[sp->sectnum].floorz)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0; changespritestat(i, STAT_MISC); return true;
|
||||
sp->xrepeat = sp->yrepeat = 0; changespritestat(acti, STAT_MISC); return true;
|
||||
}
|
||||
}
|
||||
else { sp->xrepeat = sp->yrepeat = 0; changespritestat(i, STAT_MISC); return true; }
|
||||
else { sp->xrepeat = sp->yrepeat = 0; changespritestat(acti, STAT_MISC); return true; }
|
||||
}
|
||||
else { sp->xrepeat = sp->yrepeat = 0; changespritestat(i, STAT_MISC); return true; }
|
||||
else { sp->xrepeat = sp->yrepeat = 0; changespritestat(acti, STAT_MISC); return true; }
|
||||
}
|
||||
else { sp->xrepeat = sp->yrepeat = 0; changespritestat(i, STAT_MISC); return true; }
|
||||
else { sp->xrepeat = sp->yrepeat = 0; changespritestat(acti, STAT_MISC); return true; }
|
||||
|
||||
if (sector[sp->sectnum].lotag == 1)
|
||||
{
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(acti, STAT_MISC);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -375,11 +383,11 @@ int spawnbloodpoolpart1(int j, int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void initfootprint(int j, int i)
|
||||
void initfootprint(DDukeActor* actj, DDukeActor* acti)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &acti->s;
|
||||
int sect = sp->sectnum;
|
||||
if (j >= 0)
|
||||
if (actj)
|
||||
{
|
||||
short s1;
|
||||
s1 = sp->sectnum;
|
||||
|
@ -396,7 +404,7 @@ void initfootprint(int j, int i)
|
|||
updatesector(sp->x - 84, sp->y + 84, &s1);
|
||||
if (s1 >= 0 && sector[s1].floorz != sector[sp->sectnum].floorz)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0; changespritestat(i, STAT_MISC); return;
|
||||
sp->xrepeat = sp->yrepeat = 0; changespritestat(acti, STAT_MISC); return;
|
||||
}
|
||||
}
|
||||
else { sp->xrepeat = sp->yrepeat = 0; return; }
|
||||
|
@ -405,16 +413,16 @@ void initfootprint(int j, int i)
|
|||
}
|
||||
else { sp->xrepeat = sp->yrepeat = 0; return; }
|
||||
|
||||
sp->cstat = 32 + ((ps[sprite[j].yvel].footprintcount & 1) << 2);
|
||||
sp->ang = sprite[j].ang;
|
||||
sp->cstat = 32 + ((ps[actj->s.yvel].footprintcount & 1) << 2);
|
||||
sp->ang = actj->s.ang;
|
||||
}
|
||||
|
||||
sp->z = sector[sect].floorz;
|
||||
if (sector[sect].lotag != 1 && sector[sect].lotag != 2)
|
||||
sp->xrepeat = sp->yrepeat = 32;
|
||||
|
||||
insertspriteq(&hittype[i]);
|
||||
changespritestat(i, STAT_MISC);
|
||||
insertspriteq(acti);
|
||||
changespritestat(acti, STAT_MISC);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -423,14 +431,14 @@ void initfootprint(int j, int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void initshell(int j, int i, bool isshell)
|
||||
void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &acti->s;
|
||||
int sect = sp->sectnum;
|
||||
auto spj = &sprite[j];
|
||||
auto t = hittype[i].temp_data;
|
||||
if (j >= 0)
|
||||
auto t = acti->temp_data;
|
||||
if (actj)
|
||||
{
|
||||
auto spj = &actj->s;
|
||||
short snum, a;
|
||||
|
||||
if (spj->picnum == TILE_APLAYER)
|
||||
|
@ -467,7 +475,7 @@ void initshell(int j, int i, bool isshell)
|
|||
|
||||
sp->xrepeat = sp->yrepeat = isRR() && isshell? 2 : 4;
|
||||
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(acti, STAT_MISC);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,11 +485,11 @@ void initshell(int j, int i, bool isshell)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void initcrane(int j, int i, int CRANEPOLE)
|
||||
void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &acti->s;
|
||||
int sect = sp->sectnum;
|
||||
auto t = hittype[i].temp_data;
|
||||
auto t = acti->temp_data;
|
||||
sp->cstat |= 64 | 257;
|
||||
|
||||
sp->picnum += 2;
|
||||
|
@ -492,14 +500,13 @@ void initcrane(int j, int i, int CRANEPOLE)
|
|||
msy[tempwallptr] = sp->y;
|
||||
msx[tempwallptr + 2] = sp->z;
|
||||
|
||||
int s;
|
||||
StatIterator it(STAT_DEFAULT);
|
||||
while ((s = it.NextIndex()) >= 0)
|
||||
DukeStatIterator it(STAT_DEFAULT);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
auto ss = &sprite[s];
|
||||
auto ss = &act->s;
|
||||
if (ss->picnum == CRANEPOLE && sp->hitag == (ss->hitag))
|
||||
{
|
||||
msy[tempwallptr + 2] = s;
|
||||
msy[tempwallptr + 2] = ActorToScriptIndex(act);
|
||||
|
||||
t[1] = ss->sectnum;
|
||||
|
||||
|
@ -514,15 +521,15 @@ void initcrane(int j, int i, int CRANEPOLE)
|
|||
ss->z = sp->z;
|
||||
ss->shade = sp->shade;
|
||||
|
||||
setsprite(s, ss->x, ss->y, ss->z);
|
||||
setsprite(act, ss->pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tempwallptr += 3;
|
||||
sp->owner = -1;
|
||||
acti->SetOwner(nullptr);
|
||||
sp->extra = 8;
|
||||
changespritestat(i, 6);
|
||||
changespritestat(acti, STAT_STANDABLE);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -531,15 +538,15 @@ void initcrane(int j, int i, int CRANEPOLE)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void initwaterdrip(int j, int i)
|
||||
void initwaterdrip(DDukeActor* actj, DDukeActor* actor)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
int sect = sp->sectnum;
|
||||
auto t = hittype[i].temp_data;
|
||||
if (j >= 0 && (sprite[j].statnum == 10 || sprite[j].statnum == 1))
|
||||
auto t = actor->temp_data;
|
||||
if (actj && (actj->s.statnum == 10 || actj->s.statnum == 1))
|
||||
{
|
||||
sp->shade = 32;
|
||||
if (sprite[j].pal != 1)
|
||||
if (actj->s.pal != 1)
|
||||
{
|
||||
sp->pal = 2;
|
||||
sp->z -= (18 << 8);
|
||||
|
@ -547,9 +554,9 @@ void initwaterdrip(int j, int i)
|
|||
else sp->z -= (13 << 8);
|
||||
sp->ang = getangle(ps[connecthead].posx - sp->x, ps[connecthead].posy - sp->y);
|
||||
sp->xvel = 48 - (krand() & 31);
|
||||
ssp(i, CLIPMASK0);
|
||||
ssp(actor, CLIPMASK0);
|
||||
}
|
||||
else if (j == -1)
|
||||
else if (!actj)
|
||||
{
|
||||
sp->z += (4 << 8);
|
||||
t[0] = sp->z;
|
||||
|
@ -557,7 +564,7 @@ void initwaterdrip(int j, int i)
|
|||
}
|
||||
sp->xrepeat = 24;
|
||||
sp->yrepeat = 24;
|
||||
changespritestat(i, 6);
|
||||
changespritestat(actor, STAT_STANDABLE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -567,26 +574,26 @@ void initwaterdrip(int j, int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int initreactor(int j, int i, bool isrecon)
|
||||
int initreactor(DDukeActor* actj, DDukeActor* actor, bool isrecon)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
int sect = sp->sectnum;
|
||||
auto t = hittype[i].temp_data;
|
||||
auto t = actor->temp_data;
|
||||
if (isrecon)
|
||||
{
|
||||
if (sp->lotag > ud.player_skill)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0;
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(actor, STAT_MISC);
|
||||
return true;
|
||||
}
|
||||
if (!isRR() || actorflag(i, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill.
|
||||
if (!isRR() || actorflag(actor, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill.
|
||||
ps[myconnectindex].max_actors_killed++;
|
||||
hittype[i].temp_data[5] = 0;
|
||||
actor->temp_data[5] = 0;
|
||||
if (ud.monsters_off == 1)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0;
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(actor, STAT_MISC);
|
||||
return false;
|
||||
}
|
||||
sp->extra = 130;
|
||||
|
@ -599,13 +606,13 @@ int initreactor(int j, int i, bool isrecon)
|
|||
if (ud.multimode < 2 && sp->pal != 0)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0;
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(actor, STAT_MISC);
|
||||
return false;
|
||||
}
|
||||
sp->pal = 0;
|
||||
sp->shade = -17;
|
||||
|
||||
changespritestat(i, 2);
|
||||
changespritestat(actor, 2);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -615,12 +622,12 @@ int initreactor(int j, int i, bool isrecon)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void spawneffector(int i)
|
||||
void spawneffector(DDukeActor* actor)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
int sect = sp->sectnum;
|
||||
auto t = hittype[i].temp_data;
|
||||
int j, startwall, endwall, x, y, d, s, clostest;
|
||||
auto t = actor->temp_data;
|
||||
int startwall, endwall, x, y, d, s, clostest;
|
||||
|
||||
sp->yvel = sector[sect].extra;
|
||||
sp->cstat |= 32768;
|
||||
|
@ -628,31 +635,34 @@ void spawneffector(int i)
|
|||
|
||||
switch (sp->lotag)
|
||||
{
|
||||
case 28:
|
||||
case SE_28_LIGHTNING:
|
||||
if (!isRR()) t[5] = 65;// Delay for lightning
|
||||
break;
|
||||
case 7: // Transporters!!!!
|
||||
case 23:// XPTR END
|
||||
case SE_7_TELEPORT: // Transporters!!!!
|
||||
case SE_23_ONE_WAY_TELEPORT:// XPTR END
|
||||
if (sp->lotag != 23)
|
||||
{
|
||||
for (j = 0; j < MAXSPRITES; j++)
|
||||
if (sprite[j].statnum < MAXSTATUS && sprite[j].picnum == SECTOREFFECTOR && (sprite[j].lotag == 7 || sprite[j].lotag == 23) && i != j && sprite[j].hitag == sp->hitag)
|
||||
DukeSpriteIterator it;
|
||||
while (auto act2 = it.Next())
|
||||
{
|
||||
sp->owner = j;
|
||||
if (act2->s.statnum < MAXSTATUS && act2->s.picnum == SECTOREFFECTOR && (act2->s.lotag == 7 || act2->s.lotag == 23) && actor != act2 && act2->s.hitag == sp->hitag)
|
||||
{
|
||||
actor->SetOwner(act2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else sp->owner = i;
|
||||
}
|
||||
else actor->SetOwner(actor);
|
||||
|
||||
t[4] = sector[sect].floorz == sp->z;
|
||||
sp->cstat = 0;
|
||||
changespritestat(i, 9);
|
||||
changespritestat(actor, STAT_TRANSPORT);
|
||||
return;
|
||||
case 1:
|
||||
sp->owner = -1;
|
||||
case SE_1_PIVOT:
|
||||
actor->SetOwner(nullptr);
|
||||
t[0] = 1;
|
||||
break;
|
||||
case 18:
|
||||
case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
|
||||
|
||||
if (sp->ang == 512)
|
||||
{
|
||||
|
@ -670,10 +680,10 @@ void spawneffector(int i)
|
|||
sp->hitag <<= 2;
|
||||
break;
|
||||
|
||||
case 19:
|
||||
sp->owner = -1;
|
||||
case SE_19_EXPLOSION_LOWERS_CEILING:
|
||||
actor->SetOwner(nullptr);
|
||||
break;
|
||||
case 25: // Pistons
|
||||
case SE_25_PISTON: // Pistons
|
||||
if (!isRR())
|
||||
{
|
||||
t[3] = sector[sect].ceilingz;
|
||||
|
@ -685,37 +695,36 @@ void spawneffector(int i)
|
|||
sector[sect].ceilingz = sp->z;
|
||||
setinterpolation(§or[sect].ceilingz);
|
||||
break;
|
||||
case 35:
|
||||
case SE_35:
|
||||
sector[sect].ceilingz = sp->z;
|
||||
break;
|
||||
case 27:
|
||||
case SE_27_DEMO_CAM:
|
||||
if (ud.recstat == 1)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 64;
|
||||
sp->cstat &= 32767;
|
||||
}
|
||||
break;
|
||||
case 47:
|
||||
case 48:
|
||||
case SE_47_LIGHT_SWITCH:
|
||||
case SE_48_LIGHT_SWITCH:
|
||||
if (!isRRRA()) break;
|
||||
case 12:
|
||||
case SE_12_LIGHT_SWITCH:
|
||||
|
||||
t[1] = sector[sect].floorshade;
|
||||
t[2] = sector[sect].ceilingshade;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
|
||||
case SE_13_EXPLOSIVE:
|
||||
{
|
||||
t[0] = sector[sect].ceilingz;
|
||||
t[1] = sector[sect].floorz;
|
||||
|
||||
if (abs(t[0] - sp->z) < abs(t[1] - sp->z))
|
||||
sp->owner = 1;
|
||||
else sp->owner = 0;
|
||||
bool ceiling = (abs(t[0] - sp->z) < abs(t[1] - sp->z));
|
||||
actor->spriteextra = ceiling;
|
||||
|
||||
if (sp->ang == 512)
|
||||
{
|
||||
if (sp->owner)
|
||||
if (ceiling)
|
||||
sector[sect].ceilingz = sp->z;
|
||||
else
|
||||
sector[sect].floorz = sp->z;
|
||||
|
@ -728,7 +737,7 @@ void spawneffector(int i)
|
|||
sector[sect].ceilingstat ^= 1;
|
||||
t[3] = 1;
|
||||
|
||||
if (!sp->owner && sp->ang == 512)
|
||||
if (!ceiling && sp->ang == 512)
|
||||
{
|
||||
sector[sect].ceilingstat ^= 1;
|
||||
t[3] = 0;
|
||||
|
@ -741,7 +750,7 @@ void spawneffector(int i)
|
|||
{
|
||||
startwall = sector[sect].wallptr;
|
||||
endwall = startwall + sector[sect].wallnum;
|
||||
for (j = startwall; j < endwall; j++)
|
||||
for (int j = startwall; j < endwall; j++)
|
||||
{
|
||||
int x = wall[j].nextsector;
|
||||
if (x >= 0)
|
||||
|
@ -758,12 +767,12 @@ void spawneffector(int i)
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
case 17:
|
||||
|
||||
}
|
||||
case SE_17_WARP_ELEVATOR:
|
||||
{
|
||||
t[2] = sector[sect].floorz; //Stopping loc
|
||||
|
||||
j = nextsectorneighborz(sect, sector[sect].floorz, -1, -1);
|
||||
int j = nextsectorneighborz(sect, sector[sect].floorz, -1, -1);
|
||||
t[3] = sector[j].ceilingz;
|
||||
|
||||
j = nextsectorneighborz(sect, sector[sect].ceilingz, 1, 1);
|
||||
|
@ -776,13 +785,13 @@ void spawneffector(int i)
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
case 24:
|
||||
}
|
||||
case SE_24_CONVEYOR:
|
||||
sp->yvel <<= 1;
|
||||
case 36:
|
||||
case SE_36_PROJ_SHOOTER:
|
||||
break;
|
||||
|
||||
case 20:
|
||||
case SE_20_STRETCH_BRIDGE:
|
||||
{
|
||||
int q;
|
||||
|
||||
|
@ -827,15 +836,14 @@ void spawneffector(int i)
|
|||
}
|
||||
|
||||
|
||||
case 3:
|
||||
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
|
||||
|
||||
t[3] = sector[sect].floorshade;
|
||||
|
||||
sector[sect].floorshade = sp->shade;
|
||||
sector[sect].ceilingshade = sp->shade;
|
||||
|
||||
sp->owner = sector[sect].ceilingpal << 8;
|
||||
sp->owner |= sector[sect].floorpal;
|
||||
actor->palvals = (sector[sect].ceilingpal << 8) | sector[sect].floorpal;
|
||||
|
||||
//fix all the walls;
|
||||
|
||||
|
@ -851,7 +859,7 @@ void spawneffector(int i)
|
|||
}
|
||||
break;
|
||||
|
||||
case 31:
|
||||
case SE_31_FLOOR_RISE_FALL:
|
||||
t[1] = sector[sect].floorz;
|
||||
// t[2] = sp->hitag;
|
||||
if (sp->ang != 1536) sector[sect].floorz = sp->z;
|
||||
|
@ -865,7 +873,7 @@ void spawneffector(int i)
|
|||
setinterpolation(§or[sect].floorz);
|
||||
|
||||
break;
|
||||
case 32:
|
||||
case SE_32_CEILING_RISE_FALL:
|
||||
t[1] = sector[sect].ceilingz;
|
||||
t[2] = sp->hitag;
|
||||
if (sp->ang != 1536) sector[sect].ceilingz = sp->z;
|
||||
|
@ -880,15 +888,14 @@ void spawneffector(int i)
|
|||
|
||||
break;
|
||||
|
||||
case 4: //Flashing lights
|
||||
case SE_4_RANDOM_LIGHTS: //Flashing lights
|
||||
|
||||
t[2] = sector[sect].floorshade;
|
||||
|
||||
startwall = sector[sect].wallptr;
|
||||
endwall = startwall + sector[sect].wallnum;
|
||||
|
||||
sp->owner = sector[sect].ceilingpal << 8;
|
||||
sp->owner |= sector[sect].floorpal;
|
||||
actor->palvals = (sector[sect].ceilingpal << 8) | sector[sect].floorpal;
|
||||
|
||||
for (s = startwall; s < endwall; s++)
|
||||
if (wall[s].shade > t[3])
|
||||
|
@ -896,11 +903,11 @@ void spawneffector(int i)
|
|||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
case SE_9_DOWN_OPEN_DOOR_LIGHTS:
|
||||
if (sector[sect].lotag &&
|
||||
labs(sector[sect].ceilingz - sp->z) > 1024)
|
||||
sector[sect].lotag |= 32768; //If its open
|
||||
case 8:
|
||||
case SE_8_UP_OPEN_DOOR_LIGHTS:
|
||||
//First, get the ceiling-floor shade
|
||||
|
||||
t[0] = sector[sect].floorshade;
|
||||
|
@ -934,49 +941,53 @@ void spawneffector(int i)
|
|||
t[3] = 1; //Take Out;
|
||||
break;
|
||||
|
||||
case 11://Pivitor rotater
|
||||
case SE_11_SWINGING_DOOR://Pivitor rotater
|
||||
if (sp->ang > 1024) t[3] = 2;
|
||||
else t[3] = -2;
|
||||
case 0:
|
||||
case 2://Earthquakemakers
|
||||
case 5://Boss Creature
|
||||
case 6://Subway
|
||||
case 14://Caboos
|
||||
case 15://Subwaytype sliding door
|
||||
case 16://That rotating blocker reactor thing
|
||||
case 26://ESCELATOR
|
||||
case 30://No rotational subways
|
||||
case SE_0_ROTATING_SECTOR:
|
||||
case SE_2_EARTHQUAKE://Earthquakemakers
|
||||
case SE_5_BOSS://Boss Creature
|
||||
case SE_6_SUBWAY://Subway
|
||||
case SE_14_SUBWAY_CAR://Caboos
|
||||
case SE_15_SLIDING_DOOR://Subwaytype sliding door
|
||||
case SE_16_REACTOR://That rotating blocker reactor thing
|
||||
case SE_26://ESCELATOR
|
||||
case SE_30_TWO_WAY_TRAIN://No rotational subways
|
||||
|
||||
if (sp->lotag == 0)
|
||||
{
|
||||
if (sector[sect].lotag == 30)
|
||||
{
|
||||
if (sp->pal) sprite[i].clipdist = 1;
|
||||
else sprite[i].clipdist = 0;
|
||||
if (sp->pal) sp->clipdist = 1;
|
||||
else sp->clipdist = 0;
|
||||
t[3] = sector[sect].floorz;
|
||||
sector[sect].hitag = i;
|
||||
sector[sect].hitag = ActorToScriptIndex(actor);
|
||||
}
|
||||
|
||||
for (j = 0; j < MAXSPRITES; j++)
|
||||
DukeSpriteIterator it;
|
||||
bool found = false;
|
||||
while (auto act2 = it.Next())
|
||||
{
|
||||
if (sprite[j].statnum < MAXSTATUS)
|
||||
if (sprite[j].picnum == SECTOREFFECTOR &&
|
||||
sprite[j].lotag == 1 &&
|
||||
sprite[j].hitag == sp->hitag)
|
||||
auto spr = &act2->s;
|
||||
if (spr->statnum < MAXSTATUS)
|
||||
if (spr->picnum == SECTOREFFECTOR &&
|
||||
spr->lotag == SE_1_PIVOT &&
|
||||
spr->hitag == sp->hitag)
|
||||
{
|
||||
if (sp->ang == 512)
|
||||
{
|
||||
sp->x = sprite[j].x;
|
||||
sp->y = sprite[j].y;
|
||||
sp->x = spr->x;
|
||||
sp->y = spr->y;
|
||||
}
|
||||
found = true;
|
||||
actor->SetOwner(act2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == MAXSPRITES)
|
||||
if (!found)
|
||||
{
|
||||
I_Error("Found lonely Sector Effector (lotag 0) at (%d,%d)\n", sp->x, sp->y);
|
||||
}
|
||||
sp->owner = j;
|
||||
}
|
||||
|
||||
startwall = sector[sect].wallptr;
|
||||
|
@ -1003,9 +1014,9 @@ void spawneffector(int i)
|
|||
sp->extra = 0;
|
||||
else sp->extra = 1;
|
||||
|
||||
sector[sect].hitag = i;
|
||||
sector[sect].hitag = ActorToScriptIndex(actor);
|
||||
|
||||
j = 0;
|
||||
int j = 0;
|
||||
|
||||
for (s = startwall; s < endwall; s++)
|
||||
{
|
||||
|
@ -1024,7 +1035,7 @@ void spawneffector(int i)
|
|||
I_Error("Subway found no zero'd sectors with locators\nat (%d,%d).\n", sp->x, sp->y);
|
||||
}
|
||||
|
||||
sp->owner = -1;
|
||||
actor->SetOwner(nullptr);
|
||||
t[0] = s;
|
||||
|
||||
if (sp->lotag != 30)
|
||||
|
@ -1054,34 +1065,36 @@ void spawneffector(int i)
|
|||
|
||||
switch (sp->lotag)
|
||||
{
|
||||
case 6:
|
||||
case 14:
|
||||
j = callsound(sect, i);
|
||||
case SE_6_SUBWAY:
|
||||
case SE_14_SUBWAY_CAR:
|
||||
{
|
||||
int j = callsound(sect, actor);
|
||||
if (j == -1)
|
||||
{
|
||||
if (!isRR()) j = SUBWAY; // Duke
|
||||
else if (sector[sp->sectnum].floorpal == 7) j = 456;
|
||||
else j = 75;
|
||||
}
|
||||
hittype[i].lastvx = j;
|
||||
case 30:
|
||||
actor->lastvx = j;
|
||||
}
|
||||
case SE_30_TWO_WAY_TRAIN:
|
||||
if (numplayers > 1) break;
|
||||
case 0:
|
||||
case 1:
|
||||
case 5:
|
||||
case 11:
|
||||
case 15:
|
||||
case 16:
|
||||
case 26:
|
||||
setsectinterpolate(i);
|
||||
case SE_0_ROTATING_SECTOR:
|
||||
case SE_1_PIVOT:
|
||||
case SE_5_BOSS:
|
||||
case SE_11_SWINGING_DOOR:
|
||||
case SE_15_SLIDING_DOOR:
|
||||
case SE_16_REACTOR:
|
||||
case SE_26:
|
||||
setsectinterpolate(actor->s.sectnum);
|
||||
break;
|
||||
}
|
||||
|
||||
if ((!isRR() && sprite[i].lotag >= 40 && sprite[i].lotag <= 45) ||
|
||||
(isRRRA() && sprite[i].lotag >= 150 && sprite[i].lotag <= 155))
|
||||
changespritestat(i, STAT_RAROR);
|
||||
if ((!isRR() && actor->s.lotag >= 40 && actor->s.lotag <= 45) ||
|
||||
(isRRRA() && actor->s.lotag >= 150 && actor->s.lotag <= 155))
|
||||
changespritestat(actor, STAT_RAROR);
|
||||
else
|
||||
changespritestat(i, STAT_EFFECTOR);
|
||||
changespritestat(actor, STAT_EFFECTOR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1091,11 +1104,11 @@ void spawneffector(int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void lotsofglass(int i, int wallnum, int n)
|
||||
void lotsofglass(DDukeActor *actor, int wallnum, int n)
|
||||
{
|
||||
int j, xv, yv, z, x1, y1, a;
|
||||
short sect;
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
|
||||
sect = -1;
|
||||
|
||||
|
@ -1104,7 +1117,7 @@ void lotsofglass(int i, int wallnum, int n)
|
|||
for (j = n - 1; j >= 0; j--)
|
||||
{
|
||||
a = sp->ang - 256 + (krand() & 511) + 1024;
|
||||
EGS(sp->sectnum, sp->x, sp->y, sp->z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), i, 5);
|
||||
EGS(sp->sectnum, sp->x, sp->y, sp->z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), &hittype[j], 5);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1135,7 +1148,7 @@ void lotsofglass(int i, int wallnum, int n)
|
|||
if (z < -(32 << 8) || z >(32 << 8))
|
||||
z = sp->z - (32 << 8) + (krand() & ((64 << 8) - 1));
|
||||
a = sp->ang - 1024;
|
||||
EGS(sp->sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 1023), i, 5);
|
||||
EGS(sp->sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 1023), actor, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1146,17 +1159,16 @@ void lotsofglass(int i, int wallnum, int n)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void spriteglass(int i, int n)
|
||||
void spriteglass(DDukeActor* actor, int n)
|
||||
{
|
||||
int j, k, a, z;
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
|
||||
for (j = n; j > 0; j--)
|
||||
for (int j = n; j > 0; j--)
|
||||
{
|
||||
a = krand() & 2047;
|
||||
z = sp->z - ((krand() & 16) << 8);
|
||||
k = EGS(sp->sectnum, sp->x, sp->y, z, TILE_GLASSPIECES + (j % 3), krand() & 15, 36, 36, a, 32 + (krand() & 63), -512 - (krand() & 2047), i, 5);
|
||||
sprite[k].pal = sprite[i].pal;
|
||||
int a = krand() & 2047;
|
||||
int z = sp->z - ((krand() & 16) << 8);
|
||||
auto k = EGS(sp->sectnum, sp->x, sp->y, z, TILE_GLASSPIECES + (j % 3), krand() & 15, 36, 36, a, 32 + (krand() & 63), -512 - (krand() & 2047), actor, 5);
|
||||
k->s.pal = sp->pal;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1166,11 +1178,11 @@ void spriteglass(int i, int n)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void ceilingglass(int i, int sectnum, int n)
|
||||
void ceilingglass(DDukeActor* actor, int sectnum, int n)
|
||||
{
|
||||
int j, xv, yv, z, x1, y1;
|
||||
int a, s, startwall, endwall;
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
|
||||
startwall = sector[sectnum].wallptr;
|
||||
endwall = startwall + sector[sectnum].wallnum;
|
||||
|
@ -1189,7 +1201,7 @@ void ceilingglass(int i, int sectnum, int n)
|
|||
y1 += yv;
|
||||
a = krand() & 2047;
|
||||
z = sector[sectnum].ceilingz + ((krand() & 15) << 8);
|
||||
EGS(sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, (krand() & 31), 0, i, 5);
|
||||
EGS(sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, (krand() & 31), 0, actor, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1200,20 +1212,20 @@ void ceilingglass(int i, int sectnum, int n)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void lotsofcolourglass(int i, int wallnum, int n)
|
||||
void lotsofcolourglass(DDukeActor* actor, int wallnum, int n)
|
||||
{
|
||||
int j, xv, yv, z, x1, y1;
|
||||
short sect = -1;
|
||||
int a, k;
|
||||
auto sp = &sprite[i];
|
||||
int a;;
|
||||
auto sp = &actor->s;
|
||||
|
||||
if (wallnum < 0)
|
||||
{
|
||||
for (j = n - 1; j >= 0; j--)
|
||||
{
|
||||
a = krand() & 2047;
|
||||
k = EGS(sp->sectnum, sp->x, sp->y, sp->z - (krand() & (63 << 8)), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 2047), i, 5);
|
||||
sprite[k].pal = krand() & 15;
|
||||
auto k = EGS(sp->sectnum, sp->x, sp->y, sp->z - (krand() & (63 << 8)), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 2047), actor, 5);
|
||||
k->s.pal = krand() & 15;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1235,8 +1247,8 @@ void lotsofcolourglass(int i, int wallnum, int n)
|
|||
if (z < -(32 << 8) || z >(32 << 8))
|
||||
z = sp->z - (32 << 8) + (krand() & ((64 << 8) - 1));
|
||||
a = sp->ang - 1024;
|
||||
k = EGS(sp->sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 2047), i, 5);
|
||||
sprite[k].pal = krand() & 7;
|
||||
auto k = EGS(sp->sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 2047), actor, 5);
|
||||
k->s.pal = krand() & 7;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,12 +45,14 @@ int spawn_d(int j, int pn)
|
|||
{
|
||||
int x;
|
||||
|
||||
int i = initspriteforspawn(j, pn, { CRACK1, CRACK2, CRACK3, CRACK4, SPEAKER, LETTER, DUCK, TARGET, TRIPBOMB, VIEWSCREEN, VIEWSCREEN2 });
|
||||
auto actj = j < 0 ? nullptr : &hittype[j];
|
||||
int i = initspriteforspawn(actj, pn, { CRACK1, CRACK2, CRACK3, CRACK4, SPEAKER, LETTER, DUCK, TARGET, TRIPBOMB, VIEWSCREEN, VIEWSCREEN2 });
|
||||
if (!(i & 0x1000000)) return i;
|
||||
i &= 0xffffff;
|
||||
auto sp = &sprite[i];
|
||||
auto spj = &sprite[j];
|
||||
auto t = hittype[i].temp_data;
|
||||
auto act = &hittype[i];
|
||||
auto sp = &act->s;
|
||||
auto spj = j < 0 ? nullptr : &actj->s;
|
||||
auto t = act->temp_data;
|
||||
int sect = sp->sectnum;
|
||||
|
||||
|
||||
|
@ -61,7 +63,7 @@ int spawn_d(int j, int pn)
|
|||
case BOSS2STAYPUT:
|
||||
case BOSS3STAYPUT:
|
||||
case BOSS5STAYPUT:
|
||||
hittype[i].actorstayput = sp->sectnum;
|
||||
act->actorstayput = sp->sectnum;
|
||||
case FIREFLY:
|
||||
case BOSS5:
|
||||
if (sp->picnum != FIREFLY)
|
||||
|
@ -94,26 +96,26 @@ int spawn_d(int j, int pn)
|
|||
if ((sp->lotag > ud.player_skill) || ud.monsters_off)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0;
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(act, STAT_MISC);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
makeitfall(i);
|
||||
makeitfall(act);
|
||||
|
||||
sp->cstat |= 257;
|
||||
ps[connecthead].max_actors_killed++;
|
||||
|
||||
if (j >= 0) {
|
||||
hittype[i].timetosleep = 0;
|
||||
fi.check_fta_sounds(i);
|
||||
act->timetosleep = 0;
|
||||
check_fta_sounds_d(act);
|
||||
changespritestat(i, 1);
|
||||
} else
|
||||
changespritestat(i, 2);
|
||||
}
|
||||
return i;
|
||||
case FIREFLYFLYINGEFFECT:
|
||||
sp->owner = j;
|
||||
act->SetOwner(actj);
|
||||
changespritestat(i, STAT_MISC);
|
||||
sp->xrepeat = 16;
|
||||
sp->yrepeat = 16;
|
||||
|
@ -121,8 +123,8 @@ int spawn_d(int j, int pn)
|
|||
case LAVAPOOLBUBBLE:
|
||||
if (spj->xrepeat < 30)
|
||||
return i;
|
||||
sp->owner = j;
|
||||
changespritestat(i, STAT_MISC);
|
||||
act->SetOwner(actj);
|
||||
changespritestat(i, STAT_MISC);
|
||||
sp->x += krand() % 512 - 256;
|
||||
sp->y += krand() % 512 - 256;
|
||||
sp->xrepeat = 16;
|
||||
|
@ -146,7 +148,7 @@ int spawn_d(int j, int pn)
|
|||
switch(sp->picnum)
|
||||
{
|
||||
default:
|
||||
spawninitdefault(j, i);
|
||||
spawninitdefault(actj, act);
|
||||
break;
|
||||
case FOF:
|
||||
sp->xrepeat = sp->yrepeat = 0;
|
||||
|
@ -219,7 +221,7 @@ int spawn_d(int j, int pn)
|
|||
break;
|
||||
case TRANSPORTERSTAR:
|
||||
case TRANSPORTERBEAM:
|
||||
spawntransporter(j, i, sp->picnum == TRANSPORTERBEAM);
|
||||
spawntransporter(actj, act, sp->picnum == TRANSPORTERBEAM);
|
||||
break;
|
||||
|
||||
case FRAMEEFFECT1:
|
||||
|
@ -249,7 +251,7 @@ int spawn_d(int j, int pn)
|
|||
sp->yrepeat = 0;
|
||||
}
|
||||
|
||||
if(j >= 0) sp->ang = hittype[j].temp_data[5]+512;
|
||||
if(j >= 0) sp->ang = actj->temp_data[5]+512;
|
||||
changespritestat(i, STAT_MISC);
|
||||
break;
|
||||
|
||||
|
@ -279,7 +281,7 @@ int spawn_d(int j, int pn)
|
|||
|
||||
case BLOODPOOL:
|
||||
case PUKE:
|
||||
if (spawnbloodpoolpart1(j, i)) break;
|
||||
if (spawnbloodpoolpart1(actj, act)) break;
|
||||
|
||||
if(j >= 0 && sp->picnum != PUKE)
|
||||
{
|
||||
|
@ -321,7 +323,7 @@ int spawn_d(int j, int pn)
|
|||
sp->z -= (16<<8);
|
||||
if(j >= 0 && spj->pal == 6)
|
||||
sp->pal = 6;
|
||||
insertspriteq(&hittype[i]);
|
||||
insertspriteq(act);
|
||||
changespritestat(i, STAT_MISC);
|
||||
break;
|
||||
|
||||
|
@ -336,14 +338,15 @@ int spawn_d(int j, int pn)
|
|||
sp->xrepeat=4;
|
||||
sp->yrepeat=5;
|
||||
|
||||
sp->owner = i;
|
||||
sp->hitag = i;
|
||||
act->SetOwner(act);
|
||||
ud.bomb_tag = (ud.bomb_tag + 1) & 32767;
|
||||
sp->hitag = ud.bomb_tag;
|
||||
|
||||
sp->xvel = 16;
|
||||
ssp(i,CLIPMASK0);
|
||||
hittype[i].temp_data[0] = 17;
|
||||
hittype[i].temp_data[2] = 0;
|
||||
hittype[i].temp_data[5] = sp->ang;
|
||||
ssp(act, CLIPMASK0);
|
||||
act->temp_data[0] = 17;
|
||||
act->temp_data[2] = 0;
|
||||
act->temp_data[5] = sp->ang;
|
||||
|
||||
case SPACEMARINE:
|
||||
if(sp->picnum == SPACEMARINE)
|
||||
|
@ -462,7 +465,7 @@ int spawn_d(int j, int pn)
|
|||
case FOOTPRINTS2:
|
||||
case FOOTPRINTS3:
|
||||
case FOOTPRINTS4:
|
||||
initfootprint(j, i);
|
||||
initfootprint(actj, act);
|
||||
break;
|
||||
|
||||
case FEM1:
|
||||
|
@ -522,7 +525,7 @@ int spawn_d(int j, int pn)
|
|||
if(sp->picnum == RESPAWNMARKERRED)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 24;
|
||||
if(j >= 0) sp->z = hittype[j].floorz; // -(1<<4);
|
||||
if(j >= 0) sp->z = actj->floorz; // -(1<<4);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -543,13 +546,13 @@ int spawn_d(int j, int pn)
|
|||
case BULLETHOLE:
|
||||
sp->xrepeat = sp->yrepeat = 3;
|
||||
sp->cstat = 16+(krand()&12);
|
||||
insertspriteq(&hittype[i]);
|
||||
insertspriteq(act);
|
||||
case MONEY:
|
||||
case MAIL:
|
||||
case PAPER:
|
||||
if( sp->picnum == MONEY || sp->picnum == MAIL || sp->picnum == PAPER )
|
||||
{
|
||||
hittype[i].temp_data[0] = krand()&2047;
|
||||
act->temp_data[0] = krand()&2047;
|
||||
sp->cstat = krand()&12;
|
||||
sp->xrepeat = sp->yrepeat = 8;
|
||||
sp->ang = krand()&2047;
|
||||
|
@ -559,7 +562,7 @@ int spawn_d(int j, int pn)
|
|||
|
||||
case VIEWSCREEN:
|
||||
case VIEWSCREEN2:
|
||||
sp->owner = i;
|
||||
act->SetOwner(act);
|
||||
sp->lotag = 1;
|
||||
sp->extra = 1;
|
||||
changespritestat(i,6);
|
||||
|
@ -567,7 +570,7 @@ int spawn_d(int j, int pn)
|
|||
|
||||
case SHELL: //From the player
|
||||
case SHOTGUNSHELL:
|
||||
initshell(j, i, sp->picnum == SHELL);
|
||||
initshell(actj, act, sp->picnum == SHELL);
|
||||
break;
|
||||
|
||||
case RESPAWN:
|
||||
|
@ -683,11 +686,11 @@ int spawn_d(int j, int pn)
|
|||
break;
|
||||
|
||||
case CRANE:
|
||||
initcrane(j, i, CRANEPOLE);
|
||||
initcrane(actj, act, CRANEPOLE);
|
||||
break;
|
||||
|
||||
case WATERDRIP:
|
||||
initwaterdrip(j, i);
|
||||
initwaterdrip(actj, act);
|
||||
break;
|
||||
case TRASH:
|
||||
|
||||
|
@ -770,7 +773,7 @@ int spawn_d(int j, int pn)
|
|||
case PIGCOPDIVE:
|
||||
case COMMANDERSTAYPUT:
|
||||
case BOSS4STAYPUT:
|
||||
hittype[i].actorstayput = sp->sectnum;
|
||||
act->actorstayput = sp->sectnum;
|
||||
case BOSS1:
|
||||
case BOSS2:
|
||||
case BOSS3:
|
||||
|
@ -858,7 +861,7 @@ int spawn_d(int j, int pn)
|
|||
}
|
||||
else
|
||||
{
|
||||
makeitfall(i);
|
||||
makeitfall(act);
|
||||
|
||||
if(sp->picnum == RAT)
|
||||
{
|
||||
|
@ -878,8 +881,8 @@ int spawn_d(int j, int pn)
|
|||
|
||||
if(j >= 0)
|
||||
{
|
||||
hittype[i].timetosleep = 0;
|
||||
fi.check_fta_sounds(i);
|
||||
act->timetosleep = 0;
|
||||
check_fta_sounds_d(act);
|
||||
changespritestat(i,1);
|
||||
}
|
||||
else changespritestat(i,2);
|
||||
|
@ -917,14 +920,14 @@ int spawn_d(int j, int pn)
|
|||
{
|
||||
if( spj->picnum == NUKEBARREL )
|
||||
sp->pal = 8;
|
||||
insertspriteq(&hittype[i]);
|
||||
insertspriteq(act);
|
||||
}
|
||||
|
||||
changespritestat(i,1);
|
||||
|
||||
getglobalz(i);
|
||||
getglobalz(act);
|
||||
|
||||
j = (hittype[i].floorz-hittype[i].ceilingz)>>9;
|
||||
j = (act->floorz-act->ceilingz)>>9;
|
||||
|
||||
sp->yrepeat = j;
|
||||
sp->xrepeat = 25-(j>>1);
|
||||
|
@ -933,15 +936,15 @@ int spawn_d(int j, int pn)
|
|||
break;
|
||||
|
||||
case HEAVYHBOMB:
|
||||
if(j >= 0)
|
||||
sp->owner = j;
|
||||
else sp->owner = i;
|
||||
if(j >= 0) act->SetOwner(actj);
|
||||
else act->SetOwner(act);
|
||||
|
||||
sp->xrepeat = sp->yrepeat = 9;
|
||||
sp->yvel = 4;
|
||||
case REACTOR2:
|
||||
case REACTOR:
|
||||
case RECON:
|
||||
if (initreactor(j, i, sp->picnum == RECON)) return i;
|
||||
if (initreactor(actj, act, sp->picnum == RECON)) return i;
|
||||
break;
|
||||
|
||||
case FLAMETHROWERSPRITE:
|
||||
|
@ -985,12 +988,12 @@ int spawn_d(int j, int pn)
|
|||
sp->lotag = 0;
|
||||
sp->z -= (32<<8);
|
||||
sp->zvel = -1024;
|
||||
ssp(i,CLIPMASK0);
|
||||
ssp(act, CLIPMASK0);
|
||||
sp->cstat = krand()&4;
|
||||
}
|
||||
else
|
||||
{
|
||||
sp->owner = i;
|
||||
act->SetOwner(act);
|
||||
sp->cstat = 0;
|
||||
}
|
||||
|
||||
|
@ -1023,11 +1026,11 @@ int spawn_d(int j, int pn)
|
|||
|
||||
sp->shade = -17;
|
||||
|
||||
if(j >= 0) changespritestat(i,1);
|
||||
if(j >= 0) changespritestat(act, STAT_ACTOR);
|
||||
else
|
||||
{
|
||||
changespritestat(i,2);
|
||||
makeitfall(i);
|
||||
changespritestat(act, STAT_ZOMBIEACTOR);
|
||||
makeitfall(act);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1041,21 +1044,21 @@ int spawn_d(int j, int pn)
|
|||
case BOX:
|
||||
sp->cstat = 257; // Make it hitable
|
||||
sp->extra = 1;
|
||||
changespritestat(i,6);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
break;
|
||||
|
||||
case FLOORFLAME:
|
||||
sp->shade = -127;
|
||||
changespritestat(i,6);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
break;
|
||||
|
||||
case BOUNCEMINE:
|
||||
sp->owner = i;
|
||||
act->SetOwner(act);
|
||||
sp->cstat |= 1+256; //Make it hitable
|
||||
sp->xrepeat = sp->yrepeat = 24;
|
||||
sp->shade = -127;
|
||||
sp->extra = impact_damage<<2;
|
||||
changespritestat(i,2);
|
||||
changespritestat(act, STAT_ZOMBIEACTOR);
|
||||
break;
|
||||
|
||||
case CAMERA1:
|
||||
|
@ -1089,14 +1092,14 @@ int spawn_d(int j, int pn)
|
|||
sp->cstat = 16+128+2;
|
||||
sp->xrepeat=sp->yrepeat=1;
|
||||
sp->xvel = -8;
|
||||
ssp(i,CLIPMASK0);
|
||||
ssp(act, CLIPMASK0);
|
||||
}
|
||||
case CEILINGSTEAM:
|
||||
changespritestat(i,6);
|
||||
changespritestat(i,STAT_STANDABLE);
|
||||
break;
|
||||
|
||||
case SECTOREFFECTOR:
|
||||
spawneffector(i);
|
||||
spawneffector(act);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -1112,9 +1115,8 @@ int spawn_d(int j, int pn)
|
|||
}
|
||||
else sp->cstat = 1+256;
|
||||
sp->extra = impact_damage<<2;
|
||||
sp->owner = i;
|
||||
|
||||
changespritestat(i,6);
|
||||
act->SetOwner(act);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
break;
|
||||
|
||||
case CRACK1:
|
||||
|
@ -1141,10 +1143,10 @@ int spawn_d(int j, int pn)
|
|||
}
|
||||
|
||||
sp->pal = 0;
|
||||
sp->owner = i;
|
||||
changespritestat(i,6);
|
||||
act->SetOwner(act);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
sp->xvel = 8;
|
||||
ssp(i,CLIPMASK0);
|
||||
ssp(act, CLIPMASK0);
|
||||
break;
|
||||
|
||||
case TOILET:
|
||||
|
@ -1152,7 +1154,7 @@ int spawn_d(int j, int pn)
|
|||
sp->lotag = 1;
|
||||
sp->cstat |= 257;
|
||||
sp->clipdist = 8;
|
||||
sp->owner = i;
|
||||
act->SetOwner(act);
|
||||
break;
|
||||
case CANWITHSOMETHING:
|
||||
case CANWITHSOMETHING2:
|
||||
|
@ -1172,15 +1174,15 @@ int spawn_d(int j, int pn)
|
|||
if(j >= 0)
|
||||
sp->xrepeat = sp->yrepeat = 32;
|
||||
sp->clipdist = 72;
|
||||
makeitfall(i);
|
||||
if(j >= 0)
|
||||
sp->owner = j;
|
||||
else sp->owner = i;
|
||||
makeitfall(act);
|
||||
if(j >= 0) act->SetOwner(actj);
|
||||
else act->SetOwner(act);
|
||||
|
||||
case EGG:
|
||||
if( ud.monsters_off == 1 && sp->picnum == EGG )
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0;
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(act, STAT_MISC);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1190,12 +1192,12 @@ int spawn_d(int j, int pn)
|
|||
ps[connecthead].max_actors_killed++;
|
||||
}
|
||||
sp->cstat = 257|(krand()&4);
|
||||
changespritestat(i,2);
|
||||
changespritestat(act, STAT_ZOMBIEACTOR);
|
||||
}
|
||||
break;
|
||||
case TOILETWATER:
|
||||
sp->shade = -16;
|
||||
changespritestat(i,6);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
|
|
|
@ -40,19 +40,21 @@ int spawn_r(int j, int pn)
|
|||
{
|
||||
int x;
|
||||
|
||||
int i = initspriteforspawn(j, pn, { CRACK1, CRACK2, CRACK3, CRACK4 });
|
||||
auto actj = j < 0 ? nullptr : &hittype[j];
|
||||
int i = initspriteforspawn(actj, pn, { CRACK1, CRACK2, CRACK3, CRACK4 });
|
||||
if (!(i & 0x1000000)) return i;
|
||||
i &= 0xffffff;
|
||||
auto sp = &sprite[i];
|
||||
auto spj = &sprite[j];
|
||||
auto t = hittype[i].temp_data;
|
||||
auto act = &hittype[i];
|
||||
auto sp = &act->s;
|
||||
auto spj = j < 0? nullptr : &actj->s;
|
||||
auto t = act->temp_data;
|
||||
int sect = sp->sectnum;
|
||||
|
||||
switch(sp->picnum)
|
||||
{
|
||||
default:
|
||||
default_case:
|
||||
spawninitdefault(j, i);
|
||||
spawninitdefault(actj, act);
|
||||
break;
|
||||
case RRTILE280:
|
||||
case RRTILE281:
|
||||
|
@ -152,17 +154,17 @@ int spawn_r(int j, int pn)
|
|||
if (!isRRRA()) goto default_case;
|
||||
sp->lotag = 1;
|
||||
sp->clipdist = 0;
|
||||
sp->owner = i;
|
||||
act->SetOwner(act);
|
||||
sp->extra = 0;
|
||||
changespritestat(i,115);
|
||||
changespritestat(act,115);
|
||||
break;
|
||||
case RRTILE8593:
|
||||
if (!isRRRA()) goto default_case;
|
||||
sp->lotag = 1;
|
||||
sp->clipdist = 0;
|
||||
sp->owner = i;
|
||||
act->SetOwner(act);
|
||||
sp->extra = 0;
|
||||
changespritestat(i,122);
|
||||
changespritestat(act,122);
|
||||
break;
|
||||
case RRTILE285:
|
||||
case RRTILE286:
|
||||
|
@ -298,7 +300,7 @@ int spawn_r(int j, int pn)
|
|||
break;
|
||||
case TRANSPORTERSTAR:
|
||||
case TRANSPORTERBEAM:
|
||||
spawntransporter(j, i, sp->picnum == TRANSPORTERBEAM);
|
||||
spawntransporter(actj, act, sp->picnum == TRANSPORTERBEAM);
|
||||
break;
|
||||
|
||||
case FRAMEEFFECT1:
|
||||
|
@ -335,7 +337,7 @@ int spawn_r(int j, int pn)
|
|||
changespritestat(i, STAT_MISC);
|
||||
break;
|
||||
case BLOODPOOL:
|
||||
if (spawnbloodpoolpart1(j, i)) break;
|
||||
if (spawnbloodpoolpart1(actj, act)) break;
|
||||
|
||||
if(j >= 0)
|
||||
{
|
||||
|
@ -362,7 +364,7 @@ int spawn_r(int j, int pn)
|
|||
sp->z -= (16<<8);
|
||||
if(j >= 0 && spj->pal == 6)
|
||||
sp->pal = 6;
|
||||
insertspriteq(&hittype[i]);
|
||||
insertspriteq(act);
|
||||
changespritestat(i, STAT_MISC);
|
||||
break;
|
||||
|
||||
|
@ -436,7 +438,7 @@ int spawn_r(int j, int pn)
|
|||
case FOOTPRINTS2:
|
||||
case FOOTPRINTS3:
|
||||
case FOOTPRINTS4:
|
||||
initfootprint(j, i);
|
||||
initfootprint(actj, act);
|
||||
break;
|
||||
case FEM10:
|
||||
case NAKED1:
|
||||
|
@ -556,7 +558,7 @@ int spawn_r(int j, int pn)
|
|||
if(sp->picnum == RESPAWNMARKERRED)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 8;
|
||||
if(j >= 0) sp->z = hittype[j].floorz;
|
||||
if(j >= 0) sp->z = actj->floorz;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -576,11 +578,11 @@ int spawn_r(int j, int pn)
|
|||
case BULLETHOLE:
|
||||
sp->xrepeat = sp->yrepeat = 3;
|
||||
sp->cstat = 16+(krand()&12);
|
||||
insertspriteq(&hittype[i]);
|
||||
insertspriteq(act);
|
||||
case MONEY:
|
||||
if(sp->picnum == MONEY)
|
||||
{
|
||||
hittype[i].temp_data[0] = krand()&2047;
|
||||
act->temp_data[0] = krand()&2047;
|
||||
sp->cstat = krand()&12;
|
||||
sp->xrepeat = sp->yrepeat = 8;
|
||||
sp->ang = krand()&2047;
|
||||
|
@ -590,7 +592,7 @@ int spawn_r(int j, int pn)
|
|||
|
||||
case SHELL: //From the player
|
||||
case SHOTGUNSHELL:
|
||||
initshell(j, i, sp->picnum == SHELL);
|
||||
initshell(actj, act, sp->picnum == SHELL);
|
||||
break;
|
||||
case RESPAWN:
|
||||
sp->extra = 66-13;
|
||||
|
@ -697,10 +699,10 @@ int spawn_r(int j, int pn)
|
|||
changespritestat(i, STAT_MISC);
|
||||
break;
|
||||
case CRANE:
|
||||
initcrane(j, i, CRANEPOLE);
|
||||
initcrane(actj, act, CRANEPOLE);
|
||||
break;
|
||||
case WATERDRIP:
|
||||
initwaterdrip(j, i);
|
||||
initwaterdrip(actj, act);
|
||||
break;
|
||||
case TRASH:
|
||||
|
||||
|
@ -783,7 +785,7 @@ int spawn_r(int j, int pn)
|
|||
case MINIONSTAYPUT:
|
||||
case COOTSTAYPUT:
|
||||
rrra_stayput:
|
||||
hittype[i].actorstayput = sp->sectnum;
|
||||
act->actorstayput = sp->sectnum;
|
||||
case BOULDER:
|
||||
case BOULDER1:
|
||||
case RAT:
|
||||
|
@ -1029,7 +1031,7 @@ int spawn_r(int j, int pn)
|
|||
}
|
||||
else
|
||||
{
|
||||
makeitfall(i);
|
||||
makeitfall(act);
|
||||
|
||||
if(sp->picnum == RAT)
|
||||
{
|
||||
|
@ -1042,26 +1044,26 @@ int spawn_r(int j, int pn)
|
|||
sp->cstat |= 257;
|
||||
|
||||
if(sp->picnum != 5501)
|
||||
if (actorfella(i))
|
||||
if (actorfella(act))
|
||||
ps[myconnectindex].max_actors_killed++;
|
||||
}
|
||||
|
||||
if(j >= 0)
|
||||
{
|
||||
hittype[i].timetosleep = 0;
|
||||
fi.check_fta_sounds(i);
|
||||
changespritestat(i,1);
|
||||
act->timetosleep = 0;
|
||||
check_fta_sounds_r(act);
|
||||
changespritestat(act, STAT_ACTOR);
|
||||
sp->shade = spj->shade;
|
||||
}
|
||||
else changespritestat(i,2);
|
||||
else changespritestat(act, STAT_ZOMBIEACTOR);
|
||||
|
||||
sp->shade = spj->shade;
|
||||
}
|
||||
|
||||
break;
|
||||
case LOCATORS:
|
||||
// sp->xrepeat=sp->yrepeat=0;
|
||||
sp->cstat |= 32768;
|
||||
changespritestat(i,7);
|
||||
changespritestat(act, STAT_LOCATOR);
|
||||
break;
|
||||
|
||||
case ACTIVATORLOCKED:
|
||||
|
@ -1070,13 +1072,13 @@ int spawn_r(int j, int pn)
|
|||
sp->cstat |= 32768;
|
||||
if (sp->picnum == ACTIVATORLOCKED)
|
||||
sector[sect].lotag ^= 16384;
|
||||
changespritestat(i,8);
|
||||
changespritestat(act, STAT_ACTIVATOR);
|
||||
break;
|
||||
case DOORSHOCK:
|
||||
sp->cstat |= 1+256;
|
||||
sp->shade = -12;
|
||||
|
||||
changespritestat(i,6);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
break;
|
||||
|
||||
case OOZ:
|
||||
|
@ -1086,11 +1088,11 @@ int spawn_r(int j, int pn)
|
|||
if( spj->picnum == NUKEBARREL )
|
||||
sp->pal = 8;
|
||||
|
||||
changespritestat(i,1);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
|
||||
getglobalz(i);
|
||||
getglobalz(act);
|
||||
|
||||
j = (hittype[i].floorz-hittype[i].ceilingz)>>9;
|
||||
j = (act->floorz-act->ceilingz)>>9;
|
||||
|
||||
sp->yrepeat = j;
|
||||
sp->xrepeat = 25-(j>>1);
|
||||
|
@ -1098,13 +1100,13 @@ int spawn_r(int j, int pn)
|
|||
break;
|
||||
|
||||
case HEAVYHBOMB:
|
||||
sp->owner = i;
|
||||
act->SetOwner(act);
|
||||
sp->xrepeat = sp->yrepeat = 9;
|
||||
sp->yvel = 4;
|
||||
case REACTOR2:
|
||||
case REACTOR:
|
||||
case RECON:
|
||||
if (initreactor(j, i, sp->picnum == RECON)) return i;
|
||||
if (initreactor(actj, act, sp->picnum == RECON)) return i;
|
||||
break;
|
||||
|
||||
case RPG2SPRITE:
|
||||
|
@ -1158,19 +1160,19 @@ int spawn_r(int j, int pn)
|
|||
{
|
||||
sp->zvel = 0;
|
||||
}
|
||||
ssp(i,CLIPMASK0);
|
||||
ssp(act, CLIPMASK0);
|
||||
sp->cstat = krand()&4;
|
||||
}
|
||||
else
|
||||
{
|
||||
sp->owner = i;
|
||||
act->SetOwner(act);
|
||||
sp->cstat = 0;
|
||||
}
|
||||
|
||||
if( ( ud.multimode < 2 && sp->pal != 0) || (sp->lotag > ud.player_skill) )
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0;
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(act, STAT_MISC);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1196,11 +1198,11 @@ int spawn_r(int j, int pn)
|
|||
|
||||
sp->shade = -17;
|
||||
|
||||
if(j >= 0) changespritestat(i,1);
|
||||
if(j >= 0) changespritestat(act, STAT_ACTOR);
|
||||
else
|
||||
{
|
||||
changespritestat(i,2);
|
||||
makeitfall(i);
|
||||
changespritestat(act, STAT_ZOMBIEACTOR);
|
||||
makeitfall(act);
|
||||
}
|
||||
switch (sp->picnum)
|
||||
{
|
||||
|
@ -1353,14 +1355,13 @@ int spawn_r(int j, int pn)
|
|||
sp->cstat = 16+128+2;
|
||||
sp->xrepeat=sp->yrepeat=1;
|
||||
sp->xvel = -8;
|
||||
ssp(i,CLIPMASK0);
|
||||
ssp(act, CLIPMASK0);
|
||||
}
|
||||
case CEILINGSTEAM:
|
||||
changespritestat(i,6);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
break;
|
||||
case SECTOREFFECTOR:
|
||||
spawneffector(i);
|
||||
|
||||
spawneffector(act);
|
||||
break;
|
||||
|
||||
case SEENINE:
|
||||
|
@ -1374,9 +1375,8 @@ int spawn_r(int j, int pn)
|
|||
}
|
||||
else sp->cstat = 1+256;
|
||||
sp->extra = impact_damage<<2;
|
||||
sp->owner = i;
|
||||
|
||||
changespritestat(i,6);
|
||||
act->SetOwner(act);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
break;
|
||||
|
||||
case CRACK1:
|
||||
|
@ -1393,10 +1393,10 @@ int spawn_r(int j, int pn)
|
|||
}
|
||||
|
||||
sp->pal = 0;
|
||||
sp->owner = i;
|
||||
changespritestat(i,6);
|
||||
act->SetOwner(act);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
sp->xvel = 8;
|
||||
ssp(i,CLIPMASK0);
|
||||
ssp(act, CLIPMASK0);
|
||||
break;
|
||||
|
||||
case EMPTYBIKE:
|
||||
|
@ -1410,10 +1410,10 @@ int spawn_r(int j, int pn)
|
|||
sp->xrepeat = 18;
|
||||
sp->yrepeat = 18;
|
||||
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
|
||||
sp->owner = 100;
|
||||
act->saved_ammo = 100;
|
||||
sp->cstat = 257;
|
||||
sp->lotag = 1;
|
||||
changespritestat(i,1);
|
||||
changespritestat(act, STAT_ACTOR);
|
||||
break;
|
||||
case EMPTYBOAT:
|
||||
if (!isRRRA()) goto default_case;
|
||||
|
@ -1426,7 +1426,7 @@ int spawn_r(int j, int pn)
|
|||
sp->xrepeat = 32;
|
||||
sp->yrepeat = 32;
|
||||
sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x);
|
||||
sp->owner = 20;
|
||||
act->saved_ammo = 20;
|
||||
sp->cstat = 257;
|
||||
sp->lotag = 1;
|
||||
changespritestat(i,1);
|
||||
|
@ -1439,7 +1439,7 @@ int spawn_r(int j, int pn)
|
|||
sp->lotag = 1;
|
||||
sp->cstat |= 257;
|
||||
sp->clipdist = 8;
|
||||
sp->owner = i;
|
||||
act->SetOwner(act);
|
||||
break;
|
||||
case CANWITHSOMETHING:
|
||||
case RUBBERCAN:
|
||||
|
@ -1456,27 +1456,27 @@ int spawn_r(int j, int pn)
|
|||
if(j >= 0)
|
||||
sp->xrepeat = sp->yrepeat = 32;
|
||||
sp->clipdist = 72;
|
||||
makeitfall(i);
|
||||
if(j >= 0)
|
||||
sp->owner = j;
|
||||
else sp->owner = i;
|
||||
makeitfall(act);
|
||||
if(j >= 0) act->SetOwner(actj);
|
||||
else act->SetOwner(act);
|
||||
|
||||
case EGG:
|
||||
if( ud.monsters_off == 1 && sp->picnum == EGG )
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0;
|
||||
changespritestat(i, STAT_MISC);
|
||||
changespritestat(act, STAT_MISC);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sp->picnum == EGG)
|
||||
sp->clipdist = 24;
|
||||
sp->cstat = 257|(krand()&4);
|
||||
changespritestat(i,2);
|
||||
changespritestat(act, STAT_ZOMBIEACTOR);
|
||||
}
|
||||
break;
|
||||
case TOILETWATER:
|
||||
sp->shade = -16;
|
||||
changespritestat(i,6);
|
||||
changespritestat(act, STAT_STANDABLE);
|
||||
break;
|
||||
case RRTILE63:
|
||||
sp->cstat |= 32768;
|
||||
|
|
|
@ -13,7 +13,7 @@ BEGIN_DUKE_NS
|
|||
struct STATUSBARTYPE
|
||||
{
|
||||
short frag[MAXPLAYERS], got_access, last_extra, shield_amount, curr_weapon;
|
||||
short ammo_amount[MAX_WEAPONS], holoduke_on;
|
||||
short ammo_amount[MAX_WEAPONS];
|
||||
unsigned char inven_icon, jetpack_on, heat_on;
|
||||
short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount;
|
||||
short heat_amount, scuba_amount, boot_amount;
|
||||
|
@ -29,7 +29,13 @@ struct weaponhit
|
|||
short tempang, actorstayput, dispicnum;
|
||||
short timetosleep;
|
||||
int floorz, ceilingz, lastvx, lastvy, bposx, bposy, bposz, aflags;
|
||||
union
|
||||
{
|
||||
int saved_ammo;
|
||||
int palvals;
|
||||
};
|
||||
int temp_data[6];
|
||||
weaponhit* temp_actor, *seek_actor;
|
||||
spritetype& s; // direct reference to the corresponding sprite.
|
||||
|
||||
static weaponhit* array(); // this is necessary to allow define inline functions referencing the global array inside the definition itself.
|
||||
|
@ -41,7 +47,7 @@ struct weaponhit
|
|||
{
|
||||
cgg = spriteextra = 0;
|
||||
picnum = ang = extra = owner = movflag = tempang = actorstayput = dispicnum = timetosleep = 0;
|
||||
floorz = ceilingz = lastvx = lastvy = bposx = bposy = bposz = aflags = 0;
|
||||
floorz = ceilingz = lastvx = lastvy = bposx = bposy = bposz = aflags = saved_ammo = 0;
|
||||
memset(temp_data, 0, sizeof(temp_data));
|
||||
}
|
||||
int GetIndex() const { return this - array(); }
|
||||
|
@ -54,7 +60,7 @@ struct weaponhit
|
|||
|
||||
inline void SetOwner(weaponhit* a)
|
||||
{
|
||||
s.owner = a->GetIndex();
|
||||
s.owner = a? a->GetIndex() : -1;
|
||||
}
|
||||
|
||||
// same for the 'hittype' owner - which is normally the shooter in an attack.
|
||||
|
@ -65,10 +71,10 @@ struct weaponhit
|
|||
|
||||
inline void SetHitOwner(weaponhit* a)
|
||||
{
|
||||
owner = a->GetIndex();
|
||||
owner = a ? a->GetIndex() : -1;
|
||||
}
|
||||
|
||||
// The crane is a good example of an actor hijacking the 'owner' field for something other than an actual owner. Abstract this away.
|
||||
// This used the Owner field - better move this to something more safe.
|
||||
inline bool IsActiveCrane()
|
||||
{
|
||||
return s.owner == -2;
|
||||
|
@ -104,6 +110,8 @@ struct ActorInfo
|
|||
uint32_t scriptaddress;
|
||||
uint32_t flags;
|
||||
int aimoffset;
|
||||
int falladjustz;
|
||||
int gutsoffset;
|
||||
};
|
||||
|
||||
// for now just flags not related to actors, may get more info later.
|
||||
|
@ -123,8 +131,8 @@ struct user_defs
|
|||
unsigned char user_pals[MAXPLAYERS];
|
||||
|
||||
short from_bonus;
|
||||
short camerasprite, last_camsprite;
|
||||
short last_level, secretlevel;
|
||||
short bomb_tag;
|
||||
|
||||
int const_visibility;
|
||||
|
||||
|
@ -140,6 +148,8 @@ struct user_defs
|
|||
int player_skill, marker;
|
||||
//MapRecord* nextLevel;
|
||||
|
||||
DDukeActor* cameraactor;
|
||||
|
||||
};
|
||||
|
||||
struct player_orig
|
||||
|
@ -167,7 +177,6 @@ struct player_struct
|
|||
FixedBitArray<MAX_WEAPONS> gotweapon;
|
||||
|
||||
// Palette management uses indices into the engine's palette table now.
|
||||
unsigned int palette;
|
||||
PalEntry pals;
|
||||
|
||||
// this was a global variable originally.
|
||||
|
@ -199,16 +208,16 @@ struct player_struct
|
|||
short ammo_amount[MAX_WEAPONS], frag, fraggedself;
|
||||
|
||||
short curr_weapon, last_weapon, tipincs, wantweaponfire;
|
||||
short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay;
|
||||
short holoduke_amount, hurt_delay, hbomb_hold_delay;
|
||||
short jumping_counter, airleft, knee_incs, access_incs;
|
||||
short ftq, access_wallnum, access_spritenum;
|
||||
short ftq, access_wallnum;
|
||||
short got_access, weapon_ang, firstaid_amount;
|
||||
short i, one_parallax_sectnum;
|
||||
short over_shoulder_on, fist_incs;
|
||||
short cheat_phase;
|
||||
short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick;
|
||||
short extra_extra8, quick_kick, last_quick_kick;
|
||||
short heat_amount, timebeforeexit, customexitsound;
|
||||
DDukeActor* actorsqu, *wackedbyactor, *on_crane, *holoduke_on, *somethingonplayer;
|
||||
DDukeActor* actorsqu, *wackedbyactor, *on_crane, *holoduke_on, *somethingonplayer, *access_spritenum, *dummyplayersprite, *newOwner;
|
||||
|
||||
short weaprecs[256], weapreccnt;
|
||||
unsigned int interface_toggle_flag;
|
||||
|
@ -257,7 +266,7 @@ struct player_struct
|
|||
int drug_timer;
|
||||
int SeaSick;
|
||||
short MamaEnd; // raat609
|
||||
short MotoSpeed, moto_drink;
|
||||
short moto_drink;
|
||||
float TiltStatus, oTiltStatus;
|
||||
short VBumpNow, VBumpTarget, TurbCount;
|
||||
short drug_stat[3]; // raat5f1..5
|
||||
|
@ -266,9 +275,8 @@ struct player_struct
|
|||
uint8_t hurt_delay2, nocheat;
|
||||
uint8_t OnMotorcycle, OnBoat, moto_underwater, NotOnWater, MotoOnGround;
|
||||
uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud;
|
||||
bool vehicle_turnl, vehicle_turnr, vehicle_backwards;
|
||||
|
||||
int8_t crouch_toggle;
|
||||
double vehForwardScale, vehReverseScale, MotoSpeed;
|
||||
bool vehTurnLeft, vehTurnRight;
|
||||
|
||||
// input stuff.
|
||||
InputPacket sync;
|
||||
|
|
|
@ -98,12 +98,6 @@ static void processInputBits(PLAYERp const pp, ControlInfo* const hidInput)
|
|||
else
|
||||
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch))
|
||||
{
|
||||
// this shares a bit with another function so cannot be in the common code.
|
||||
loc.actions |= SB_CROUCH_LOCK;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -1521,7 +1521,7 @@ UpdatePlayerSpriteAngle(PLAYERp pp)
|
|||
void
|
||||
DoPlayerTurn(PLAYERp pp, float const avel, double const scaleAdjust)
|
||||
{
|
||||
applylook(&pp->angle, avel, &pp->input.actions, scaleAdjust, pp->input.actions & (SB_CROUCH|SB_CROUCH_LOCK));
|
||||
applylook(&pp->angle, avel, &pp->input.actions, scaleAdjust);
|
||||
UpdatePlayerSpriteAngle(pp);
|
||||
}
|
||||
|
||||
|
@ -3788,53 +3788,14 @@ DoPlayerCrawl(PLAYERp pp)
|
|||
//#define PLAYER_STANDING_ROOM(pp) ((pp)->posz + PLAYER_CRAWL_HEIGHT - PLAYER_HEIGHT - PLAYER_RUN_CEILING_DIST)
|
||||
#define PLAYER_STANDING_ROOM Z(68)
|
||||
|
||||
if (TEST(pp->Flags, PF_LOCK_CRAWL))
|
||||
// Let off of crawl to get up
|
||||
if (!(pp->input.actions & SB_CROUCH))
|
||||
{
|
||||
if (pp->input.actions & SB_CROUCH_LOCK)
|
||||
if (labs(pp->loz - pp->hiz) >= PLAYER_STANDING_ROOM)
|
||||
{
|
||||
if (pp->KeyPressBits & SB_CROUCH_LOCK)
|
||||
{
|
||||
//if (pp->hiz < PLAYER_STANDING_ROOM(pp))
|
||||
if (labs(pp->loz - pp->hiz) >= PLAYER_STANDING_ROOM)
|
||||
{
|
||||
pp->KeyPressBits&= ~SB_CROUCH_LOCK;
|
||||
|
||||
RESET(pp->Flags, PF_CRAWLING);
|
||||
DoPlayerBeginRun(pp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pp->KeyPressBits |= SB_CROUCH_LOCK;
|
||||
}
|
||||
|
||||
// Jump to get up
|
||||
if (pp->input.actions & SB_JUMP)
|
||||
{
|
||||
if (labs(pp->loz - pp->hiz) >= PLAYER_STANDING_ROOM)
|
||||
{
|
||||
//pp->posz = pp->loz - PLAYER_HEIGHT;
|
||||
|
||||
RESET(pp->Flags, PF_CRAWLING);
|
||||
DoPlayerBeginRun(pp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Let off of crawl to get up
|
||||
if (!(pp->input.actions & SB_CROUCH))
|
||||
{
|
||||
if (labs(pp->loz - pp->hiz) >= PLAYER_STANDING_ROOM)
|
||||
{
|
||||
RESET(pp->Flags, PF_CRAWLING);
|
||||
DoPlayerBeginRun(pp);
|
||||
return;
|
||||
}
|
||||
RESET(pp->Flags, PF_CRAWLING);
|
||||
DoPlayerBeginRun(pp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6785,22 +6746,6 @@ DoPlayerRun(PLAYERp pp)
|
|||
pp->KeyPressBits |= SB_JUMP;
|
||||
}
|
||||
|
||||
// Crawl lock
|
||||
if (pp->input.actions & SB_CROUCH_LOCK)
|
||||
{
|
||||
if (pp->KeyPressBits & SB_CROUCH_LOCK)
|
||||
{
|
||||
pp->KeyPressBits &= ~SB_CROUCH_LOCK;
|
||||
SET(pp->Flags, PF_LOCK_CRAWL);
|
||||
DoPlayerBeginCrawl(pp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pp->KeyPressBits |= SB_CROUCH_LOCK;
|
||||
}
|
||||
|
||||
if (PlayerFlyKey())
|
||||
{
|
||||
DoPlayerBeginFly(pp);
|
||||
|
|
|
@ -1082,8 +1082,6 @@ void DrawConString(int x, int y, const char* string, double alpha)
|
|||
|
||||
void UpdateStatusBar()
|
||||
{
|
||||
DSWStatusBar sbar;
|
||||
|
||||
if (hud_size <= Hud_Stbar)
|
||||
{
|
||||
UpdateFrame();
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
DEFAULTLISTMENU
|
||||
{
|
||||
Font "BigFont", "Untranslated"
|
||||
LineSpacing 20
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Main Memu
|
||||
|
@ -608,11 +614,7 @@ OptionMenu "ActionControlsMenu" protected
|
|||
StaticText ""
|
||||
Control "$CNTRLMNU_JUMP" , "+jump"
|
||||
Control "$CNTRLMNU_CROUCH" , "+crouch"
|
||||
ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides, ShadowWarrior)
|
||||
{
|
||||
// Fixme: Make this work in all games
|
||||
Control "$CNTRLMNU_TOGGLECROUCH" , "+toggle_crouch"
|
||||
}
|
||||
Control "$CNTRLMNU_TOGGLECROUCH" , "+toggle_crouch"
|
||||
ifgame(Witchaven, Witchaven2)
|
||||
{
|
||||
Control "$CNTRLMNU_FLYUP" , "+alt_fire"
|
||||
|
|
|
@ -88,6 +88,11 @@ class ListMenuItemSWTextItem : ListMenuItemTextItem
|
|||
if (child == 'none') mEnabled = -1;
|
||||
}
|
||||
|
||||
override bool Selectable()
|
||||
{
|
||||
return super.Selectable() && mFont == BigFont;
|
||||
}
|
||||
|
||||
void InitDirect(double x, double y, int height, String hotkey, String text, Font font, int color, int color2, Name child, int param = 0)
|
||||
{
|
||||
Super.InitDirect(x, y, height, hotkey, text, font, color, color2, child, param);
|
||||
|
@ -95,10 +100,9 @@ class ListMenuItemSWTextItem : ListMenuItemTextItem
|
|||
|
||||
override void Draw(bool selected, ListMenuDescriptor desc)
|
||||
{
|
||||
let gamefont = generic_ui ? NewSmallFont : BigFont;
|
||||
int cr = generic_ui? Font.CR_RED : Font.CR_UNDEFINED;
|
||||
double scalex = 1.;
|
||||
|
||||
let gamefont = generic_ui ? NewSmallFont : mFont;
|
||||
int cr = mColor != Font.CR_UNDEFINED? mColor : generic_ui? Font.CR_RED : Font.CR_UNDEFINED;
|
||||
double scalex = generic_ui && mFont == SmallFont? 0.5 : 1.;
|
||||
|
||||
// The font here is very bulky and may cause problems with localized content. Account for that by squashing the text if needed.
|
||||
int length = gamefont.StringWidth(mText);
|
||||
|
@ -107,7 +111,7 @@ class ListMenuItemSWTextItem : ListMenuItemTextItem
|
|||
scalex = (315. - mXpos) / length;
|
||||
}
|
||||
|
||||
Screen.DrawText(BigFont, cr, mXpos, mYpos, mText, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, !Selectable()? 0xff505050 : 0xffffffff, DTA_ScaleX, scalex);
|
||||
Screen.DrawText(gamefont, cr, mXpos, mYpos, mText, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, !super.Selectable()? 0xff505050 : 0xffffffff, DTA_ScaleX, scalex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue