Skip to content

Commit

Permalink
DRAFT
Browse files Browse the repository at this point in the history
  • Loading branch information
florianessl committed May 24, 2024
1 parent 9e902e1 commit 746f412
Show file tree
Hide file tree
Showing 31 changed files with 5,163 additions and 829 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ add_library(${PROJECT_NAME} OBJECT
src/game_player.h
src/game_quit.cpp
src/game_quit.h
src/game_scoped_storage.cpp
src/game_scoped_storage.h
src/game_screen.cpp
src/game_screen.h
src/game_strings.cpp
Expand Down Expand Up @@ -465,6 +467,8 @@ add_library(${PROJECT_NAME} OBJECT
src/window_teleport.h
src/window_varlist.cpp
src/window_varlist.h
src/window_varlist_scoped.cpp
src/window_varlist_scoped.h
)

# These are actually unused when building in CMake
Expand Down
6 changes: 5 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ libeasyrpg_player_a_SOURCES = \
src/game_pictures.h \
src/game_player.cpp \
src/game_player.h \
src/game_scoped_storage.cpp \
src/game_scoped_storage.h \
src/game_screen.cpp \
src/game_screen.h \
src/game_strings.cpp \
Expand Down Expand Up @@ -443,7 +445,9 @@ libeasyrpg_player_a_SOURCES = \
src/window_teleport.cpp \
src/window_teleport.h \
src/window_varlist.cpp \
src/window_varlist.h
src/window_varlist.h \
src/window_varlist_scoped.cpp \
src/window_varlist_scoped.h

SOURCEFILES_SDL2 = \
src/platform/sdl/sdl2_ui.cpp \
Expand Down
1 change: 1 addition & 0 deletions docs/AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ EasyRPG Player authors
* Diego Pedraza (zegeri)
* Erich Newey (enewey)
* Dmytro Kushnariov (rohkea)
* Florian Ignaz Eßl (florianessl)
* Francisco de la Peña (fdelapena)
* Gabriel Kind (Ghabry)
* Glynn Clements (glynnc)
Expand Down
42 changes: 42 additions & 0 deletions src/game_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "game_variables.h"
#include "game_system.h"
#include "game_interpreter_map.h"
#include "game_interpreter_shared.h"
#include "main_data.h"
#include "player.h"
#include "utils.h"
Expand Down Expand Up @@ -289,6 +290,47 @@ bool Game_Event::AreConditionsMet(const lcf::rpg::EventPage& page) {
return false;
}

if (Player::HasEasyRpgExtensions()) {
#ifndef SCOPEDVARS_LIBLCF_STUB
// First SelfSwitch (A)
if (page.easyrpg_condition.flags.self_switch_a && !Main_Data::game_switches->Get<DataScopeType::eDataScope_MapEvent>(
page.easyrpg_condition.self_switch_a_id, GetMapId(), GetId())) {
return false;
}

// Second SelfSwitch (B)
if (page.easyrpg_condition.flags.self_switch_b && !Main_Data::game_switches->Get<DataScopeType::eDataScope_MapEvent>(
page.easyrpg_condition.self_switch_b_id, GetMapId(), GetId())) {
return false;
}

// SelfVar
if (page.easyrpg_condition.flags.self_var && page.easyrpg_condition.self_var_operator >= 0 && page.easyrpg_condition.self_var_operator <= 5) {
if (!Game_Interpreter_Shared::CheckOperator(
Main_Data::game_variables->Get<DataScopeType::eDataScope_MapEvent>(page.easyrpg_condition.self_var_id, GetMapId(), GetId()),
page.easyrpg_condition.self_var_value, page.easyrpg_condition.self_var_operator))
return false;
}

// First MapSwitch (A)
if (page.easyrpg_condition.flags.map_switch_a && !Game_Interpreter_Shared::EvaluateMapTreeSwitch(0, page.easyrpg_condition.map_switch_a_id, GetMapId())) {
return false;
}

// Second MapSwitch (B)
if (page.easyrpg_condition.flags.map_switch_b && !Game_Interpreter_Shared::EvaluateMapTreeSwitch(0, page.easyrpg_condition.map_switch_b_id, GetMapId())) {
return false;
}

// MapVar
if (page.easyrpg_condition.flags.map_var && page.easyrpg_condition.map_var_operator >= 0 && page.easyrpg_condition.map_var_operator <= 5) {
if (!Game_Interpreter_Shared::CheckOperator(Game_Interpreter_Shared::EvaluateMapTreeVariable(0, page.easyrpg_condition.map_var_id, GetMapId()),
page.easyrpg_condition.map_var_value, page.easyrpg_condition.map_var_operator))
return false;
}
#endif
}

// All conditions met :D
return true;
}
Expand Down
Loading

0 comments on commit 746f412

Please sign in to comment.