145 lines
4.7 KiB
C
Raw Normal View History

2012-08-14 18:07:04 -04:00
/*****************************************************************************
* Model: game.qm
2012-12-10 16:00:27 -05:00
* File: ./game.h
2012-08-14 18:07:04 -04:00
*
2013-09-23 14:34:35 -04:00
* This code has been generated by QM tool (see state-machine.com/qm).
* DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
2012-08-14 18:07:04 -04:00
*
2013-09-23 14:34:35 -04:00
* This program is open source 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.
*
* 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.
2012-08-14 18:07:04 -04:00
*****************************************************************************/
2014-04-06 11:43:13 -04:00
/*${.::game.h} .............................................................*/
2012-08-14 18:07:04 -04:00
#ifndef game_h
#define game_h
2016-06-10 21:50:26 -04:00
enum GameSignals { /* signals used in the game */
TIME_TICK_SIG = Q_USER_SIG, /* published from tick ISR */
2012-08-14 18:07:04 -04:00
PLAYER_TRIGGER_SIG, /* published by Player (ISR) to trigger the Missile */
2016-06-10 21:50:26 -04:00
PLAYER_QUIT_SIG, /* published by Player (ISR) to quit the game */
GAME_OVER_SIG, /* published by Ship when it finishes exploding */
2012-08-14 18:07:04 -04:00
/* insert other published signals here ... */
2016-06-10 21:50:26 -04:00
MAX_PUB_SIG, /* the last published signal */
2012-08-14 18:07:04 -04:00
2016-06-10 21:50:26 -04:00
PLAYER_SHIP_UP_SIG, /* posted by Player (ISR) to Ship to move it up */
PLAYER_SHIP_DOWN_SIG, /* posted by Player (ISR) to Ship to let if fall */
2012-08-14 18:07:04 -04:00
2016-06-10 21:50:26 -04:00
BLINK_TIMEOUT_SIG, /* signal for Tunnel's blink timeout event */
SCREEN_TIMEOUT_SIG, /* signal for Tunnel's screen timeout event */
2012-08-14 18:07:04 -04:00
2016-06-10 21:50:26 -04:00
TAKE_OFF_SIG, /* from Tunnel to Ship to grant permission to take off */
HIT_WALL_SIG, /* from Tunnel to Ship when Ship hits the wall */
HIT_MINE_SIG, /* from Mine to Ship or Missile when it hits the mine */
SHIP_IMG_SIG, /* from Ship to the Tunnel to draw and check for hits */
MISSILE_IMG_SIG, /* from Missile the Tunnel to draw and check for hits */
MINE_IMG_SIG, /* sent by Mine to the Tunnel to draw the mine */
MISSILE_FIRE_SIG, /* sent by Ship to the Missile to fire */
2012-08-14 18:07:04 -04:00
DESTROYED_MINE_SIG, /* from Missile to Ship when Missile destroyed Mine */
2016-06-10 21:50:26 -04:00
EXPLOSION_SIG, /* from any exploding object to render the explosion */
MINE_PLANT_SIG, /* from Tunnel to the Mine to plant it */
MINE_DISABLED_SIG, /* from Mine to Tunnel when it becomes disabled */
MINE_RECYCLE_SIG, /* sent by Tunnel to Mine to recycle the mine */
SCORE_SIG, /* from Ship to Tunnel to adjust game level based on score */
2012-08-14 18:07:04 -04:00
2016-06-10 21:50:26 -04:00
MAX_SIG /* the last signal (keep always last) */
2012-08-14 18:07:04 -04:00
};
2014-04-06 11:43:13 -04:00
/*${Events::ObjectPosEvt} ..................................................*/
typedef struct {
2012-08-14 18:07:04 -04:00
/* protected: */
QEvt super;
/* public: */
uint8_t x;
uint8_t y;
} ObjectPosEvt;
2014-04-06 11:43:13 -04:00
/*${Events::ObjectImageEvt} ................................................*/
typedef struct {
2012-08-14 18:07:04 -04:00
/* protected: */
QEvt super;
/* public: */
uint8_t x;
int8_t y;
uint8_t bmp;
} ObjectImageEvt;
2014-04-06 11:43:13 -04:00
/*${Events::MineEvt} .......................................................*/
typedef struct {
2012-08-14 18:07:04 -04:00
/* protected: */
QEvt super;
/* public: */
uint8_t id;
} MineEvt;
2014-04-06 11:43:13 -04:00
/*${Events::ScoreEvt} ......................................................*/
typedef struct {
2012-08-14 18:07:04 -04:00
/* protected: */
QEvt super;
/* public: */
uint16_t score;
} ScoreEvt;
2016-06-10 21:50:26 -04:00
#define GAME_TUNNEL_WIDTH BSP_SCREEN_WIDTH
#define GAME_TUNNEL_HEIGHT (BSP_SCREEN_HEIGHT - 10U)
2014-04-06 11:43:13 -04:00
#define GAME_MINES_MAX 5U
#define GAME_MINES_DIST_MIN 10U
#define GAME_SPEED_X 1U
#define GAME_MISSILE_SPEED_X 2U
#define GAME_SHIP_X 10U
2016-06-10 21:50:26 -04:00
#define GAME_SHIP_Y (GAME_TUNNEL_HEIGHT / 2U)
#define GAME_WALLS_GAP_Y 50U
#define GAME_WALLS_MIN_GAP_Y 20U
2012-08-14 18:07:04 -04:00
enum GameBitmapIds {
SHIP_BMP,
MISSILE_BMP,
MINE1_BMP,
MINE2_BMP,
MINE2_MISSILE_BMP,
EXPLOSION0_BMP,
EXPLOSION1_BMP,
EXPLOSION2_BMP,
EXPLOSION3_BMP,
MAX_BMP
};
/* active objects' "constructors" */
2014-04-06 11:43:13 -04:00
/*${AOs::Tunnel_ctor} ......................................................*/
2012-08-14 18:07:04 -04:00
void Tunnel_ctor(void);
2014-04-06 11:43:13 -04:00
/*${AOs::Ship_ctor} ........................................................*/
2012-08-14 18:07:04 -04:00
void Ship_ctor(void);
2014-04-06 11:43:13 -04:00
/*${AOs::Missile_ctor} .....................................................*/
2012-08-14 18:07:04 -04:00
void Missile_ctor(void);
/* instantiation of the Mines orthogonal components */
2014-04-06 11:43:13 -04:00
/*${AOs::Mine1_ctor} .......................................................*/
2013-12-30 17:37:40 -05:00
QMsm * Mine1_ctor(uint8_t id);
2012-08-14 18:07:04 -04:00
2014-04-06 11:43:13 -04:00
/*${AOs::Mine2_ctor} .......................................................*/
2013-12-30 17:37:40 -05:00
QMsm * Mine2_ctor(uint8_t id);
2012-08-14 18:07:04 -04:00
/* opaque pointers to active objects in the application */
2015-05-14 15:45:53 -04:00
extern QMActive * const AO_Tunnel;
2013-09-23 14:34:35 -04:00
2015-05-14 15:45:53 -04:00
extern QMActive * const AO_Ship;
2013-09-23 14:34:35 -04:00
2015-05-14 15:45:53 -04:00
extern QMActive * const AO_Missile;
2012-08-14 18:07:04 -04:00
2013-09-23 14:34:35 -04:00
2012-08-14 18:07:04 -04:00
#endif /* game_h */