From 46d90f5d49d1869d65d3c5c585214b90eac3803a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 21 Oct 2020 19:38:53 +0200 Subject: [PATCH] - clearcamera and ssp. --- source/games/duke/src/actors.cpp | 20 ++++++++------------ source/games/duke/src/dukeactor.h | 11 ++++++----- source/games/duke/src/funct.h | 2 +- source/games/duke/src/player_d.cpp | 1 + source/games/duke/src/player_w.cpp | 3 ++- source/games/duke/src/spawn.cpp | 1 + source/games/duke/src/spawn_d.cpp | 1 + source/games/duke/src/spawn_r.cpp | 1 + 8 files changed, 21 insertions(+), 19 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index b77e5e0ef..a58d3df60 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -210,12 +210,11 @@ void clearcamera(player_struct* ps) updatesector(ps->posx, ps->posy, &ps->cursectnum); setpal(ps); - StatIterator it(STAT_ACTOR); - int k; - while ((k = it.NextIndex()) >= 0) + DukeStatIterator it(STAT_ACTOR); + while (auto k = it.Next()) { - if (sprite[k].picnum == TILE_CAMERA1) - sprite[k].yvel = 0; + if (k->s.picnum == TILE_CAMERA1) + k->s.yvel = 0; } } @@ -225,16 +224,13 @@ void clearcamera(player_struct* ps) // //--------------------------------------------------------------------------- -int ssp(int i, unsigned int cliptype) //The set sprite function +int ssp(DDukeActor* const actor, unsigned int cliptype) //The set sprite function { - spritetype* s; int movetype; - s = &sprite[i]; - - movetype = fi.movesprite(i, - (s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14, - (s->xvel * (sintable[s->ang & 2047])) >> 14, s->zvel, + movetype = fi.movesprite(actor->GetIndex(), + (actor->s.xvel * (sintable[(actor->s.ang + 512) & 2047])) >> 14, + (actor->s.xvel * (sintable[actor->s.ang & 2047])) >> 14, actor->s.zvel, cliptype); return (movetype == 0); diff --git a/source/games/duke/src/dukeactor.h b/source/games/duke/src/dukeactor.h index 30e6e7d13..83ac4ff04 100644 --- a/source/games/duke/src/dukeactor.h +++ b/source/games/duke/src/dukeactor.h @@ -142,11 +142,6 @@ inline DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, si 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 ssp(DDukeActor* i, unsigned int cliptype) //The set sprite function -{ - return ssp(i->GetIndex(), cliptype); -} - inline int ActorToScriptIndex(DDukeActor* a) { if (!a) return -1; @@ -213,4 +208,10 @@ 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); +} + + END_DUKE_NS diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index f813903e4..9d0b56b5a 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -100,7 +100,7 @@ void checkavailweapon(struct player_struct* p); void deletesprite(DDukeActor* num); void addammo(int weapon, struct player_struct* p, int amount); -int ssp(int i, unsigned int cliptype); //The set sprite function +int ssp(DDukeActor* i, unsigned int cliptype); //The set sprite function void insertspriteq(int i); int wakeup(int sn, int pn); diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 2f572e257..0a81c5c4c 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -37,6 +37,7 @@ source as it is released. #include "global.h" #include "gamevar.h" #include "names_d.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index bfdf2d542..cb170a77c 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -36,7 +36,8 @@ source as it is released. #include "ns.h" #include "global.h" #include "gamevar.h" - #include "names_d.h" +#include "names_d.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 45d5335ea..6e4459455 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -37,6 +37,7 @@ source as it is released. #include "global.h" #include "sounds.h" #include "automap.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 7775ce932..779b0cb51 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -36,6 +36,7 @@ source as it is released. #include "global.h" #include "sounds.h" #include "names_d.h" +#include "dukeactor.h" BEGIN_DUKE_NS diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 691dc27b9..24a95bde7 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -31,6 +31,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms #include "global.h" #include "sounds.h" #include "names_r.h" +#include "dukeactor.h" BEGIN_DUKE_NS