aboutsummaryrefslogtreecommitdiff
path: root/src/GameTick.cpp
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2023-11-28 19:00:59 +0900
committerNguyễn Gia Phong <cnx@loang.net>2023-11-28 23:37:43 +0900
commitb4c1194c6931b3cb11b59f5b8e2c12f45b9f9d03 (patch)
treed7747470c04bb9a689ca420a5fdb10daa85b136f /src/GameTick.cpp
parent8fe52d3bc5ca77bef22fbb366050c0e4ba2de1e2 (diff)
downloadblackshades-b4c1194c6931b3cb11b59f5b8e2c12f45b9f9d03.tar.gz
Move decals struct to Zig
Diffstat (limited to 'src/GameTick.cpp')
-rw-r--r--src/GameTick.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/GameTick.cpp b/src/GameTick.cpp
index 311ba9a..68fe508 100644
--- a/src/GameTick.cpp
+++ b/src/GameTick.cpp
@@ -23,6 +23,7 @@
// along with Black Shades. If not, see <https://www.gnu.org/licenses/>.
#include <algorithm>
+#include <cassert>
#include "Game.h"
#include "misc.h"
@@ -41,7 +42,6 @@ extern float snowdelay;
extern float precipitationdensity;
extern float soundscalefactor;
extern int slomo;
-extern Decals decals;
#define maxfallvel 40
@@ -722,18 +722,9 @@ void bleed(Game* game, size_t i)
XYZ move {(float) x * block_spacing, 0.0f, (float) y * block_spacing, };
auto whichtri = segCrossModelTrans(overpoint, underpoint,
&game->sidewalkcollide, move, rot, &loc);
-
- XYZ normish {0.0f, 1.0f, 0.0f};
- if (whichtri >= 0) {
- addDecal(&decals, BLOOD_POOL, loc, 12, normish,
- whichtri, &game->sidewalkcollide, move, rot);
- } else {
- loc = person.skeleton.joints[abdomen].position;
- loc.y = -0.5f;
- move = {0.0f};
- addDecal(&decals, BLOOD_POOL, loc, 12, normish,
- 0, &game->sidewalkcollide, move, 0);
- }
+ assert(whichtri >= 0);
+ addDecal(game->decals, BLOOD_POOL, loc, 12, {0.0f, 1.0f, 0.0f},
+ whichtri, &game->sidewalkcollide, move, rot);
person.firstlongdead = true;
return;
}
@@ -974,7 +965,6 @@ void Game::Tick()
spawnNpc(this);
sprites.DoStuff();
- updateDecals(&decals);
// Facing
XYZ facing {0, 0, -1};
@@ -1739,7 +1729,7 @@ void Game::Tick()
hitNorm = {0.0f, 1.0f, 0.0f};
hit_terrain:
whichhit = -1;
- addDecal(&decals, BULLET_HOLE, wallhit, 0.7f,
+ addDecal(this->decals, BULLET_HOLE, wallhit, 0.7f,
hitNorm, whichtri, model, move, hitRot);
const auto& velocity = hitNorm * 3;
switch (person[j].whichgun) {
@@ -2096,7 +2086,7 @@ hit_terrain:
const auto& normalrotated = rotate(blocks[citytype[wherex][wherey]].faces[whichtri][0].normal,
0, cityrotation[wherex][wherey] * 90, 0);
if (sprites.size[i] > 1)
- addDecal(&decals, CRATER, wallhit, 9.0f,
+ addDecal(this->decals, CRATER, wallhit, 9.0f,
normalrotated, whichtri,
&blocks[citytype[wherex][wherey]],
move, cityrotation[wherex][wherey] * 90);
@@ -2132,7 +2122,7 @@ hit_terrain:
move = {};
sprites.location[i].y=-.5;
XYZ normish = {0.0f, 1.0f, 0.0f};
- addDecal(&decals, CRATER, sprites.location[i], 9.0f,
+ addDecal(this->decals, CRATER, sprites.location[i], 9.0f,
normish, 0, blocks + citytype[wherex][wherey], move, 0);
}
@@ -2257,14 +2247,14 @@ hit_terrain:
move, cityrotation[wherex][wherey] * 90, &temp);
XYZ normish = {0.0f, 1.0f, 0.0f};
if (whichtri > -1) {
- addDecal(&decals, CRATER, sprites.location[i], 9.0f,
+ addDecal(this->decals, CRATER, sprites.location[i], 9.0f,
normish, 0, &sidewalkcollide, move,
cityrotation[wherex][wherey]*90);
} else {
temp = sprites.location[i];
temp.y = -0.5f;
move = {0.0f};
- addDecal(&decals, CRATER, sprites.location[i], 9.0f,
+ addDecal(this->decals, CRATER, sprites.location[i], 9.0f,
normish, 0, &sidewalkcollide, move, 0);
}