@@ -23,28 +23,24 @@ Combatant::Combatant(Controller* Controls)
2323 weapon_current_index = 0 ;
2424 weapon_change_index = 0 ;
2525
26+ item_held_index = -1 ;
27+
2628 magicrampindex = 0 ;
2729 magicrampdelay = 0 ;
2830
2931 speed_delay = 0 ;
30- Speed = 4 ;
32+ Speed = 5 ;
3133
3234 CurrentPower = COMBATANT_POWER;
3335 world_zone = nullptr ;
34- }
3536
36- Combatant::~Combatant ()
37- {
37+ ZoneClipping = false ;
38+ UnlimitedPower = false ;
39+ UnlimitedMagic = false ;
3840}
3941
40- void Combatant::Load (ConfigFile* DataFile, std::string KeyPrefix)
41- {
42-
43- }
44-
45- void Combatant::Save (ConfigFile* DataFile, std::string KeyPrefix)
42+ Combatant::~Combatant ()
4643{
47-
4844}
4945
5046void Combatant::Load (SQLiteDB* Database, int GameID, int RoomID)
@@ -382,23 +378,34 @@ Controller::ControllerStateFlags Combatant::GetSecondaryControllerState()
382378
383379void Combatant::SetRoomZone (RoomZone* CurrentZone, bool IsWarped)
384380{
381+ CurrentRoomID = CurrentZone->InRoomID ;
385382 world_zone = CurrentZone;
386383 if ( IsWarped )
387384 {
388385 world_z = CurrentZone->WorldZ ;
389386 }
390387 // TODO: Run Enter Script
388+
389+ // Check for falling
391390}
392391
393392void Combatant::ProposeMove ( int ScreenX, int ScreenY )
394393{
395- // if( ZoneClipping )
394+ if ( ZoneClipping )
395+ {
396+ // Clipping
397+ this ->ScreenX = ScreenX;
398+ this ->ScreenY = ScreenY;
399+ return ;
400+ }
396401
402+ // Check if we're in a valid place
397403 if ( world_zone == nullptr )
398404 {
399405 return ;
400406 }
401407
408+ // Can we locate the next zone?
402409 RoomZone* z = world_zone->InRoom ->FindZoneForPoint ( ScreenX, ScreenY );
403410 if ( z != nullptr )
404411 {
@@ -407,17 +414,67 @@ void Combatant::ProposeMove( int ScreenX, int ScreenY )
407414 // Same zone
408415 this ->ScreenX = ScreenX;
409416 this ->ScreenY = ScreenY;
410- } else if ( ZoneClipping ) {
411- // Clipping
412- this ->ScreenX = ScreenX;
413- this ->ScreenY = ScreenY;
414- SetRoomZone ( z, true );
415417 } else {
416418
417- // TODO: Check valid to enter, then handle any conditions
418-
419-
420-
419+ bool allowMove = true ;
420+
421+ // Can't magically walk up cliffs
422+ if ( z->WorldZ > world_z )
423+ {
424+ allowMove = false ;
425+ }
426+
427+ // Got to roll into here
428+ if ( z->RollingZone && CurrentState != CombatantState::ROLLING )
429+ {
430+ allowMove = false ;
431+ }
432+
433+ // Drowning time
434+ if ( z->DrowningZone )
435+ {
436+ SetNewState ( CombatantState::SINKING );
437+ }
438+
439+ if ( z->WorldZ < world_z )
440+ {
441+ if ( z->ClimbingZone )
442+ {
443+ // TODO: Handle climbing down
444+ allowMove = false ;
445+ }
446+ }
447+
448+ if ( z->TransportZone && (z->TransportRequiresItemHeld < 0 || z->TransportRequiresItemHeld == item_held_index) )
449+ {
450+ // TODO: Handle "animated" transports
451+
452+ Room* tr = GameResources::GameWorld->Rooms .at ( z->TransportRoomID );
453+ RoomZone* tz = tr->FindZoneForPoint ( z->TransportScreenX , z->TransportScreenY );
454+ this ->ScreenX = z->TransportScreenX ;
455+ this ->ScreenY = z->TransportScreenY ;
456+ if ( z->TransportFacing != GameDirection::UNCHANGED )
457+ {
458+ CurrentDirection == z->TransportFacing ;
459+ }
460+ if ( z->TransportClearInput )
461+ {
462+ Controls->ClearState ();
463+ }
464+ SetRoomZone ( tz, true );
465+ allowMove = false ;
466+
467+ }
468+
469+ // TODO: Check valid to enter, then handle any conditions
470+
471+ if ( allowMove )
472+ {
473+ this ->ScreenX = ScreenX;
474+ this ->ScreenY = ScreenY;
475+ SetRoomZone ( z, false );
476+ }
477+
421478 }
422479 }
423480}
0 commit comments