@@ -25,11 +25,13 @@ Combatant::Combatant(Controller* Controls)
2525
2626 item_held_index = -1 ;
2727
28+ sinking_depth = 0 ;
29+
2830 magicrampindex = 0 ;
2931 magicrampdelay = 0 ;
3032
3133 speed_delay = 0 ;
32- Speed = 5 ;
34+ Speed = 4 ;
3335
3436 CurrentPower = COMBATANT_POWER;
3537 world_zone = nullptr ;
@@ -73,6 +75,7 @@ void Combatant::OnUpdate()
7375 weapon_change_on_stand = false ;
7476 }
7577 SetNewState ( curState->NextState );
78+ ProposeMove ( ScreenX, ScreenY );
7679 }
7780
7881 if ( (Controls->GetState () & Controller::WEAPON) == Controller::WEAPON )
@@ -258,7 +261,30 @@ void Combatant::OnUpdate()
258261
259262 }
260263
264+ if ( CurrentState == CombatantState::FALLING )
265+ {
266+ if ( world_z > world_zone->WorldZ )
267+ {
268+ world_z -= 4 ;
269+ ScreenY += 4 ;
270+ } else {
271+ world_z = world_zone->WorldZ ;
272+ SetNewState ( CombatantState::FALLING_LANDED );
273+ ProposeMove ( ScreenX, ScreenY );
274+ }
275+ }
261276
277+ if ( CurrentState == CombatantState::SINKING )
278+ {
279+ sinking_depth += 4 ;
280+ if ( sinking_depth >= 42 )
281+ {
282+ // Check if transporting first
283+ SetNewState ( CombatantState::DEAD );
284+ ScreenX = -60 ;
285+ return ;
286+ }
287+ }
262288
263289 }
264290
@@ -291,10 +317,23 @@ void Combatant::OnRender()
291317 // Render
292318 if ( shadowed )
293319 {
294- SkinGraphic->DrawPartial ( 0 , 168 , 32 , 42 , ScreenX - 16 , ScreenY - 40 , 0 );
320+ if ( CurrentState == CombatantState::FALLING || CurrentState == CombatantState::LONGJUMP || CurrentState == CombatantState::SHORTJUMP )
321+ {
322+ SkinGraphic->DrawPartial ( 0 , 168 , 32 , 42 , ScreenX - 16 , ScreenY - 40 + world_z - world_zone->WorldZ , 0 );
323+ } else {
324+ SkinGraphic->DrawPartial ( 0 , 168 , 32 , 42 , ScreenX - 16 , ScreenY - 40 , 0 );
325+ }
295326 }
296327
297- SkinGraphic->DrawPartial ( (framenumber % 13 ) * 32 , (framenumber / 13 ) * 42 , 32 , 42 , ScreenX - 16 , ScreenY - 40 - zpos, flipflag );
328+ if ( CurrentState == CombatantState::SINKING )
329+ {
330+ if ( sinking_depth < 42 )
331+ {
332+ SkinGraphic->DrawPartial ( (framenumber % 13 ) * 32 , (framenumber / 13 ) * 42 , 32 , 42 - sinking_depth, ScreenX - 16 , ScreenY - 40 - zpos + sinking_depth, flipflag );
333+ }
334+ } else {
335+ SkinGraphic->DrawPartial ( (framenumber % 13 ) * 32 , (framenumber / 13 ) * 42 , 32 , 42 , ScreenX - 16 , ScreenY - 40 - zpos, flipflag );
336+ }
298337}
299338
300339void Combatant::OnUpdateMagic ()
@@ -341,6 +380,7 @@ void Combatant::SetNewState(CombatantState::States NewState)
341380
342381 CurrentState = NewState;
343382 CurrentStateTime = 0 ;
383+ sinking_depth = 0 ;
344384
345385 if ( CombatantState::StateList[CurrentState]->LockControls )
346386 {
@@ -386,7 +426,11 @@ void Combatant::SetRoomZone(RoomZone* CurrentZone, bool IsWarped)
386426 }
387427 // TODO: Run Enter Script
388428
389- // Check for falling
429+ if ( world_z > CurrentZone->WorldZ && CurrentState != CombatantState::LONGJUMP && CurrentState != CombatantState::SHORTJUMP )
430+ {
431+ SetNewState ( CombatantState::FALLING );
432+ return ;
433+ }
390434}
391435
392436void Combatant::ProposeMove ( int ScreenX, int ScreenY )
@@ -409,11 +453,25 @@ void Combatant::ProposeMove( int ScreenX, int ScreenY )
409453 RoomZone* z = world_zone->InRoom ->FindZoneForPoint ( ScreenX, ScreenY );
410454 if ( z != nullptr )
411455 {
456+ // Drowning time
457+ if ( z->DrowningZone && CurrentState != CombatantState::LONGJUMP && CurrentState != CombatantState::SHORTJUMP && z->WorldZ == world_z )
458+ {
459+ SetNewState ( CombatantState::SINKING );
460+ return ;
461+ }
462+
412463 if ( z == world_zone )
413464 {
414465 // Same zone
415466 this ->ScreenX = ScreenX;
416467 this ->ScreenY = ScreenY;
468+
469+ // Check for falling
470+ if ( world_z > z->WorldZ && CurrentState != CombatantState::LONGJUMP && CurrentState != CombatantState::SHORTJUMP )
471+ {
472+ SetNewState ( CombatantState::FALLING );
473+ }
474+
417475 } else {
418476
419477 bool allowMove = true ;
@@ -430,12 +488,6 @@ void Combatant::ProposeMove( int ScreenX, int ScreenY )
430488 allowMove = false ;
431489 }
432490
433- // Drowning time
434- if ( z->DrowningZone )
435- {
436- SetNewState ( CombatantState::SINKING );
437- }
438-
439491 if ( z->WorldZ < world_z )
440492 {
441493 if ( z->ClimbingZone )
0 commit comments