~ubuntu-branches/ubuntu/natty/smc/natty

« back to all changes in this revision

Viewing changes to src/enemies/enemy.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Muammar El Khatib
  • Date: 2009-08-18 11:28:01 UTC
  • mfrom: (1.1.7 upstream) (5.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090818112801-qfhdmqouq8m1fwab
Tags: 1.9-1
* New upstream release.
* Bumped standards version to 3.8.3. No changes were needed in order to 
  accomplish this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
/* *** *** *** *** *** *** cEnemy *** *** *** *** *** *** *** *** *** *** *** */
27
27
 
28
 
cEnemy :: cEnemy( float x /* = 0 */, float y /* = 0 */ )
29
 
: cImageObjectSprite( x, y )
 
28
cEnemy :: cEnemy( float x /* = 0.0f */, float y /* = 0.0f */ )
 
29
: cAnimated_Sprite( x, y )
30
30
{
31
31
        m_sprite_array = ARRAY_ENEMY;
32
32
        m_type = TYPE_ENEMY;
35
35
 
36
36
        m_massive_type = MASS_MASSIVE;
37
37
        m_state = STA_FALL;
38
 
        dead = 0;
 
38
        m_dead = 0;
39
39
        m_can_be_ground = 1;
40
40
 
41
 
        counter = 0;
42
 
        walk_count = 0;
43
 
 
44
 
        kill_sound = "enemy/furball/die.ogg";
45
 
        kill_points = 10;
46
 
 
47
 
        fire_resistant = 0;
 
41
        m_counter = 0.0f;
 
42
 
 
43
        m_kill_sound = "enemy/furball/die.ogg";
 
44
        m_kill_points = 10;
 
45
 
 
46
        m_fire_resistant = 0;
 
47
        m_can_be_hit_from_shell = 1;
48
48
}
49
49
 
50
50
cEnemy :: ~cEnemy( void )
136
136
        }
137
137
 
138
138
        // dead ( only save if needed )
139
 
        if( dead )
 
139
        if( m_dead )
140
140
        {
141
 
                save_object->m_properties.push_back( cSave_Level_Object_Property( "dead", int_to_string( dead ) ) );
 
141
                save_object->m_properties.push_back( cSave_Level_Object_Property( "dead", int_to_string( m_dead ) ) );
142
142
        }
143
143
 
144
144
        return save_object;
146
146
 
147
147
void cEnemy :: Set_Dead( bool enable /* = 1 */ )
148
148
{
149
 
        dead = enable;
 
149
        m_dead = enable;
150
150
 
151
151
        Update_Valid_Update();
152
152
}
153
153
 
154
 
void cEnemy :: DieStep( void )
 
154
void cEnemy :: Update_Dying( void )
155
155
{
156
156
        // virtual
157
157
}
161
161
        cMovingSprite::Update();
162
162
 
163
163
        // dying animation
164
 
        if( dead && m_active )
 
164
        if( m_dead && m_active )
165
165
        {
166
 
                DieStep();
 
166
                Update_Dying();
167
167
        }
168
168
 
169
169
        // frozen
170
170
        if( m_freeze_counter )
171
171
        {
172
172
                // update gravity
173
 
                if( m_type == TYPE_FURBALL || m_type == TYPE_TURTLE || m_type == TYPE_KRUSH || m_type == TYPE_SPIKA )
 
173
                if( m_type == TYPE_FURBALL || m_type == TYPE_TURTLE || m_type == TYPE_KRUSH || m_type == TYPE_SPIKA || m_type == TYPE_SPIKEBALL )
174
174
                {
175
175
                        Update_Gravity();
176
 
                        Col_Move( 0, m_vely );
 
176
                        Col_Move( 0.0f, m_vely );
177
177
                        // todo
178
178
                        /*Col_Move( m_velx, m_vely );
179
179
 
196
196
 
197
197
                // handle collisions manually
198
198
                m_massive_type = MASS_MASSIVE;
199
 
                Collision_Check( &m_col_rect );
 
199
                cObjectCollisionType *col_list = Collision_Check( &m_col_rect );
 
200
                Add_Collisions( col_list, 1 );
 
201
                delete col_list;
200
202
                Handle_Collisions();
201
203
                m_massive_type = MASS_PASSIVE;
202
 
                return;
203
204
        }
204
205
}
205
206
 
229
230
        }
230
231
}
231
232
 
232
 
void cEnemy :: Generate_Hit_Animation( cParticle_Emitter *anim /* = NULL */ )
 
233
void cEnemy :: Generate_Hit_Animation( cParticle_Emitter *anim /* = NULL */ ) const
233
234
{
234
235
        bool create_anim = 0;
235
236
 
286
287
 
287
288
void cEnemy :: Handle_Collision( cObjectCollision *collision )
288
289
{
289
 
        if( dead )
 
290
        if( m_dead )
290
291
        {
291
292
                return;
292
293
        }
293
294
 
294
 
        cImageObjectSprite::Handle_Collision( collision );
 
295
        cAnimated_Sprite::Handle_Collision( collision );
295
296
}
296
297
 
297
298
void cEnemy :: Handle_out_of_Level( ObjectDirection dir )