| 1 |
/* |
| 2 |
=========================================================================== |
| 3 |
blockattack - Block Attack - Rise of the Blocks |
| 4 |
Copyright (C) 2005-2012 Poul Sander |
| 5 |
|
| 6 |
This program is free software: you can redistribute it and/or modify |
| 7 |
it under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation, either version 2 of the License, or |
| 9 |
(at your option) any later version. |
| 10 |
|
| 11 |
This program is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
GNU General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with this program. If not, see http://www.gnu.org/licenses/ |
| 18 |
|
| 19 |
Source information and contacts persons can be found at |
| 20 |
http://blockattack.net |
| 21 |
=========================================================================== |
| 22 |
*/ |
| 23 |
|
| 24 |
//Make sure it is only included once |
| 25 |
#ifndef _MAINVARS_HPP |
| 26 |
#define _MAINVARS_HPP |
| 27 |
|
| 28 |
#include "sago/SagoSprite.hpp" |
| 29 |
#include "BlockGame.hpp" |
| 30 |
#include "sago/SagoTextField.hpp" |
| 31 |
#include "sago/SagoTextBox.hpp" |
| 32 |
|
| 33 |
|
| 34 |
//main variables and constants |
| 35 |
|
| 36 |
|
| 37 |
//Animation lengths: |
| 38 |
#define READYTIME 500 |
| 39 |
#define BOMBTIME 200 |
| 40 |
#define CURSORTIME 200 |
| 41 |
|
| 42 |
const char sharedir[] = SHAREDIR; |
| 43 |
|
| 44 |
//All graphic in the game: |
| 45 |
sago::SagoSprite backgroundImage; //Stores the background image |
| 46 |
sago::SagoSprite backgroundSixteenNineImage; // For 16:9 format |
| 47 |
sago::SagoSprite bExit; |
| 48 |
static sago::SagoSprite bForward; //The "forward" button |
| 49 |
#if NETWORK |
| 50 |
//static sago::SagoSprite bNetwork; |
| 51 |
//static sago::SagoSprite bConnect; |
| 52 |
//static sago::SagoSprite bHost; |
| 53 |
#endif |
| 54 |
|
| 55 |
SDL_Renderer *screen; //The whole screen; |
| 56 |
|
| 57 |
const int bExitSize = 100; //height and width of the exit button |
| 58 |
const int bExitOffset = 140; //pixels from the buttom right corner to the top left of the exit button |
| 59 |
|
| 60 |
static sago::MusicHandler bgMusic; //backgroundMusic |
| 61 |
static sago::MusicHandler highbeatMusic; //Background music with higher beat |
| 62 |
|
| 63 |
static bool bMouseUp; //true if the mouse(1) is unpressed |
| 64 |
static bool bMouseUp2; //true if the mouse(2) is unpressed |
| 65 |
#if NETWORK |
| 66 |
static bool bNetworkOpen; //Show the network menu |
| 67 |
#endif |
| 68 |
static bool bNearDeathPrev; //Near death status last time checked. |
| 69 |
static bool puzzleLoaded; //true if the puzzle levels have been loaded |
| 70 |
static bool drawBalls; //if true balls are drawed to the screen, this might lower framerate too much |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
//global settings (reset everytime the game starts) |
| 75 |
static Uint8 player1Speed=0; |
| 76 |
static Uint8 player2Speed=0; |
| 77 |
static bool player1AI=false; //Is AI enabled? |
| 78 |
static bool player2AI=false; //Is AI enabled for player 2 (opponent in single player) |
| 79 |
static Uint8 player1AIlevel=3; //What level is AI? 0 min, 6 max |
| 80 |
static Uint8 player2AIlevel=3; |
| 81 |
static const Uint8 AIlevels=7; //7 possible levels: 0..6 |
| 82 |
static Uint8 player1handicap=0; |
| 83 |
static Uint8 player2handicap=0; |
| 84 |
|
| 85 |
unsigned long int currentTime; //contains the current time, so we don't call SDL_GetTickets() too often... |
| 86 |
|
| 87 |
bool twoPlayers; //True if two playerImGui_ImplSDL2_ProcessEvent(&event);s are playing |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
//Allows starting the game with just a single puzzle. Mainly to be able to open a puzzle directly from the level editor |
| 92 |
static bool singlePuzzle = false; |
| 93 |
static bool editor = false; |
| 94 |
static bool puzzleEditor = false; |
| 95 |
static int singlePuzzleNr = 0; |
| 96 |
static std::string singlePuzzleFile; |
| 97 |
|
| 98 |
#if DEBUG |
| 99 |
//frame counter (fps) |
| 100 |
unsigned long int Frames, Ticks; |
| 101 |
char FPS[10]; |
| 102 |
#endif |
| 103 |
|
| 104 |
|
| 105 |
//keySetup |
| 106 |
const int player1keys = 0; |
| 107 |
const int player2keys = 2; |
| 108 |
|
| 109 |
//Stores the controls |
| 110 |
struct control |
| 111 |
{ |
| 112 |
SDL_Keycode up; |
| 113 |
SDL_Keycode down; |
| 114 |
SDL_Keycode left; |
| 115 |
SDL_Keycode right; |
| 116 |
SDL_Keycode change; |
| 117 |
SDL_Keycode push; |
| 118 |
}; |
| 119 |
|
| 120 |
control keySettings[3]; //array to hold the controls (default and two custom) |
| 121 |
|
| 122 |
#define KEYMENU_MAXWITH 4 |
| 123 |
#define KEYMENU_MAXDEPTH 7 |
| 124 |
|
| 125 |
|
| 126 |
static const int buttonXsize = 120; |
| 127 |
static const int buttonYsize = 40; |
| 128 |
|
| 129 |
|
| 130 |
#endif |