#ifndef __ass
#define __ass
-
#include <raylib.h>
#include <cstdio>
#include <ctime>
-
#define SFX_SHOOT_FILE "./shoot.wav"
#define SFX_BGM_FILE "./music.wav"
int deaths_avoided = 0;
int time_alive = 0;
+//getopts
+bool enable_fps = false; //fps counter off by default
+bool debug_nodie = false; //Perma-shield
+bool debug_shotgun = false; //Perma-shotgun
+bool debug_bomb = false; //Perma-bomb
#endif //__ass
#include <cstring>
#include <math.h>
+#include <unistd.h>
#include "assteroids.h"
#include "powerups.hpp"
#include "vectormath.hpp"
}
if(ship_collision(astr) && ship_alive){
- if((active_powerups & GOD)) {
+ if((active_powerups & GOD) || debug_nodie) {
deaths_avoided++;
continue;
}
}
-int main(void) {
+int main(int argc, char** argv) {
+ int opts;
+
+ while((opts = getopt(argc, argv, "fsgb")) != -1) {
+ switch(opts) {
+ case 'f':
+ printf("turned on fps counter\n");
+ enable_fps = true;
+ break;
+ case 's':
+ debug_nodie = true;
+ break;
+ case 'g':
+ debug_shotgun = true;
+ break;
+ case 'b':
+ debug_bomb = true;
+ break;
+ case '?':
+ default:
+ break;
+ }
+
+ }
+
InitAudioDevice();
if(IsAudioDeviceReady()) {
sfx_shoot = LoadSound(SFX_SHOOT_FILE);
spin_ship(0);
StopSound(sfx_music);
}
- if(IsKeyPressed('A') && (active_powerups & BOMB)) {
+ if(IsKeyPressed('A') && ((active_powerups & BOMB) || debug_bomb)) {
active_powerups ^= BOMB;
launch_bomb();
}
}
if(active_powerups & BOMB && bomb_proj.w == -1)
DrawCircleSectorLines(flatten(translate(nose, center)), 4.0f, 0, 360, 360, RED);
+ if(debug_shotgun)
+ enable_shotgun();
} else if(!(active_powerups & GOD)) {
DrawText("YOU DIED", (scrW/2)-(MeasureText("YOU DIED", 64)/2), (scrH/2)-64, 64, RED);
DrawText("FUCK YOU", (scrW/2)-(MeasureText("FUCK YOU", 16)/2), (scrH/2)-8, 16, RED);
draw_shield_pickup();
DrawText("[H]elp", (scrW-MeasureText("[H]elp", 32)-32), scrH-34, 32, WHITE);
DrawText(TextFormat("%d", score), 4, scrH-34, 32, WHITE);
- DrawFPS(0, 0);
+ if(enable_fps)
+ DrawFPS(0, 0);
EndDrawing();
if(throttle && !IsSoundPlaying(sfx_music)) {
PlaySound(sfx_music);
bomb_proj.w = -1;
}
if (!onscreen(flatten(bomb_proj))) {
- printf("bomb off\n");
bomb_proj.w = -1;
}
}