Skip to content

Commit

Permalink
Destiny: Issues corrected based on the new EasyRpg changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
drxgb committed Nov 11, 2024
1 parent 252195a commit c677c70
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/game_config_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ void Game_ConfigGame::PrintActivePatches() {
};

add_bool(patch_easyrpg);
add_bool(patch_destiny);
add_bool(patch_dynrpg);
add_bool(patch_common_this_event);
add_bool(patch_unlock_pics);
Expand Down
18 changes: 5 additions & 13 deletions src/game_destiny.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

// Headers
#include "game_destiny.h"
#include <cstring>

#ifndef EMSCRIPTEN
#include "exe_reader.h"
Expand Down Expand Up @@ -210,15 +209,12 @@ void Game_Destiny::CheckVersionInfo()
Interpreter::Interpreter()
{
CleanUpData();
_destinyScript = nullptr;
_scriptPtr = nullptr;
}

const char* Interpreter::MakeString(SaveEventExecFrame& frame)
{
std::string code;
size_t length;
char* destinyScript;

int32_t& current = frame.current_command;
const std::vector<EventCommand>& cmdList = frame.commands;
Expand All @@ -233,18 +229,14 @@ const char* Interpreter::MakeString(SaveEventExecFrame& frame)
++current;
}

length = code.length() + 1;
destinyScript = new char[length];
strcpy_s(destinyScript, length, code.c_str());

return _destinyScript = _scriptPtr = destinyScript;
_destinyScript = code;
return _scriptPtr = _destinyScript.data();
}

void Interpreter::FreeString()
{
delete[] _destinyScript;
_destinyScript = nullptr;
_scriptPtr = nullptr;
_destinyScript = "";
_scriptPtr = _destinyScript.data();
}

void Interpreter::SkipWhiteSpace()
Expand All @@ -270,7 +262,7 @@ const size_t Interpreter::GetWordLen()
const InterpretFlag Interpreter::Interpret()
{
char* code;
uint8_t flags[4];
//uint8_t flags[4];
InterpretFlag returnType;

size_t wordLen;
Expand Down
9 changes: 7 additions & 2 deletions src/game_destiny.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ namespace Destiny

private:
// Member data
char* _destinyScript;
std::string _destinyScript;
char* _scriptPtr;
uint32_t _breaks;
uint32_t _continues;
Expand Down Expand Up @@ -335,7 +335,7 @@ namespace Destiny
const bool BlockComment();

/**
* Check whether character is a whitespace..
* Check whether character is a whitespace.
*
* @return Flag of whitespace character.
*/
Expand All @@ -348,6 +348,11 @@ namespace Destiny
ch == 0x0B; // Vertical Tabulator (VT)
}

/**
* Check whether character is a part of a word.
*
* @return Flag of word character.
*/
inline const bool IsWordChar(const char ch) const
{
return ch == '_' ||
Expand Down
2 changes: 0 additions & 2 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,8 +833,6 @@ void Player::CreateGameObjects() {
}
}

Output::Debug("Patch configuration: dynrpg={} maniac={} key-patch={} common-this={} pic-unlock={} 2k3-commands={} destiny={}",
Player::IsPatchDynRpg(), Player::IsPatchManiac(), Player::IsPatchKeyPatch(), game_config.patch_common_this_event.Get(), game_config.patch_unlock_pics.Get(), game_config.patch_rpg2k3_commands.Get(), Player::IsPatchDestiny());
game_config.PrintActivePatches();

ResetGameObjects();
Expand Down

0 comments on commit c677c70

Please sign in to comment.