Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes #102

Merged
merged 7 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.2.
0.1.3.
20 changes: 10 additions & 10 deletions profiles/cclcc/scriptinput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ root.PADcustomSizeA = 43;
root.PADcustomSizeB = 0;
root.PADcustomType = 0;
root.PADcustomA = {
0x10000,
0x20000,
0x40000,
0x80000,
root.PADinput.PAD1UP,
root.PADinput.PAD1DOWN,
root.PADinput.PAD1LEFT,
root.PADinput.PAD1RIGHT,
root.PADinput.PAD1A | root.PADinput.PAD1START,
root.PADinput.PAD1A,
root.PADinput.PAD1B,
Expand All @@ -31,18 +31,18 @@ root.PADcustomA = {
0,
0,
0,
0x100000 | root.PADinput.PAD1UP,
0x200000 | root.PADinput.PAD1DOWN,
0x400000 | root.PADinput.PAD1LEFT,
0x800000 | root.PADinput.PAD1RIGHT,
0x100001,
0x200002,
0x400004,
0x800008,
0x1000000,
0x2000000,
0x4000000,
0x8000000,
root.PADinput.PAD1L2,
root.PADinput.PAD1R2,
0x40000 | root.PADinput.PAD1L2,
0x80000 | root.PADinput.PAD1R2,
root.PADinput.PAD1LEFT | root.PADinput.PAD1L2,
root.PADinput.PAD1RIGHT | root.PADinput.PAD1R2,
0xF1000,
root.PADinput.PAD1L1,
root.PADinput.PAD1R1,
Expand Down
16 changes: 8 additions & 8 deletions profiles/chlcc/scriptinput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ root.PADcustomSizeA = 37;
root.PADcustomSizeB = 0;
root.PADcustomType = 0;
root.PADcustomA = {
0x10000,
0x20000,
0x40000,
0x80000,
root.PADinput.PAD1UP,
root.PADinput.PAD1DOWN,
root.PADinput.PAD1LEFT,
root.PADinput.PAD1RIGHT,
root.PADinput.PAD1A | root.PADinput.PAD1START,
root.PADinput.PAD1A,
root.PADinput.PAD1B,
Expand All @@ -71,10 +71,10 @@ root.PADcustomA = {
root.PADinput.PAD1L1,
root.PADinput.PAD1A,
root.PADinput.PAD1B,
0x100000 | root.PADinput.PAD1UP,
0x200000 | root.PADinput.PAD1DOWN,
0x400000 | root.PADinput.PAD1LEFT,
0x800000 | root.PADinput.PAD1RIGHT,
0x100001,
0x200002,
0x400004,
0x800008,
0x1000000,
0x2000000,
0x4000000,
Expand Down
28 changes: 14 additions & 14 deletions profiles/common/scriptinput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ root.Input = {
}

root.PADinput = {
PAD1UP = 1,
PAD1DOWN = 2,
PAD1LEFT = 4,
PAD1RIGHT = 8,
PAD1UP = 0x10000,
PAD1DOWN = 0x20000,
PAD1LEFT = 0x40000,
PAD1RIGHT = 0x80000,
PAD1START = 0x10,
PAD1SELECT = 0x20,
PAD1L3 = 0x40,
Expand All @@ -62,10 +62,10 @@ root.PADcustomType = 0;
root.PADcustomSizeA = 43;
root.PADcustomSizeB = 0;
root.PADcustomA = {
0x10000,
0x20000,
0x40000,
0x80000,
root.PADinput.PAD1UP,
root.PADinput.PAD1DOWN,
root.PADinput.PAD1LEFT,
root.PADinput.PAD1RIGHT,
root.PADinput.PAD1A | root.PADinput.PAD1START,
root.PADinput.PAD1A,
root.PADinput.PAD1B,
Expand All @@ -90,18 +90,18 @@ root.PADcustomA = {
0,
0,
0,
0x100000 | root.PADinput.PAD1UP,
0x200000 | root.PADinput.PAD1DOWN,
0x400000 | root.PADinput.PAD1LEFT,
0x800000 | root.PADinput.PAD1RIGHT,
0x100001,
0x200002,
0x400004,
0x800008,
0x1000000,
0x2000000,
0x4000000,
0x8000000,
root.PADinput.PAD1L2,
root.PADinput.PAD1R2,
0x40000 | root.PADinput.PAD1L2,
0x80000 | root.PADinput.PAD1R2,
root.PADinput.PAD1LEFT | root.PADinput.PAD1L2,
root.PADinput.PAD1RIGHT | root.PADinput.PAD1R2,
0xF1000,
root.PADinput.PAD1L1,
root.PADinput.PAD1R1,
Expand Down
20 changes: 10 additions & 10 deletions profiles/dash/scriptinput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ root.PADcustomSizeA = 43;
root.PADcustomSizeB = 0;
root.PADcustomType = 0;
root.PADcustomA = {
0x10000,
0x20000,
0x40000,
0x80000,
root.PADinput.PAD1UP,
root.PADinput.PAD1DOWN,
root.PADinput.PAD1LEFT,
root.PADinput.PAD1RIGHT,
root.PADinput.PAD1A | root.PADinput.PAD1START,
root.PADinput.PAD1A,
root.PADinput.PAD1B,
Expand All @@ -30,18 +30,18 @@ root.PADcustomA = {
0,
0,
0,
0x100000 | root.PADinput.PAD1UP,
0x200000 | root.PADinput.PAD1DOWN,
0x400000 | root.PADinput.PAD1LEFT,
0x800000 | root.PADinput.PAD1RIGHT,
0x100001,
0x200002,
0x400004,
0x800008,
0x1000000,
0x2000000,
0x4000000,
0x8000000,
root.PADinput.PAD1L2,
root.PADinput.PAD1R2,
0x40000 | root.PADinput.PAD1L2,
0x80000 | root.PADinput.PAD1R2,
root.PADinput.PAD1LEFT | root.PADinput.PAD1L2,
root.PADinput.PAD1RIGHT | root.PADinput.PAD1R2,
0xF1000,
root.PADinput.PAD1L1,
root.PADinput.PAD1R1,
Expand Down
16 changes: 8 additions & 8 deletions profiles/mo6tw/scriptinput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ root.PADcustomSizeA = 41;
root.PADcustomSizeB = 0;
root.PADcustomType = 0;
root.PADcustomA = {
0x10000,
0x20000,
0x40000,
0x80000,
root.PADinput.PAD1UP,
root.PADinput.PAD1DOWN,
root.PADinput.PAD1LEFT,
root.PADinput.PAD1RIGHT,
root.PADinput.PAD1A | root.PADinput.PAD1START,
root.PADinput.PAD1A,
root.PADinput.PAD1B,
Expand All @@ -70,10 +70,10 @@ root.PADcustomA = {
root.PADinput.PAD1L1,
root.PADinput.PAD1A,
root.PADinput.PAD1B,
0x100000 | root.PADinput.PAD1UP,
0x200000 | root.PADinput.PAD1DOWN,
0x400000 | root.PADinput.PAD1LEFT,
0x800000 | root.PADinput.PAD1RIGHT,
0x100001,
0x200002,
0x400004,
0x800008,
0x1000000,
0x2000000,
0x4000000,
Expand Down
7 changes: 2 additions & 5 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,8 @@ void Update(float dt) {
}

if (Profile::GameFeatures & GameFeature::Renderer2D) {
if (ScrWork[SW_GAMESTATE] & 5 && !GetFlag(SF_GAMEPAUSE) &&
!GetFlag(SF_SYSMENUDISABLE)) {
for (int i = 0; i < Profile::Dialogue::PageCount; i++)
DialoguePages[i].Update(dt);
}
for (int i = 0; i < Profile::Dialogue::PageCount; i++)
DialoguePages[i].Update(dt);
}

if ((Profile::GameFeatures & GameFeature::Renderer2D) &&
Expand Down
4 changes: 2 additions & 2 deletions src/games/cclcc/savesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@
}

void SaveSystem::SetLineRead(int scriptId, int lineId) {
if (scriptId >= StoryScriptCount) return;
if (scriptId >= 255) return;

int offset = ScriptMessageData[scriptId].SaveDataOffset + lineId;
if (offset == 0xFFFFFFFF) return;
Expand All @@ -670,7 +670,7 @@
}

bool SaveSystem::IsLineRead(int scriptId, int lineId) {
if (scriptId >= StoryScriptCount) return false;
if (scriptId >= 255) return false;

uint32_t offset = ScriptMessageData[scriptId].SaveDataOffset + lineId;
uint8_t flbit = Flbit[offset & 0b111];
Expand Down Expand Up @@ -733,5 +733,5 @@
case SaveFull:
return ((SaveFileEntry*)FullSaveEntries[id])->SaveThumbnail;
}
}

Check warning on line 736 in src/games/cclcc/savesystem.cpp

View workflow job for this annotation

GitHub Actions / linux

control reaches end of non-void function [-Wreturn-type]

Check warning on line 736 in src/games/cclcc/savesystem.cpp

View workflow job for this annotation

GitHub Actions / windows

'Impacto::CCLCC::SaveSystem::GetSaveThumbnail': not all control paths return a value
} // namespace CCLCC
Expand Down
8 changes: 4 additions & 4 deletions src/games/cclcc/titlemenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ void TitleMenu::Hide() {
MenuLabel->Move({-Profile::DesignWidth / 2, 0.0f});
if (CurrentSubMenu) {
CurrentSubMenu->Move({-Profile::DesignWidth / 2, 0.0f});
CurrentSubMenu->HasFocus = false;
}
}
if (SecondaryFadeAnimation.IsOut() && CurrentSubMenu) {
if (CurrentSubMenu) {
CurrentSubMenu->HasFocus = false;
if (CurrentSubMenu == ContinueItems) {
HideContinueItems();
} else if (CurrentSubMenu == ExtraItems) {
Expand All @@ -232,11 +232,11 @@ void TitleMenu::Hide() {
SecondaryFadeAnimation.Progress = 0.0f;
}
MenuLabel->Hide();
if (LastFocusedMenu != 0) {
if (LastFocusedMenu != nullptr) {
UI::FocusedMenu = LastFocusedMenu;
LastFocusedMenu->IsFocused = true;
} else {
UI::FocusedMenu = 0;
UI::FocusedMenu = nullptr;
}
IsFocused = false;
AllowsScriptInput = true;
Expand Down
8 changes: 4 additions & 4 deletions src/games/cclcc/yesnotrigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ void YesNoTrigger::Update(float dt) {
if (AllowInput) {
DispSel = true;
if (PADinputButtonWentDown &
(PAD1UP | PAD1DOWN | PAD1LEFT | PAD1RIGHT)) {
(PADcustom[0] | PADcustom[1] | PADcustom[2] | PADcustom[3])) {
if (Selection == YesNoSelect::NONE) {
Selection = YesNoSelect::YES;
} else if (Selection == YesNoSelect::YES) {
Selection = YesNoSelect::NO;
} else {
Selection = YesNoSelect::YES;
}
if (BgType == BGType::BG0 &&
(CurArrIndex == 11 || CurArrIndex == 12)) {
Selection = YesNoSelect::YES;
if (BgType == BGType::BG1 &&
(TargetArrIndex == 11 || TargetArrIndex == 12)) {
Selection = YesNoSelect::NO;
Audio::Channels[Audio::AC_SSE]->Play("sysse", 4, false, 0.0f);
} else {
Audio::Channels[Audio::AC_SSE]->Play("sysse", 1, false, 0.0f);
Expand Down
2 changes: 1 addition & 1 deletion src/games/chlcc/savesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@
}

void SaveSystem::SetLineRead(int scriptId, int lineId) {
if (scriptId >= StoryScriptCount) return;
if (scriptId >= 255) return;

int offset = ScriptMessageData[scriptId].SaveDataOffset + lineId;
if (offset == 0xFFFFFFFF) return;
Expand Down Expand Up @@ -593,5 +593,5 @@
case SaveFull:
return FullSaveEntries[id]->SaveThumbnail;
}
}

Check warning on line 596 in src/games/chlcc/savesystem.cpp

View workflow job for this annotation

GitHub Actions / linux

control reaches end of non-void function [-Wreturn-type]

Check warning on line 596 in src/games/chlcc/savesystem.cpp

View workflow job for this annotation

GitHub Actions / windows

'Impacto::CHLCC::SaveSystem::GetSaveThumbnail': not all control paths return a value
} // namespace CHLCC
Expand Down
4 changes: 2 additions & 2 deletions src/games/mo6tw/savesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@
}

void SaveSystem::SetLineRead(int scriptId, int lineId) {
if (scriptId >= StoryScriptCount) return;
if (scriptId >= StoryScriptCount.value()) return;

int offset =
ScriptMessageData[StoryScriptIDs[scriptId]].SaveDataOffset + lineId;
Expand All @@ -678,7 +678,7 @@
}

bool SaveSystem::IsLineRead(int scriptId, int lineId) {
if (scriptId >= StoryScriptCount) return false;
if (scriptId >= StoryScriptCount.value()) return false;

uint32_t offset =
ScriptMessageData[StoryScriptIDs[scriptId]].SaveDataOffset + lineId;
Expand Down Expand Up @@ -739,5 +739,5 @@
case SaveFull:
return ((SaveFileEntry*)FullSaveEntries[id])->SaveThumbnail;
}
}

Check warning on line 742 in src/games/mo6tw/savesystem.cpp

View workflow job for this annotation

GitHub Actions / linux

control reaches end of non-void function [-Wreturn-type]

Check warning on line 742 in src/games/mo6tw/savesystem.cpp

View workflow job for this annotation

GitHub Actions / windows

'Impacto::MO6TW::SaveSystem::GetSaveThumbnail': not all control paths return a value
} // namespace MO6TW
Expand Down
2 changes: 1 addition & 1 deletion src/profile/data/savesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void Configure() {
AssertIs(LUA_TTABLE);

StoryScriptCount = (int)lua_rawlen(LuaState, -1);
StoryScriptIDs = (uint32_t*)malloc(StoryScriptCount * sizeof(uint32_t));
StoryScriptIDs.reserve(*StoryScriptCount);
PushInitialIndex();
while (PushNextTableElement() != 0) {
int i = EnsureGetKeyInt() - 1;
Expand Down
5 changes: 3 additions & 2 deletions src/profile/data/savesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "../../data/savesystem.h"
#include <string>
#include <optional>

namespace Impacto {
namespace Profile {
Expand All @@ -15,8 +16,8 @@ inline Impacto::SaveSystem::SaveDataType Type =
Impacto::SaveSystem::SaveDataType::None;

inline std::string SaveFilePath;
inline uint32_t* StoryScriptIDs;
inline int StoryScriptCount;
inline std::vector<uint32_t> StoryScriptIDs;
inline std::optional<int> StoryScriptCount;
inline Impacto::SaveSystem::ScriptMessageDataPair* ScriptMessageData;
inline uint16_t AlbumEvData[MaxAlbumEntries][MaxAlbumSubEntries];
inline uint16_t AlbumData[MaxAlbumEntries][MaxAlbumSubEntries][MaxCGSprites];
Expand Down
7 changes: 7 additions & 0 deletions src/ui/widgets/cclcc/titlebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ void TitleButton::Update(float dt) {
}
}

void TitleButton::Hide() {
Button::Hide();
HighlightAnimation.Progress = 0.0f;
ChoiceBlinkAnimation.Progress = 0.0f;
PrevFocusState = false;
}

void TitleButton::Render() {
// Calculate the blink effect to occur 4 times during the animation
float blinkProgress = ChoiceBlinkAnimation.Progress * 4.0f;
Expand Down
1 change: 1 addition & 0 deletions src/ui/widgets/cclcc/titlebutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class TitleButton : public Widgets::Button {
void Render() override;
void Update(float dt) override;
void UpdateInput() override;
void Hide() override;
bool IsSubButton = false;
bool DisableInput = false;
Animation HighlightAnimation;
Expand Down
2 changes: 1 addition & 1 deletion src/vm/interface/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void UpdatePADInput() {
PADinputMouseWentDown = 0;
PADinputButtonIsDown = 0;
PADinputMouseIsDown = 0;
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 20; i++) {
int PADcode = (int)std::pow(2, i);
int KBcode = PADToKeyboard[PADcode];
int GPcode = PADToController[PADcode];
Expand Down
10 changes: 5 additions & 5 deletions src/vm/interface/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
namespace Impacto {
namespace Vm {
namespace Interface {

// Might have to take this from lua file if older games use different consts
enum PADinput {
PAD1UP = 1,
PAD1DOWN = 2,
PAD1LEFT = 4,
PAD1RIGHT = 8,
PAD1UP = 0x10000,
PAD1DOWN = 0x20000,
PAD1LEFT = 0x40000,
PAD1RIGHT = 0x80000,
PAD1START = 0x10,
PAD1SELECT = 0x20,
PAD1L3 = 0x40,
Expand Down
Loading