Debian Codegraph @

src/jj1/bonuslevel/jj1bonuslevel.h

raw symbols SCIP
1
2 /**
3 *
4 * @file jj1bonuslevel.h
5 *
6 * Part of the OpenJazz project
7 *
8 * @par History:
9 * - 3rd February 2009: Created bonus.h
10 * - 1st August 2012: Renamed bonus.h to jj1bonuslevel.h
11 *
12 * @par Licence:
13 * Copyright (c) 2009-2017 AJ Thomson
14 *
15 * OpenJazz is distributed under the terms of
16 * the GNU General Public License, version 2.0
17 *
18 */
19
20
21 #ifndef _BONUS_H
22 #define _BONUS_H
23
24 #include "io/gfx/anim.h"
25 #include "level/level.h"
26
27
28 // Constants
29
30 // General
31 #define BLW 256 /* Bonus level width */
32 #define BLH 256 /* Bonus level height */
33 #define BANIMS 32
34 #define BEVENTS 16
35 #define BSOUNDS 16
36
37 #define T_BONUS_END 2000
38
39
40 // Datatype
41
42 /// JJ1 bonus level grid element
43 typedef struct {
44
45 unsigned char tile; ///< Indexes the tile set
46 unsigned char event; ///< Event type
47
48 } JJ1BonusLevelGridElement;
49
50 /// JJ1 bonus level event type
51 typedef struct {
52
53 unsigned char anim; ///< Index of animation
54 unsigned char type; ///< Type: time, gem, pole-bounce, exit, hand-bounce
55 unsigned char passable; ///< Whether Jazz bounces back
56 unsigned char used; ///< Whether this is a real event
57 SE::Type sound; ///< The sound played on the appropriate trigger
58
59 } JJ1BonusEventType;
60
61 // Classes
62
63 class Font;
64
65 /// JJ1 bonus level
66 class JJ1BonusLevel : public Level {
67
68 private:
69 SDL_Surface* tileSet; ///< Tile images
70 SDL_Surface* background; ///< Background image
71 Font* font; ///< On-screen message font
72 Sprite* spriteSet; ///< Sprite images
73 Anim animSet[BANIMS]; ///< Animations
74 JJ1BonusEventType eventSet[BEVENTS]; ///< Event types
75 JJ1BonusLevelGridElement grid[BLH][BLW]; ///< Level grid
76 char mask[60][64]; ///< Tile masks (at most 60 tiles, all with 8 * 8 masks)
77 fixed direction; ///< Player's direction
78
79 JJ1BonusLevel(const JJ1BonusLevel&); // non construction-copyable
80 JJ1BonusLevel& operator=(const JJ1BonusLevel&); // non copyable
81
82 int loadSprites ();
83 int loadTiles (char* fileName);
84 bool isEvent (fixed x, fixed y);
85 int step ();
86 void draw ();
87
88 public:
89 JJ1BonusLevel (Game* owner, char* fileName, bool multi);
90 ~JJ1BonusLevel () override;
91
92 bool checkMask (fixed x, fixed y);
93 void receive (unsigned char* buffer) override;
94 int play ();
95
96 };
97
98 #endif
99