- fixed compile

This commit is contained in:
Christoph Oelckers 2020-06-21 22:53:08 +02:00
parent 4c47361132
commit 0dacfb0049
6 changed files with 69 additions and 4 deletions

View file

@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sounds.h" #include "sounds.h"
#include "v_text.h" #include "v_text.h"
#include "printf.h" #include "printf.h"
#include "sector.h"
BEGIN_EDUKE_NS BEGIN_EDUKE_NS

View file

@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecontrol.h" #include "gamecontrol.h"
#include "menu.h" #include "menu.h"
#include "memarena.h" #include "memarena.h"
#include "sector.h"

View file

@ -3976,7 +3976,7 @@ badindex:
VM_ASSERT((unsigned)in.x < MAXSPRITES && (unsigned)in.y < MAXSPRITES, "invalid sprite %d, %d\n", in.x, in.y); VM_ASSERT((unsigned)in.x < MAXSPRITES && (unsigned)in.y < MAXSPRITES, "invalid sprite %d, %d\n", in.x, in.y);
Gv_SetVar(out, (VM_DECODE_INST(tw) == CON_LDIST ? ldist : dist)(&sprite[in.x], &sprite[in.y])); Gv_SetVar(out, VM_DECODE_INST(tw) == CON_LDIST ? ldist(&sprite[in.x], &sprite[in.y]) : dist(&sprite[in.x], &sprite[in.y]));
dispatch(); dispatch();
} }
@ -5233,7 +5233,7 @@ badindex:
// <type> <maxdistvarid> <varid> // <type> <maxdistvarid> <varid>
int const decodedInst = VM_DECODE_INST(tw); int const decodedInst = VM_DECODE_INST(tw);
int const actorsOnly = (decodedInst == CON_FINDNEARACTOR || decodedInst == CON_FINDNEARACTOR3D); int const actorsOnly = (decodedInst == CON_FINDNEARACTOR || decodedInst == CON_FINDNEARACTOR3D);
auto const dist_funcptr = (decodedInst == CON_FINDNEARACTOR || decodedInst == CON_FINDNEARSPRITE) ? &ldist : &dist; auto const dist_funcptr = (decodedInst == CON_FINDNEARACTOR || decodedInst == CON_FINDNEARSPRITE);
int const findTile = *insptr++; int const findTile = *insptr++;
int maxDist = Gv_GetVar(*insptr++); int maxDist = Gv_GetVar(*insptr++);
@ -5250,7 +5250,7 @@ badindex:
{ {
if (sprite[spriteNum].picnum == findTile && spriteNum != vm.spriteNum) if (sprite[spriteNum].picnum == findTile && spriteNum != vm.spriteNum)
{ {
int const foundDist = dist_funcptr(vm.pSprite, &sprite[spriteNum]); int const foundDist = dist_funcptr? ldist(vm.pSprite, &sprite[spriteNum]) : dist(vm.pSprite, &sprite[spriteNum]);
if (foundDist < maxDist) if (foundDist < maxDist)
{ {

View file

@ -350,7 +350,7 @@ static int CheckShootSwitchTile(int tileNum)
static int32_t safeldist(int32_t spriteNum, const void *pSprite) static int32_t safeldist(int32_t spriteNum, const void *pSprite)
{ {
int32_t distance = ldist(&sprite[spriteNum], pSprite); int32_t distance = ldist(&sprite[spriteNum],(uspritetype*)pSprite);
return distance ? distance : 1; return distance ? distance : 1;
} }

View file

@ -176,6 +176,68 @@ EXTERN_INLINE int32_t G_GetPlayerInSector(int32_t const sect)
#endif #endif
// These are from duke's sector.c
inline int ldist(const spritetype* s1, const spritetype* s2)
{
int vx, vy;
vx = s1->x - s2->x;
vy = s1->y - s2->y;
return(FindDistance2D(vx, vy) + 1);
}
inline int ldist(const uspritetype* s1, const spritetype* s2)
{
int vx, vy;
vx = s1->x - s2->x;
vy = s1->y - s2->y;
return(FindDistance2D(vx, vy) + 1);
}
inline int ldist(const spritetype* s1, const uspritetype* s2)
{
int vx, vy;
vx = s1->x - s2->x;
vy = s1->y - s2->y;
return(FindDistance2D(vx, vy) + 1);
}
inline int ldist(const uspritetype* s1, const uspritetype* s2)
{
int vx, vy;
vx = s1->x - s2->x;
vy = s1->y - s2->y;
return(FindDistance2D(vx, vy) + 1);
}
inline int dist(const spritetype* s1, const spritetype* s2)
{
int vx, vy, vz;
vx = s1->x - s2->x;
vy = s1->y - s2->y;
vz = s1->z - s2->z;
return(FindDistance3D(vx, vy, vz >> 4));
}
inline int dist(const uspritetype* s1, const uspritetype* s2)
{
int vx, vy, vz;
vx = s1->x - s2->x;
vy = s1->y - s2->y;
vz = s1->z - s2->z;
return(FindDistance3D(vx, vy, vz >> 4));
}
inline int dist(const uspritetype* s1, const spritetype* s2)
{
int vx, vy, vz;
vx = s1->x - s2->x;
vy = s1->y - s2->y;
vz = s1->z - s2->z;
return(FindDistance3D(vx, vy, vz >> 4));
}
END_EDUKE_NS END_EDUKE_NS
#endif #endif

View file

@ -190,6 +190,7 @@ inline int checkcursectnums(int se)
return G_CheckPlayerInSector(se); return G_CheckPlayerInSector(se);
} }
// These are from duke's sector.c
inline int ldist(const spritetype* s1, const spritetype* s2) inline int ldist(const spritetype* s1, const spritetype* s2)
{ {
int vx, vy; int vx, vy;