Skip to content

Commit

Permalink
Update for mouse Input, an allow using StringVar for settings
Browse files Browse the repository at this point in the history
  • Loading branch information
MackValentine committed May 11, 2024
1 parent cbc1620 commit 3136636
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 25 deletions.
13 changes: 13 additions & 0 deletions src/game_interpreter_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,10 @@ bool Game_Interpreter_Map::CommandSetCustomBattleHUD(lcf::rpg::EventCommand cons
CustomBattle::used = true;

std::string s = com.string.c_str();
if (com.parameters[1] == 1)
{
s = ToString(CommandStringOrVariable(com, 1, 2));
}
char delim = '\n';

std::vector<std::string> lines;
Expand Down Expand Up @@ -899,6 +903,10 @@ bool Game_Interpreter_Map::CommandSetCustomItem(lcf::rpg::EventCommand const& co
CustomBattle::used = true;

std::string s = com.string.c_str();
if (com.parameters[1] == 1)
{
s = ToString(CommandStringOrVariable(com, 1, 2));
}
char delim = '\n';

std::vector<std::string> lines;
Expand Down Expand Up @@ -1088,6 +1096,11 @@ bool Game_Interpreter_Map::CommandSetCustomMenu(lcf::rpg::EventCommand const& co
CustomMenu::used = true;

std::string s = com.string.c_str();

if (com.parameters[1] == 1)
{
s = ToString(CommandStringOrVariable(com,1,2));
}
char delim = '\n';

std::vector<std::string> lines;
Expand Down
68 changes: 44 additions & 24 deletions src/game_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

// Headers
#include <cstdint>
#include <initializer_list>
#include <vector>
#include <string>
#include <unordered_set>
Expand Down Expand Up @@ -47,30 +48,38 @@ struct BattleArgs;
constexpr int SCREEN_TILE_SIZE = 256;

class MapUpdateAsyncContext {
public:
MapUpdateAsyncContext() = default;

static MapUpdateAsyncContext FromCommonEvent(int ce, AsyncOp aop);
static MapUpdateAsyncContext FromMapEvent(int ce, AsyncOp aop);
static MapUpdateAsyncContext FromForegroundEvent(AsyncOp aop);
static MapUpdateAsyncContext FromMessage(AsyncOp aop);

AsyncOp GetAsyncOp() const;

int GetParallelCommonEvent() const;
int GetParallelMapEvent() const;

bool IsForegroundEvent() const;
bool IsParallelCommonEvent() const;
bool IsParallelMapEvent() const;
bool IsMessage() const;
bool IsActive() const;
private:
AsyncOp async_op = {};
int common_event = 0;
int map_event = 0;
bool foreground_event = false;
bool message = false;
public:
MapUpdateAsyncContext() = default;

static MapUpdateAsyncContext FromCommonEvent(int ce, AsyncOp aop);
static MapUpdateAsyncContext FromMapEvent(int ce, AsyncOp aop);
static MapUpdateAsyncContext FromForegroundEvent(AsyncOp aop);
static MapUpdateAsyncContext FromMessage(AsyncOp aop);

AsyncOp GetAsyncOp() const;

int GetParallelCommonEvent() const;
int GetParallelMapEvent() const;

bool IsForegroundEvent() const;
bool IsParallelCommonEvent() const;
bool IsParallelMapEvent() const;
bool IsMessage() const;
bool IsActive() const;
private:
AsyncOp async_op = {};
int common_event = 0;
int map_event = 0;
bool foreground_event = false;
bool message = false;
};

class MapEventCache {
public:
void AddEvent(lcf::rpg::Event& ev);

private:
std::vector<int> event_ids;
};

/**
Expand Down Expand Up @@ -679,6 +688,17 @@ namespace Game_Map {

FileRequestAsync* RequestMap(int map_id);

void SetNeedRefreshForSwitchChange(int switch_id);
void SetNeedRefreshForVarChange(int var_id);
void SetNeedRefreshForSwitchChange(std::initializer_list<int> switch_ids);
void SetNeedRefreshForVarChange(std::initializer_list<int> var_ids);

void AddEventToSwitchCache(lcf::rpg::Event& ev, int switch_id);
void AddEventToVariableCache(lcf::rpg::Event& ev, int var_id);


int ChangeTile(int layer, int x, int y, int new_id);

namespace Parallax {
struct Params {
std::string name;
Expand Down
3 changes: 2 additions & 1 deletion src/scene_item_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void Scene_Item_Custom::vUpdate() {


if (CustomItem::usePockets && pocket_window->GetActive()) {

item_window->SetActive(false);

if (pocket_window->GetIndex() != old_pocket_index) {
item_window->SetPocket(GetPocket());
Expand All @@ -236,6 +236,7 @@ void Scene_Item_Custom::vUpdate() {
else if (Input::IsTriggered(Input::DECISION)) {
Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Decision));
pocket_window->SetActive(false);
item_window->SetActive(true);
}
}
else {
Expand Down

0 comments on commit 3136636

Please sign in to comment.