From 0c8ed75d54b6260408319eb4eb441d243bcb5fca Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 17 Aug 2022 00:25:03 +0200 Subject: [PATCH] - SW: SpawnActor with float vector --- source/games/sw/src/sprite.cpp | 4 ++-- source/games/sw/src/sprite.h | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 6301782c4..83162eb0a 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -871,7 +871,7 @@ void SpawnUser(DSWActor* actor, short id, STATE* state) actor->user.hi_sectp = actor->sector(); } -DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, int x, int y, int z, int init_ang, int vel) +DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, const DVector3& pos, int init_ang, int vel) { if (sect == nullptr) return nullptr; @@ -880,7 +880,7 @@ DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, int x, in auto spawnedActor = insertActor(sect, stat); - spawnedActor->set_int_pos({ x, y, z }); + spawnedActor->spr.pos = pos; SpawnUser(spawnedActor, id, state); diff --git a/source/games/sw/src/sprite.h b/source/games/sw/src/sprite.h index 5888cf2d9..ffc39b7ce 100644 --- a/source/games/sw/src/sprite.h +++ b/source/games/sw/src/sprite.h @@ -31,7 +31,12 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS void KillActor(DSWActor* actor); -DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, int x, int y, int z, int ang, int vel); +DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, const DVector3& pos, int ang, int vel); +inline DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, int x, int y, int z, int ang, int vel) +{ + auto vec= DVector3(x * inttoworld, y * inttoworld, z * zinttoworld); + return SpawnActor(stat, id, state, sect, vec, ang, vel); +} void SpriteSetup(void); int move_actor(DSWActor* actor, int xchange, int ychange, int zchange);