diff --git a/src/Main.cpp b/src/Main.cpp index b3f16c89..3e87a65b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -9,6 +9,7 @@ #include "Draw.h" #include "Input.h" +#include "Profile.h" #include "Organya.h" #include "Sound.h" #include "Game.h" @@ -400,6 +401,11 @@ bool SystemTask() break; } break; + + case SDL_DROPFILE: + LoadProfile(event.drop.file); + SDL_free(event.drop.file); + break; case SDL_KEYDOWN: switch (event.key.keysym.sym) diff --git a/src/MyChar.cpp b/src/MyChar.cpp index 315c96e6..db5d6e78 100644 --- a/src/MyChar.cpp +++ b/src/MyChar.cpp @@ -151,7 +151,7 @@ void ShowMyChar(bool bShow) void PutMyChar(int fx, int fy) { - if ((gMC.cond & 0x80u) && !(gMC.cond & 2)) + if ((gMC.cond & 0x80) && !(gMC.cond & 2)) { //Draw weapon gMC.rect_arms.left = 24 * (gArmsData[gSelectedArms].code % 13); diff --git a/src/NpcAct.h b/src/NpcAct.h index 790ac809..4e7472b5 100644 --- a/src/NpcAct.h +++ b/src/NpcAct.h @@ -12,6 +12,8 @@ void ActNpc006(NPCHAR *npc); void ActNpc007(NPCHAR *npc); void ActNpc008(NPCHAR *npc); +void ActNpc012(NPCHAR *npc); + void ActNpc015(NPCHAR *npc); void ActNpc016(NPCHAR *npc); void ActNpc017(NPCHAR *npc); @@ -81,6 +83,7 @@ void ActNpc125(NPCHAR *npc); void ActNpc145(NPCHAR *npc); +void ActNpc150(NPCHAR *npc); void ActNpc151(NPCHAR *npc); void ActNpc211(NPCHAR *npc); diff --git a/src/NpcAct000.cpp b/src/NpcAct000.cpp index c1b0873c..c4e670a9 100644 --- a/src/NpcAct000.cpp +++ b/src/NpcAct000.cpp @@ -5,7 +5,9 @@ #include "MyChar.h" #include "NpChar.h" #include "Game.h" +#include "Map.h" #include "Sound.h" +#include "Frame.h" #include "Back.h" #include "Triangle.h" #include "Frame.h" @@ -1342,7 +1344,7 @@ void ActNpc018(NPCHAR *npc) break; case 1: - for (int i = 0; i < 4; ++i) + for (int i = 0; i < 4; i++) SetNpChar(4, npc->x, npc->y, Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100); npc->act_no = 0; diff --git a/src/NpcAct140.cpp b/src/NpcAct140.cpp index 7a83e0d6..125c4d5b 100644 --- a/src/NpcAct140.cpp +++ b/src/NpcAct140.cpp @@ -49,6 +49,162 @@ void ActNpc145(NPCHAR *npc) npc->rect = rcRight[npc->ani_no]; } +//Quote +void ActNpc150(NPCHAR *npc) +{ + RECT rcLeft[9]; + RECT rcRight[9]; + + rcLeft[0] = {0, 0, 16, 16}; + rcLeft[1] = {48, 0, 64, 16}; + rcLeft[2] = {144, 0, 160, 16}; + rcLeft[3] = {16, 0, 32, 16}; + rcLeft[4] = {0, 0, 16, 16}; + rcLeft[5] = {32, 0, 48, 16}; + rcLeft[6] = {0, 0, 16, 16}; + rcLeft[7] = {160, 0, 176, 16}; + rcLeft[8] = {112, 0, 128, 16}; + + rcRight[0] = {0, 16, 16, 32}; + rcRight[1] = {48, 16, 64, 32}; + rcRight[2] = {144, 16, 160, 32}; + rcRight[3] = {16, 16, 32, 32}; + rcRight[4] = {0, 16, 16, 32}; + rcRight[5] = {32, 16, 48, 32}; + rcRight[6] = {0, 16, 16, 32}; + rcRight[7] = {160, 16, 176, 32}; + rcRight[8] = {112, 16, 128, 32}; + + switch (npc->act_no) + { + case 0: + npc->act_no = 1; + npc->ani_no = 0; + + if (npc->direct > 10) + { + npc->x = gMC.x; + npc->y = gMC.y; + npc->direct -= 10; + } + break; + case 2: + npc->ani_no = 1; + break; + case 10: + npc->act_no = 11; + for (int i = 0; i < 4; i++) + SetNpChar(4, npc->x, npc->y, Random(-0x155, 0x155), Random(-0x600, 0), 0, 0, 0x100); + PlaySoundObject(71, 1); + case 11: + npc->ani_no = 2; + break; + case 20: + npc->act_no = 21; + npc->act_wait = 64; + PlaySoundObject(29, 1); + case 21: + if (!--npc->act_wait) + npc->cond = 0; + break; + case 50: + npc->act_no = 51; + npc->ani_no = 3; + npc->ani_wait = 0; + case 51: + if (++npc->ani_wait > 4) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + if (npc->ani_no > 6) + npc->ani_no = 3; + + if ( npc->direct ) + npc->x += 0x200; + else + npc->x -= 0x200; + break; + case 60: + npc->act_no = 61; + npc->ani_no = 7; + npc->tgt_x = npc->x; + npc->tgt_y = npc->y; + case 61: + npc->tgt_y += 0x100; + npc->x = npc->tgt_x + (Random(-1, 1) << 9); + npc->y = npc->tgt_y + (Random(-1, 1) << 9); + break; + case 70: + npc->act_no = 71; + npc->act_wait = 0; + npc->ani_no = 3; + npc->ani_wait = 0; + case 0x47: + if ( npc->direct ) + npc->x -= 0x100; + else + npc->x += 0x100; + + if (++npc->ani_wait > 8) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + if (npc->ani_no > 6) + npc->ani_no = 3; + break; + case 80: + npc->ani_no = 8; + break; + case 99: + case 100: + npc->act_no = 101; + npc->ani_no = 3; + npc->ani_wait = 0; + case 101: + npc->ym += 0x40; + if (npc->ym > 0x5FF) + npc->ym = 0x5FF; + if (npc->flag & 8) + { + npc->ym = 0; + npc->act_no = 102; + } + npc->y += npc->ym; + break; + case 102: + if (++npc->ani_wait > 8) + { + npc->ani_wait = 0; + ++npc->ani_no; + } + if (npc->ani_no > 6) + npc->ani_no = 3; + break; + default: + break; + } + + if (npc->direct) + npc->rect = rcRight[npc->ani_no]; + else + npc->rect = rcLeft[npc->ani_no]; + + if (npc->act_no == 21) + { + npc->rect.bottom = npc->act_wait / 4 + npc->rect.top; + if (npc->act_wait / 2 & 1) + ++npc->rect.left; + } + + if (gMC.equip & 0x40) + { + npc->rect.top += 32; + npc->rect.bottom += 32; + } +} + //Blue robot (standing) void ActNpc151(NPCHAR *npc) { diff --git a/src/NpcTbl.cpp b/src/NpcTbl.cpp index 17f77b4b..de822259 100644 --- a/src/NpcTbl.cpp +++ b/src/NpcTbl.cpp @@ -68,7 +68,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, - nullptr, + ActNpc012, nullptr, nullptr, ActNpc015, @@ -206,7 +206,7 @@ NPCFUNCTION gpNpcFuncTbl[361] = nullptr, nullptr, nullptr, - nullptr, + ActNpc150, ActNpc151, nullptr, nullptr, diff --git a/src/TextScr.cpp b/src/TextScr.cpp index a4843b0d..afa9d909 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -15,6 +15,7 @@ #include "MycParam.h" #include "Flags.h" #include "Profile.h" +#include "Map.h" #include "MapName.h" #include "KeyControl.h" #include "NpChar.h" @@ -787,6 +788,12 @@ int TextScriptProc() gTS.p_read += 8; bExit = true; } + else if (IS_COMMAND('W','A','S')) + { + gTS.mode = 7; + gTS.p_read += 4; + bExit = true; + } else if (IS_COMMAND('T','U','R')) { gTS.p_read += 4; @@ -980,6 +987,22 @@ int TextScriptProc() SetNpChar(w, x << 13, y << 13, 0, 0, z, 0, 0x100); gTS.p_read += 23; } + else if (IS_COMMAND('M','N','P')) + { + w = GetTextScriptNo(gTS.p_read + 4); + x = GetTextScriptNo(gTS.p_read + 9); + y = GetTextScriptNo(gTS.p_read + 14); + z = GetTextScriptNo(gTS.p_read + 19); + MoveNpChar(w, x << 13, y << 13, z); + gTS.p_read += 23; + } + else if (IS_COMMAND('S','M','P')) + { + x = GetTextScriptNo(gTS.p_read + 4); + y = GetTextScriptNo(gTS.p_read + 9); + ShiftMapParts(x, y); + gTS.p_read += 13; + } else if (IS_COMMAND('C','M','P')) { x = GetTextScriptNo(gTS.p_read + 4); @@ -1011,14 +1034,10 @@ int TextScriptProc() BackStepMyChar(z); gTS.p_read += 8; } - else if (IS_COMMAND('M','N','P')) + else if (IS_COMMAND('M','M','0')) { - w = GetTextScriptNo(gTS.p_read + 4); - x = GetTextScriptNo(gTS.p_read + 9); - y = GetTextScriptNo(gTS.p_read + 14); - z = GetTextScriptNo(gTS.p_read + 19); - MoveNpChar(w, x << 13, y << 13, z); - gTS.p_read += 23; + ZeroMyCharXMove(); + gTS.p_read += 4; } else if (IS_COMMAND('I','N','I')) {