1
///////////////////////////////////////////////
3
// Snipe2d ludum dare 48h compo entry
8
///////////////////////////////////////////////
10
///////////////////////////////////////////////
12
// This software is provided 'as-is', without any express or implied
13
// warranty. In no event will the authors be held liable for any damages
14
// arising from the use of this software.
16
// Permission is granted to anyone to use this software for any purpose,
17
// including commercial applications, and to alter it and redistribute it
18
// freely, subject to the following restrictions:
20
// 1. The origin of this software must not be misrepresented; you must not
21
// claim that you wrote the original software. If you use this software
22
// in a product, an acknowledgment in the product documentation would be
23
// appreciated but is not required.
24
// 2. Altered source versions must be plainly marked as such, and must not be
25
// misrepresented as being the original software.
26
// 3. This notice may not be removed or altered from any source distribution.
28
// (eg. same as ZLIB license)
30
///////////////////////////////////////////////
32
// Houses are taken from a satellite picture of glasgow.
34
// The sources are a mess, as I didn't even try to do anything
35
// really organized here.. and hey, it's a 48h compo =)
41
static int lastBadGuys = -1;
42
static int lastVIPs = -1;
43
static int badGuysChangeTick = 0;
44
static int VIPsChangeTick = 0;
46
int tick = SDL_GetTicks();
48
if (lastBadGuys != Game.baddy.count)
50
lastBadGuys = Game.baddy.count;
51
badGuysChangeTick = tick;
53
if (lastVIPs != Game.vip.count)
55
lastVIPs = Game.vip.count;
56
VIPsChangeTick = tick;
59
if ( SDL_LockSurface(Game.Screen) < 0 )
63
short *tgt = (short*)Game.Screen->pixels;
67
float distance = Game.Reloading / (float)Game.ReloadTime;
68
distance = distance * distance * distance;
70
int ofs = (Game.Screen->pitch / 2) * 240;
71
for (i = 0; i < 640; i++, ofs++)
75
for (i = 0; i < 480; i++, ofs += Game.Screen->pitch / 2)
78
ofs = (Game.Screen->pitch / 2) * (int)(240 + distance * 200);
79
for (i = 0; i < 640; i++, ofs++)
80
tgt[ofs] = (short)0xC000;
82
ofs = (Game.Screen->pitch / 2) * (int)(240 - distance * 200);
83
for (i = 0; i < 640; i++, ofs++)
84
tgt[ofs] = (short)0xC000;
86
ofs = (int)(320 + distance * 300);
87
for (i = 0; i < 480; i++, ofs += Game.Screen->pitch / 2)
88
tgt[ofs] = (short)0xC000;
90
ofs = (int)(320 - distance * 300);
91
for (i = 0; i < 480; i++, ofs += Game.Screen->pitch / 2)
92
tgt[ofs] = (short)0xC000;
94
SDL_UnlockSurface(Game.Screen);
99
int ofs = (Game.Screen->pitch / 2) * 240;
100
for (i = 0; i < 640; i++, ofs++)
101
tgt[ofs] = (short)0xff00;
104
for (i = 0; i < 480; i++, ofs += Game.Screen->pitch / 2)
105
tgt[ofs] = (short)0xff00;
107
SDL_UnlockSurface(Game.Screen);
112
if(Game.verbosity >= 1) print(324, row, COLOR_YELLOW, "time: %02d:%02d", ((SDL_GetTicks() -
113
Game.GameStartTick) / 60000), ((SDL_GetTicks() - Game.GameStartTick) / 1000)%60);
115
if(Game.verbosity >= 1) {
116
if ((tick - VIPsChangeTick) < 500)
117
print(324, row, COLOR_GREEN, "VIPs %6d", Game.vip.count);
119
print(324, row, COLOR_YELLOW, "VIPs %6d", Game.vip.count);
122
if(Game.verbosity >= 2) {
123
if ((tick - badGuysChangeTick) < 500)
124
print(324, row, COLOR_RED, "Threat %6d", Game.baddy.count);
126
print(324, row, COLOR_YELLOW, "Threat %6d", Game.baddy.count);
129
if(Game.verbosity >= 2) print(324, row, COLOR_YELLOW, "Score%09.8d", Game.Score);
131
if(Game.verbosity >= 2) print(324, row, COLOR_YELLOW, "FPS %3.3f", (Game.FrameCount * 1000.0f) / (tick - Game.StartTick));
133
if(Game.verbosity >= 1) print(324, row, COLOR_YELLOW, "Zoom %7.0fx", (1.0f / Game.CoordScale) * 100);
135
if(Game.verbosity >= 2) {
136
if (Game.SightedCharacter == NULL) {
137
print(278, row, COLOR_YELLOW, "%10x", (tick >> 4) * 700);
139
print(278, row, COLOR_YELLOW, "%10x", (tick >> 3) * 1337);
141
print(278, row, COLOR_YELLOW, "%10x", (tick >> 2) * 4);
143
print(278, row, COLOR_YELLOW, "%10x", (tick >> 1) * 4935);
145
print(278, row, COLOR_YELLOW, "%10x", (int)(Game.MouseX * 0xc0c4c01a) - (tick >> 3));
147
print(278, row, COLOR_YELLOW, "%10x", (int)(Game.MouseY * 0xb4be2b3d) - (tick >> 4));
149
print(278, row, COLOR_YELLOW, "%10x", (tick << 4) * 4095);
151
print(278, row, COLOR_YELLOW, "%10x", (int)(Game.MouseZ * 0xf00ba573) - (tick >> 5));
154
print(238, row, COLOR_YELLOW, "%20s", "Citizen profile");
157
print(238, row, COLOR_YELLOW, "%20s", "Coordinates");
159
print(238, row, COLOR_YELLOW, " %6.2f - %6.2f", Game.SightedCharacter->mX, Game.SightedCharacter->mY);
162
print(238, row, COLOR_YELLOW, "%20s", "Classification");
164
switch (Game.SightedCharacter->mType)
167
print(239, row + 1, COLOR_BLACK, "%20s", "** THREAT **");
168
print(238, row, COLOR_RED, "%20s", "** THREAT **");
171
print(238, row, COLOR_YELLOW, "%20s", "Destination");
173
if (Game.SightedCharacter->mTarget != -1)
175
print(238, row, COLOR_YELLOW, " %6.2f - %6.2f", Game.characters[Game.SightedCharacter->mTarget].mX, Game.characters[Game.SightedCharacter->mTarget].mY);
178
print(238, row, COLOR_YELLOW, "%20s", "Distance");
180
print(238, row, COLOR_YELLOW, " %15.2f", distance(Game.characters[Game.SightedCharacter->mTarget].mX, Game.characters[Game.SightedCharacter->mTarget].mY, Game.SightedCharacter->mX, Game.SightedCharacter->mY));
183
print(238, row, COLOR_YELLOW, "%20s", "Unknown");
186
print(238, row, COLOR_YELLOW, "%20s", "VPB file ID");
188
print(238, row, COLOR_YELLOW, " %03X-%07X/%02X",
189
((((uintptr_t)Game.SightedCharacter) * 7001337) & 0xfff),
190
(((uintptr_t)Game.SightedCharacter) * 1337357) & 0xfffffff,
191
(((uintptr_t)Game.SightedCharacter) * 70741) & 0xff);
196
print(239, row + 1, COLOR_BLACK, "%20s", "- VIP -");
197
print(238, row, COLOR_GREEN, "%20s", "- VIP -");
200
print(238, row, COLOR_YELLOW, "%20s", "Destination");
202
print(238, row, COLOR_YELLOW, " %6.2f - %6.2f", (float)Game.spawnpoints[Game.SightedCharacter->mTarget].mX, (float)Game.spawnpoints[Game.SightedCharacter->mTarget].mY);
205
print(238, row, COLOR_YELLOW, "%20s", "Distance");
207
print(238, row, COLOR_YELLOW, " %15.2f", distance((float)Game.spawnpoints[Game.SightedCharacter->mTarget].mX, (float)Game.spawnpoints[Game.SightedCharacter->mTarget].mY, Game.SightedCharacter->mX, Game.SightedCharacter->mY));
210
print(238, row, COLOR_YELLOW, "%20s", "Net worth");
212
print(238, row, COLOR_YELLOW, "%20s", "Classified");
215
print(238, row, COLOR_YELLOW, "%20s", "Citizen");
218
print(238, row, COLOR_YELLOW, "%20s", "Net worth");
220
print(238, row, COLOR_YELLOW, "%17u KC", (((uintptr_t)Game.SightedCharacter) * 1337357) % 71937);
223
print(238, row, COLOR_YELLOW, "%20s", "Splat.");
226
print(238, row, COLOR_BLACK, "%20s", "Missed shot");
234
if (Game.FrameCount > 100)
237
Game.StartTick = tick;