diff --git a/Makefile b/Makefile index c7b17b42..a8b33ca1 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,25 @@ ifeq ($(RELEASE), 1) -CXXFLAGS := -O3 -s -FILENAME_DEF = release + CXXFLAGS := -O3 -s + FILENAME_DEF = release else -CXXFLAGS := -O0 -g -FILENAME_DEF = debug + CXXFLAGS := -O0 -g + FILENAME_DEF = debug endif ifeq ($(JAPANESE), 1) -CXXFLAGS += -DJAPANESE -LIBS += -liconv + CXXFLAGS += -DJAPANESE + LIBS += -liconv ifeq ($(RELEASE), 1) - FILENAME_DEF = releasejp + FILENAME_DEF = releasejp else - FILENAME_DEF = debugjp + FILENAME_DEF = debugjp endif endif FILENAME ?= $(FILENAME_DEF) ifeq ($(FIX_BUGS), 1) -CXXFLAGS += -DFIX_BUGS + CXXFLAGS += -DFIX_BUGS endif ifeq ($(WINDOWS), 1) diff --git a/build/data/ArmsItemJapanese.tsc b/build/data/ArmsItemJapanese.tsc new file mode 100644 index 00000000..5666559a Binary files /dev/null and b/build/data/ArmsItemJapanese.tsc differ diff --git a/build/data/CreditJapanese.tsc b/build/data/CreditJapanese.tsc new file mode 100644 index 00000000..77bc749d Binary files /dev/null and b/build/data/CreditJapanese.tsc differ diff --git a/build/data/HeadJapanese.tsc b/build/data/HeadJapanese.tsc new file mode 100644 index 00000000..b75847d1 Binary files /dev/null and b/build/data/HeadJapanese.tsc differ diff --git a/build/data/StageSelectJapanese.tsc b/build/data/StageSelectJapanese.tsc new file mode 100644 index 00000000..9c3347a5 --- /dev/null +++ b/build/data/StageSelectJapanese.tsc @@ -0,0 +1 @@ +drqqqNK}}}Ԟ)2ƒ}zzzz}NKdrqqrNK}}}ğľĔ2ٍ}zzzz}NKdrqqsNK}}}ďĕ}Azzzz}NKdrqqtNK}}}'}zzzz}NKdrqquNK}}}̼}zzzz}NKdrqqvNK}}}&ՠ}zzzz}NKNK \ No newline at end of file diff --git a/src/Ending.cpp b/src/Ending.cpp index 5e9113f2..987979bd 100644 --- a/src/Ending.cpp +++ b/src/Ending.cpp @@ -431,6 +431,10 @@ int Scene_DownIsland(int mode) sprite.y += 0x19; } } + else + { + sprite.y += 0x33; + } break; } diff --git a/src/MycParam.cpp b/src/MycParam.cpp index 0c83da67..7311fc83 100644 --- a/src/MycParam.cpp +++ b/src/MycParam.cpp @@ -382,6 +382,75 @@ void PutTimeCounter(int x, int y) } } +bool SaveTimeCounter() +{ + REC rec; + + //Quit if player doesn't have the Nikumaru Counter + if (!(gMC.equip & 0x100)) + return true; + + //Get last time + char path[PATH_LENGTH]; + sprintf(path, "%s/290.rec", gModulePath); + + SDL_RWops *fp = SDL_RWFromFile(path, "rb"); + if (fp) + { + //Read data + rec.counter[0] = SDL_ReadLE32(fp); + rec.counter[1] = SDL_ReadLE32(fp); + rec.counter[2] = SDL_ReadLE32(fp); + rec.counter[3] = SDL_ReadLE32(fp); + rec.random[0] = SDL_ReadU8(fp); + rec.random[1] = SDL_ReadU8(fp); + rec.random[2] = SDL_ReadU8(fp); + rec.random[3] = SDL_ReadU8(fp); + SDL_RWclose(fp); + + //Decode from checksum + for (int i = 0; i < 4; i++) + { + uint8_t *p = (uint8_t*)&rec.counter[i]; + p[0] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i]) : (rec.random[i] >> 1); + p[1] -= rec.random[i]; + p[2] -= rec.random[i]; + p[3] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i] >> 1) : (rec.random[i]); + } + + //If this is faster than our new time, quit + if (rec.counter[0] < time_count) + return true; + } + + //Save new time + for (int i = 0; i < 4; i++) + { + rec.counter[i] = time_count; + rec.random[i] = Random(0, 250) + i; + + uint8_t *p = (uint8_t*)&rec.counter[i]; + p[0] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i]) : (rec.random[i] >> 1); + p[1] -= rec.random[i]; + p[2] -= rec.random[i]; + p[3] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i] >> 1) : (rec.random[i]); + } + + fp = SDL_RWFromFile(path, "wb"); + if (!fp) + return false; + SDL_WriteLE32(fp, rec.counter[0]); + SDL_WriteLE32(fp, rec.counter[1]); + SDL_WriteLE32(fp, rec.counter[2]); + SDL_WriteLE32(fp, rec.counter[3]); + SDL_WriteU8(fp, rec.random[0]); + SDL_WriteU8(fp, rec.random[1]); + SDL_WriteU8(fp, rec.random[2]); + SDL_WriteU8(fp, rec.random[3]); + SDL_RWclose(fp); + return true; +} + int LoadTimeCounter() { //Open file @@ -405,18 +474,14 @@ int LoadTimeCounter() rec.random[3] = SDL_ReadU8(fp); SDL_RWclose(fp); - //HACK: this swaps the random values to correspond to the correct bytes - *((uint32_t*)rec.random) = SDL_SwapLE32(*((uint32_t*)rec.random)); - //Decode from checksum - uint8_t *p; for (int i = 0; i < 4; i++) { - p = (uint8_t*)&rec.counter[i]; - p[0] -= rec.random[i]; + uint8_t *p = (uint8_t*)&rec.counter[i]; + p[0] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i]) : (rec.random[i] >> 1); p[1] -= rec.random[i]; p[2] -= rec.random[i]; - p[3] -= rec.random[i] >> 1; + p[3] -= (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? (rec.random[i] >> 1) : (rec.random[i]); } //Verify checksum's result diff --git a/src/MycParam.h b/src/MycParam.h index 2547791c..1de454d3 100644 --- a/src/MycParam.h +++ b/src/MycParam.h @@ -26,5 +26,5 @@ void PutActiveArmsList(); void PutMyLife(bool flash); void PutMyAir(int x, int y); void PutTimeCounter(int x, int y); - +bool SaveTimeCounter(); int LoadTimeCounter(); diff --git a/src/TextScr.cpp b/src/TextScr.cpp index 54a0756b..0ab047d8 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -706,6 +706,11 @@ int TextScriptProc() ChangeMyUnit(z); gTS.p_read += 8; } + else if (IS_COMMAND('S','T','C')) + { + SaveTimeCounter(); + gTS.p_read += 4; + } else if (IS_COMMAND('T','R','A')) { z = GetTextScriptNo(gTS.p_read + 4);