1 // ------------------------------------------------------------------
3 // ------------------------------------------------------------------
4 // This class is the ball of the player
5 // By Kronoman - In loving memory of my father
6 // Copyright (c) 2003,2004, Kronoman
7 // ------------------------------------------------------------------
14 #include "tmap.h" // I need to know the map where I move
15 #include "control.h" // the controller class
16 #include "partmang.h" // particle manager
20 // values that "int CBall::update_logic()" may return
22 #define CBALL_IS_FINE 0
24 #define CBALL_IS_DEAD 1
25 // I'm over the level's exit ;^D
26 #define CBALL_EXIT_LEVEL 2
29 // lives by default for SINGLE level
31 // lives by default for campaign mode
32 #define BALL_LIVES_CAMPAIGN 7
35 #define BALL_SPEED_X 0.65
36 #define BALL_SPEED_Y 0.65
37 #define BALL_SPEED_Z 0.35
39 // radius of the ball (diameter will be this size * 2
40 #define BALL_RADIUS 25
42 // max speed in any axis
43 #define BALL_MSPEED 10
46 #define N_BALL_SPEED_X 0.1
47 #define N_BALL_SPEED_Y 0.1
49 #define N_BALL_SPEED_Z 0.15
51 // max Z value of the ball (jump limit)
52 #define BALL_MAX_Z 15.0
54 // min value of Z, below here, is DEAD
55 #define BALL_MIN_Z -15.0
63 void draw(BITMAP
*bmp
, int sx
, int sy
); // draw the ball
65 int update_logic(); // updates the logic, returns status of the ball
67 // -- Data members (all public) --
68 // this vars are public to let easy access to them, (yes, I know that this broke the encapsulation)
70 float x
, y
, z
, dx
, dy
, dz
; // pos x,y,z ; speed dx, dy, dz
72 BITMAP
*spr
; // sprite (texture of sphere, will be the size of texture too)
73 BITMAP
*spr_shadow
; // shadow mask for the sphere texture
75 BITMAP
*spr_cache
; // cache for sphere rotaded sprite
77 float anglex
, angley
; // angle of rotation of the sprite (to animate it)
79 int lives
; // lives left
80 long int score
; // score
82 CTMap
*ctmap
; // pointer to the map where the ball moves, the ball NEEDS to know the map
84 CParticleManager
*particle_manager
; // pointer to game's particle manager, the ball NEEDS to add particles when get pickups, etc
86 CController control
; // controller for gameplay
88 CSoundWrapper soundw
; // sound system