101 lines
2.0 KiB
C
101 lines
2.0 KiB
C
/*
|
|
* Metro Siberia 4 - A sequel to Dark Storm's Metro Siberia 3 for CASIO calculators.
|
|
* Copyright (C) 2015 Dark Storm
|
|
* Copyright (C) 2022 Mibi88
|
|
*
|
|
* This program 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 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program 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 this program. If not, see https://www.gnu.org/licenses/.
|
|
*/
|
|
|
|
#ifndef _ENGINE_H
|
|
#define _ENGINE_H
|
|
|
|
/* Global defines */
|
|
|
|
#ifndef NULL
|
|
#define NULL (void*)(0)
|
|
#endif
|
|
|
|
// Timers delays
|
|
#define TIMER_PHYSIC 25
|
|
|
|
// Physic constants
|
|
#define GRAVITY 0.981 // px . s^{-2}
|
|
#define THRUST 2.0 * GRAVITY // px . s^{-2}
|
|
#define HORIZONTAL_SPEED 20.0 // px . s^{-1}
|
|
|
|
// Margin before the ship
|
|
#define MARGIN 32
|
|
|
|
// Time between the smoke cubes
|
|
#define SMOKE_CUBES_SPACING 8
|
|
|
|
|
|
// Increment score_delay after SCORE_DELAY frames.
|
|
#define SCORE_DELAY 16
|
|
|
|
// Relative position of tops of the ship
|
|
/*#define SHIP_TOP_1_X 10
|
|
#define SHIP_TOP_1_Y 0
|
|
#define SHIP_TOP_2_X -5
|
|
#define SHIP_TOP_2_Y 5
|
|
#define SHIP_TOP_3_X -5
|
|
#define SHIP_TOP_3_Y -5*/
|
|
#define SHIP_TOP_1_X 9
|
|
#define SHIP_TOP_1_Y 0
|
|
#define SHIP_TOP_2_X 0
|
|
#define SHIP_TOP_2_Y 3
|
|
#define SHIP_TOP_3_X 0
|
|
#define SHIP_TOP_3_Y -3
|
|
|
|
#define MENU_MAX 1
|
|
|
|
/* Enumerations */
|
|
|
|
// Menu entries
|
|
|
|
#define PLAY 0
|
|
#define QUIT 1
|
|
|
|
/* Structures */
|
|
typedef struct { float x, y; } Vector;
|
|
|
|
typedef struct
|
|
{
|
|
Vector position;
|
|
Vector speed;
|
|
Vector acceleration;
|
|
Vector scrolling;
|
|
bool thrust;
|
|
|
|
Vector tops[3];
|
|
|
|
int score;
|
|
} Ship;
|
|
|
|
typedef struct
|
|
{
|
|
int x, y;
|
|
} Camera;
|
|
|
|
|
|
/* Functions */
|
|
|
|
int play_game(void);
|
|
void draw(void);
|
|
int move(void);
|
|
|
|
void calculate_tops(void);
|
|
|
|
#endif // _ENGINE_H
|