Skip to content

Commit

Permalink
New Command: 2002 - Activate Event At [x,y]
Browse files Browse the repository at this point in the history
`@raw 2002, "", UseVarX,x UseVarY,y`

Activate an event in map remotely, based on its x and y coordinates.

Command made by @MackValentine,
I only refactored it to fit the player specifications.
  • Loading branch information
MackValentine authored and jetrotal committed Jan 7, 2024
1 parent c9ed891 commit ef8060f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/game_interpreter_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ bool Game_Interpreter_Map::ExecuteCommand(lcf::rpg::EventCommand const& com) {
return CommandOpenLoadMenu(com);
case Cmd::ToggleAtbMode:
return CommandToggleAtbMode(com);
case static_cast <Game_Interpreter::Cmd>(2002): //Cmd::easyrpg_ActivateEvent
return CommandActivateEventAt(com);
default:
return Game_Interpreter::ExecuteCommand(com);
}
Expand Down Expand Up @@ -674,3 +676,11 @@ bool Game_Interpreter_Map::CommandToggleAtbMode(lcf::rpg::EventCommand const& /*
Main_Data::game_system->ToggleAtbMode();
return true;
}

bool Game_Interpreter_Map::CommandActivateEventAt(lcf::rpg::EventCommand const& com) {
int x = ValueOrVariable(com.parameters[0], com.parameters[1]);
int y = ValueOrVariable(com.parameters[2], com.parameters[3]);

bool b = Main_Data::game_player->ActivateEventAt(x, y);
return true;
}
1 change: 1 addition & 0 deletions src/game_interpreter_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class Game_Interpreter_Map : public Game_Interpreter
bool CommandOpenMainMenu(lcf::rpg::EventCommand const& com);
bool CommandOpenLoadMenu(lcf::rpg::EventCommand const& com);
bool CommandToggleAtbMode(lcf::rpg::EventCommand const& com);
bool CommandActivateEventAt(lcf::rpg::EventCommand const& com);

AsyncOp ContinuationShowInnStart(int indent, int choice_result, int price);

Expand Down
3 changes: 3 additions & 0 deletions src/game_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,3 +835,6 @@ void Game_Player::UpdatePan() {
data()->pan_current_y -= dy;
}

bool Game_Player::ActivateEventAt(int x, int y) {
return CheckEventTriggerThere({ lcf::rpg::EventPage::Trigger_action }, x, y, true);
}
2 changes: 2 additions & 0 deletions src/game_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class Game_Player : public Game_PlayerBase {
TeleportTarget GetTeleportTarget() const;
void ResetTeleportTarget(TeleportTarget tt = {});

bool Game_Player::ActivateEventAt(int x, int y);

/**
* Sets the map, position and direction that the game player must have after the teleport is over
*
Expand Down

0 comments on commit ef8060f

Please sign in to comment.