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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
// Game object
// Copyright (C) 2002 David Rosen
// Copyright (C) 2003 Steven Fuller
// Copyright (C) 2003 Zachary Jack Slater
// Copyright (C) 2021 Nguyễn Gia Phong
//
// This file is part of Black Shades.
//
// Black Shades is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Black Shades is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Black Shades. If not, see <https://www.gnu.org/licenses/>.
#ifndef BLACKSHADES_GAME_H
#define BLACKSHADES_GAME_H
#define num_blocks 100
#define block_spacing 360
#define max_people 90
#define max_people_block 20
extern float multiplier;
#include <stdbool.h>
#include <AL/al.h>
#include <GL/gl.h>
#include <GLFW/glfw3.h>
#include "Camera.h"
#include "Quaternions.h"
#include "config.h"
#include "misc.h"
#ifdef __cplusplus
#include "Skeleton.h"
#include "Models.h"
#include "Text.h"
#include "Sprites.h"
#include "Person.h"
#include "Decals.h"
struct Game {
// Graphics
int screenwidth, screenheight;
float viewdistance;
// Mouse
float mouse_sensitivity;
// Project specific
int cityrotation[num_blocks][num_blocks];
int citytype[num_blocks][num_blocks];
int citypeoplenum[num_blocks][num_blocks];
bool initialized = false;
float flashamount;
float flashr,flashg,flashb;
int enemystate;
float losedelay;
Model blocks[4];
Model blockwalls[4];
Model blockcollide[4];
Model blocksimplecollide[4];
Model blockroofs[4];
Model blockocclude;
Model sidewalkcollide;
Model street;
Model Bigstreet;
Model path;
Model blocksimple;
struct XYZ boundingpoints[8];
Text text;
int goodkills;
int badkills;
int civkills;
bool debug;
bool paused;
bool menu;
struct XYZ lastshot[2];
bool zoom;
int numpeople;
float spawndelay;
bool musictoggle;
float psychicpower;
int type;
int mouseoverbutton;
Person person[max_people];
GLuint personspritetextureptr;
GLuint deadpersonspritetextureptr;
GLuint scopetextureptr;
GLuint flaretextureptr;
void *decals;
bool gameinprogress;
bool beatgame;
int murderer;
float timeremaining;
int whichsong;
int highscore;
int score;
int mission;
int nummissions;
struct Level* levels;
int numpossibleguns;
int possiblegun[6];
int evilprobability;
float difficulty;
// Game functions
void DrawGLScene();
void Tick();
};
#else // __cplusplus
typedef struct Game Game;
#endif // __cplusplus
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
Game* makeGame(void *decals, struct Config config, struct Scores scores);
void initGl(Game* game);
void initGame(Game* game);
void resizeWindow(Game* game, int width, int height);
void look(Game* game, double xpos, double ypos);
void click(Game* game, int button, int action, int mods);
void handleKey(Game* game, int key, int action, int mods);
void setMenu(Game* game, bool value);
void eventLoop(Game* game);
struct Scores getScores(Game* game);
void closeGame(Game* game);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // BLACKSHADES_GAME_H
|