-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgamelogic.h
84 lines (69 loc) · 2.45 KB
/
gamelogic.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include "gloommap.h"
#include "renderer.h"
#include "soundhandler.h"
class Camera;
class GloomMap;
class GameLogic
{
public:
void Init(ObjectGraphics* ograph);
void InitLevel(GloomMap* gmapin, Camera* cam, ObjectGraphics* ograph);
bool Update(Camera* cam);
int32_t GetTeleEffect();
bool GetThermo();
bool GetPlayerHit() { return playerhit; };
void WereDoneHere() { levelfinishednow = true; };
//deathhead suck logic
void SetSucking(uint64_t ns){ sucking = ns; };
void SetSucker(uint64_t ns){ sucker = ns; };
void SetSuckAngle(uint8_t ns){ suckangle = ns; };
uint64_t GetSucking(){ return sucking; };
uint64_t GetSucker(){ return sucker; };
// needed public for monster logic. This is a mess, needs refactor to split more cleanly
MapObject GetPlayerObj();
MapObject GetNamedObj(uint64_t id);
bool Collision(bool event, int32_t x, int32_t z, int32_t r, int32_t& overshoot, int32_t& closestzone);
bool AdjustPos(int32_t& overshoot, Quick& x, Quick& z, int32_t r, int32_t& closestzone);
void AddObject(MapObject o, bool first) { if (first) gmap->GetMapObjects().push_front(o); else gmap->GetMapObjects().push_back(o); };
void GetNorm(int32_t zone, int32_t& na, int32_t& nb) { na = gmap->GetZones()[zone].na; nb = gmap->GetZones()[zone].nb; };
void AddBlood(Blood b) { gmap->GetBlood().push_back(b); };
void ResetPlayer(MapObject& o);
uint8_t PickCalc(MapObject& o);
struct weapontableentry { int32_t hitpoint; int32_t damage; int32_t speed; std::vector<Shape>* shape; std::vector<Shape>* spark; SoundHandler::Sounds sound; };
weapontableentry wtable[5];
ObjectGraphics* objectgraphics;
std::list<MapObject> newobjects;
private:
GloomMap* gmap;
//currently active teleport
Teleport activetele;
bool levelfinished;
//Game has ended!
bool levelfinishednow;
int32_t FindSegDist(int32_t x, int32_t z, Zone& zone);
void CheckSuck(Camera* cam);
void DoDoor();
void DoRot();
void Rotter(int16_t x, int16_t z, int16_t&nx, int16_t& nz, int16_t camrots[4]);
void MoveBlood();
void ObjectCollision();
uint32_t animframe[160];
bool eventhit[25];
bool firedown;
//was I hit this frame?
bool playerhit = false;
//storage for data saved between levels
int16_t p1health;
int16_t p1lives;
int16_t p1weapon;
int16_t p1reload;
// and if I die in a level
Quick origx;
Quick origz;
uint32_t origrot;
//deathhead suck logic
uint64_t sucking;
uint64_t sucker;
uint8_t suckangle;
};