From 132d3c511072eb4d380c3f5c5c7dd1a7029dbeaf Mon Sep 17 00:00:00 2001 From: Clownacy Date: Mon, 18 Feb 2019 14:36:58 +0000 Subject: [PATCH] Applied SURFACE_ID constants to everything --- src/ArmsItem.cpp | 32 +++++++++--------- src/Boss.cpp | 2 +- src/Bullet.cpp | 2 +- src/Caret.cpp | 2 +- src/Draw.cpp | 30 ++++++++--------- src/Draw.h | 82 ++++++++++++++++++++++++--------------------- src/Ending.cpp | 6 ++-- src/Escape.cpp | 2 +- src/Fade.cpp | 2 +- src/Game.cpp | 14 ++++---- src/GenericLoad.cpp | 34 +++++++++---------- src/MiniMap.cpp | 12 +++---- src/MyChar.cpp | 10 +++--- src/MycParam.cpp | 36 ++++++++++---------- src/NpChar.h | 4 ++- src/NpcAct060.cpp | 2 +- src/NpcAct340.cpp | 10 +++--- src/NpcTbl.h | 3 +- src/SelStage.cpp | 6 ++-- src/Star.cpp | 2 +- src/TextScr.cpp | 48 +++++++++++++------------- src/ValueView.cpp | 8 ++--- 22 files changed, 179 insertions(+), 170 deletions(-) diff --git a/src/ArmsItem.cpp b/src/ArmsItem.cpp index 72e78256..47cc9925 100644 --- a/src/ArmsItem.cpp +++ b/src/ArmsItem.cpp @@ -265,27 +265,27 @@ void PutCampObject() //Draw box int y; - PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, (WINDOW_HEIGHT - 224) / 2, &rcBoxTop, 26); + PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, (WINDOW_HEIGHT - 224) / 2, &rcBoxTop, SURFACE_ID_TEXT_BOX); for (y = 1; y < 18; y++) - PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (y + 1)), &rcBoxBody, 26); - PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (y + 1)), &rcBoxBottom, 26); + PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (y + 1)), &rcBoxBody, SURFACE_ID_TEXT_BOX); + PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (y + 1)), &rcBoxBottom, SURFACE_ID_TEXT_BOX); //Move titles if (gCampTitleY > (WINDOW_HEIGHT - 208) / 2) --gCampTitleY; //Draw titles - PutBitmap3(&rcView, (WINDOW_WIDTH - 224) / 2, gCampTitleY, &rcTitle1, 26); - PutBitmap3(&rcView, (WINDOW_WIDTH - 224) / 2, gCampTitleY + 52, &rcTitle2, 26); + PutBitmap3(&rcView, (WINDOW_WIDTH - 224) / 2, gCampTitleY, &rcTitle1, SURFACE_ID_TEXT_BOX); + PutBitmap3(&rcView, (WINDOW_WIDTH - 224) / 2, gCampTitleY + 52, &rcTitle2, SURFACE_ID_TEXT_BOX); //Draw arms cursor static int flash; ++flash; if (gCampActive) - PutBitmap3(&rcView, 40 * gSelectedArms + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT / 2) - 96, &rcCur1[1], 26); + PutBitmap3(&rcView, 40 * gSelectedArms + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT / 2) - 96, &rcCur1[1], SURFACE_ID_TEXT_BOX); else - PutBitmap3(&rcView, 40 * gSelectedArms + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT / 2) - 96, &rcCur1[(flash >> 1) & 1], 26); + PutBitmap3(&rcView, 40 * gSelectedArms + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT / 2) - 96, &rcCur1[(flash >> 1) & 1], SURFACE_ID_TEXT_BOX); //Draw arms for (int i = 0; i < ARMS_MAX && gArmsData[i].code; i++) @@ -296,9 +296,9 @@ void PutCampObject() rcArms.top = 16 * (gArmsData[i].code / 16); rcArms.bottom = rcArms.top + 16; - PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 192) / 2, &rcArms, 12); - PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 128) / 2, &rcPer, 26); - PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, &rcLv, 26); + PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 192) / 2, &rcArms, SURFACE_ID_ARMS_IMAGE); + PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 128) / 2, &rcPer, SURFACE_ID_TEXT_BOX); + PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, &rcLv, SURFACE_ID_TEXT_BOX); PutNumber4(40 * i + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT - 160) / 2, gArmsData[i].level, 0); //Draw ammo @@ -309,16 +309,16 @@ void PutCampObject() } else { - PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 192) / 2, (WINDOW_HEIGHT - 144) / 2, &rcNone, 26); - PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 192) / 2, (WINDOW_HEIGHT - 128) / 2, &rcNone, 26); + PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 192) / 2, (WINDOW_HEIGHT - 144) / 2, &rcNone, SURFACE_ID_TEXT_BOX); + PutBitmap3(&rcView, 40 * i + (WINDOW_WIDTH - 192) / 2, (WINDOW_HEIGHT - 128) / 2, &rcNone, SURFACE_ID_TEXT_BOX); } } //Draw items cursor if (gCampActive) - PutBitmap3(&rcView, 32 * (gSelectedItem % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (gSelectedItem / 6) + (WINDOW_HEIGHT - 88) / 2, &rcCur2[(flash >> 1) & 1], 26); + PutBitmap3(&rcView, 32 * (gSelectedItem % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (gSelectedItem / 6) + (WINDOW_HEIGHT - 88) / 2, &rcCur2[(flash >> 1) & 1], SURFACE_ID_TEXT_BOX); else - PutBitmap3(&rcView, 32 * (gSelectedItem % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (gSelectedItem / 6) + (WINDOW_HEIGHT - 88) / 2, &rcCur2[1], 26); + PutBitmap3(&rcView, 32 * (gSelectedItem % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (gSelectedItem / 6) + (WINDOW_HEIGHT - 88) / 2, &rcCur2[1], SURFACE_ID_TEXT_BOX); for (int i = 0; i < ITEM_MAX && gItemData[i].code; i++) { @@ -328,7 +328,7 @@ void PutCampObject() rcItem.top = 16 * (gItemData[i].code / 8); rcItem.bottom = rcItem.top + 16; - PutBitmap3(&rcView, 32 * (i % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (i / 6) + (WINDOW_HEIGHT - 88) / 2, &rcItem, 8); + PutBitmap3(&rcView, 32 * (i % 6) + (WINDOW_WIDTH - 224) / 2, 16 * (i / 6) + (WINDOW_HEIGHT - 88) / 2, &rcItem, SURFACE_ID_ITEM_IMAGE); } } @@ -383,7 +383,7 @@ int CampLoop() return 2; } - PutBitmap4(&rcView, 0, 0, &rcView, 10); + PutBitmap4(&rcView, 0, 0, &rcView, SURFACE_ID_SCREEN_GRAB); PutCampObject(); PutTextScript(); PutFramePerSecound(); diff --git a/src/Boss.cpp b/src/Boss.cpp index 658cdb81..e5584f94 100644 --- a/src/Boss.cpp +++ b/src/Boss.cpp @@ -66,7 +66,7 @@ void PutBossChar(int fx, int fy) (gBoss[b].x - side) / 0x200 - fx / 0x200 + a, (gBoss[b].y - gBoss[b].view.top) / 0x200 - fy / 0x200, &gBoss[b].rect, - 22); + SURFACE_ID_LEVEL_SPRITESET_2); } } } diff --git a/src/Bullet.cpp b/src/Bullet.cpp index eac79056..94a4831a 100644 --- a/src/Bullet.cpp +++ b/src/Bullet.cpp @@ -135,7 +135,7 @@ void PutBullet(int fx, int fy) break; } - PutBitmap3(&grcGame, x / 0x200 - fx / 0x200, y / 0x200 - fy / 0x200, &gBul[i].rect, 17); + PutBitmap3(&grcGame, x / 0x200 - fx / 0x200, y / 0x200 - fy / 0x200, &gBul[i].rect, SURFACE_ID_BULLET); } } } diff --git a/src/Caret.cpp b/src/Caret.cpp index 18c69d3d..55b49c7f 100644 --- a/src/Caret.cpp +++ b/src/Caret.cpp @@ -539,7 +539,7 @@ void PutCaret(int fx, int fy) (gCrt[i].x - gCrt[i].view_left) / 0x200 - fx / 0x200, (gCrt[i].y - gCrt[i].view_top) / 0x200 - fy / 0x200, &gCrt[i].rect, - 19); + SURFACE_ID_CARET); } } } diff --git a/src/Draw.cpp b/src/Draw.cpp index 8e7a6bab..6fbce920 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -133,7 +133,7 @@ void ReleaseSurface(int s) } } -bool MakeSurface_Generic(int bxsize, int bysize, int surf_no) +bool MakeSurface_Generic(int bxsize, int bysize, Surface_Ids surf_no) { bool success = false; @@ -182,7 +182,7 @@ bool MakeSurface_Generic(int bxsize, int bysize, int surf_no) return success; } -static void FlushSurface(int surf_no) +static void FlushSurface(Surface_Ids surf_no) { unsigned char *raw_pixels; int pitch; @@ -209,7 +209,7 @@ static void FlushSurface(int surf_no) SDL_UnlockTexture(surf[surf_no].texture); } -static bool LoadBitmap(SDL_RWops *fp, int surf_no, bool create_surface) +static bool LoadBitmap(SDL_RWops *fp, Surface_Ids surf_no, bool create_surface) { bool success = false; @@ -292,7 +292,7 @@ static bool LoadBitmap(SDL_RWops *fp, int surf_no, bool create_surface) return success; } -static bool LoadBitmap_File(const char *name, int surf_no, bool create_surface) +static bool LoadBitmap_File(const char *name, Surface_Ids surf_no, bool create_surface) { char path[PATH_LENGTH]; SDL_RWops *fp; @@ -329,7 +329,7 @@ static bool LoadBitmap_File(const char *name, int surf_no, bool create_surface) return false; } -static bool LoadBitmap_Resource(const char *res, int surf_no, bool create_surface) +static bool LoadBitmap_Resource(const char *res, Surface_Ids surf_no, bool create_surface) { SDL_RWops *fp = FindResource(res); @@ -344,22 +344,22 @@ static bool LoadBitmap_Resource(const char *res, int surf_no, bool create_surfac return false; } -bool MakeSurface_File(const char *name, int surf_no) +bool MakeSurface_File(const char *name, Surface_Ids surf_no) { return LoadBitmap_File(name, surf_no, true); } -bool MakeSurface_Resource(const char *res, int surf_no) +bool MakeSurface_Resource(const char *res, Surface_Ids surf_no) { return LoadBitmap_Resource(res, surf_no, true); } -bool ReloadBitmap_File(const char *name, int surf_no) +bool ReloadBitmap_File(const char *name, Surface_Ids surf_no) { return LoadBitmap_File(name, surf_no, false); } -bool ReloadBitmap_Resource(const char *res, int surf_no) +bool ReloadBitmap_Resource(const char *res, Surface_Ids surf_no) { return LoadBitmap_Resource(res, surf_no, false); } @@ -374,7 +374,7 @@ SDL_Rect RectToSDLRect(RECT *rect) return SDLRect; } -void BackupSurface(int surf_no, RECT *rect) +void BackupSurface(Surface_Ids surf_no, RECT *rect) { //Get renderer size int w, h; @@ -396,7 +396,7 @@ void BackupSurface(int surf_no, RECT *rect) SDL_FreeSurface(surface); } -static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, int surf_no, bool transparent) +static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no, bool transparent) { if (surf[surf_no].needs_updating) { @@ -427,12 +427,12 @@ static void DrawBitmap(RECT *rcView, int x, int y, RECT *rect, int surf_no, bool SDL_RenderSetClipRect(gRenderer, NULL); } -void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, int surf_no) //Transparency +void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no) //Transparency { DrawBitmap(rcView, x, y, rect, surf_no, true); } -void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, int surf_no) //No Transparency +void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no) //No Transparency { DrawBitmap(rcView, x, y, rect, surf_no, false); } @@ -459,7 +459,7 @@ void CortBox(RECT *rect, uint32_t col) SDL_RenderFillRect(gRenderer, &destRect); } -void CortBox2(RECT *rect, uint32_t col, int surf_no) +void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no) { //Get rect SDL_Rect destRect = RectToSDLRect(rect); @@ -581,7 +581,7 @@ void PutText(int x, int y, const char *text, uint32_t color) SDL_DestroyTexture(screen_texture); } -void PutText2(int x, int y, const char *text, uint32_t color, int surf_no) +void PutText2(int x, int y, const char *text, uint32_t color, Surface_Ids surf_no) { DrawText(gFont, surf[surf_no].surface, x * magnification, y * magnification, color, text, strlen(text)); surf[surf_no].needs_updating = true; diff --git a/src/Draw.h b/src/Draw.h index 2e7aed58..dc834463 100644 --- a/src/Draw.h +++ b/src/Draw.h @@ -12,35 +12,41 @@ extern RECT grcFull; extern int magnification; extern bool fullscreen; -enum Surface_Ids +typedef enum Surface_Ids { - SURFACE_ID_TITLE = 0x0, - SURFACE_ID_PIXEL = 0x1, - SURFACE_ID_LEVEL_TILESET = 0x2, - SURFACE_ID_FADE = 0x6, - SURFACE_ID_ITEM_IMAGE = 0x8, - SURFACE_ID_MAP = 0x9, - SURFACE_ID_SCREEN_GRAB = 0xA, - SURFACE_ID_ARMS = 0xB, - SURFACE_ID_ARMS_IMAGE = 0xC, - SURFACE_ID_ROOM_NAME = 0xD, - SURFACE_ID_STAGE_ITEM = 0xE, - SURFACE_ID_LOADING = 0xF, - SURFACE_ID_MY_CHAR = 0x10, - SURFACE_ID_BULLET = 0x11, - SURFACE_ID_CARET = 0x13, - SURFACE_ID_NPC_SYM = 0x14, - SURFACE_ID_LEVEL_SPRITESET_1 = 0x15, - SURFACE_ID_LEVEL_SPRITESET_2 = 0x16, - SURFACE_ID_NPC_REGU = 0x17, - SURFACE_ID_TEXT_BOX = 0x1A, - SURFACE_ID_FACE = 0x1B, - SURFACE_ID_LEVEL_BACKGROUND = 0x1C, - SURFACE_ID_CREDIT_CAST = 0x23, - SURFACE_ID_CREDITS_IMAGE = 0x24, - SURFACE_ID_CASTS = 0x25, - SURFACE_ID_MAX = 0x28, -}; + SURFACE_ID_TITLE = 0, + SURFACE_ID_PIXEL = 1, + SURFACE_ID_LEVEL_TILESET = 2, + SURFACE_ID_FADE = 6, + SURFACE_ID_ITEM_IMAGE = 8, + SURFACE_ID_MAP = 9, + SURFACE_ID_SCREEN_GRAB = 10, + SURFACE_ID_ARMS = 11, + SURFACE_ID_ARMS_IMAGE = 12, + SURFACE_ID_ROOM_NAME = 13, + SURFACE_ID_STAGE_ITEM = 14, + SURFACE_ID_LOADING = 15, + SURFACE_ID_MY_CHAR = 16, + SURFACE_ID_BULLET = 17, + SURFACE_ID_CARET = 19, + SURFACE_ID_NPC_SYM = 20, + SURFACE_ID_LEVEL_SPRITESET_1 = 21, + SURFACE_ID_LEVEL_SPRITESET_2 = 22, + SURFACE_ID_NPC_REGU = 23, + SURFACE_ID_TEXT_BOX = 26, + SURFACE_ID_FACE = 27, + SURFACE_ID_LEVEL_BACKGROUND = 28, + SURFACE_ID_VALUE_VIEW = 29, + SURFACE_ID_TEXT_LINE1 = 30, + SURFACE_ID_TEXT_LINE2 = 31, + SURFACE_ID_TEXT_LINE3 = 32, + SURFACE_ID_TEXT_LINE4 = 33, + SURFACE_ID_TEXT_LINE5 = 34, + SURFACE_ID_CREDIT_CAST = 35, + SURFACE_ID_CREDITS_IMAGE = 36, + SURFACE_ID_CASTS = 37, + SURFACE_ID_MAX = 40, +} Surface_Ids; struct SURFACE { @@ -56,18 +62,18 @@ bool Flip_SystemTask(); bool StartDirectDraw(int lMagnification, int lColourDepth); void EndDirectDraw(); void ReleaseSurface(int s); -bool MakeSurface_File(const char *name, int surf_no); -bool MakeSurface_Resource(const char *res, int surf_no); -bool ReloadBitmap_File(const char *name, int surf_no); -bool ReloadBitmap_Resource(const char *res, int surf_no); -bool MakeSurface_Generic(int bxsize, int bysize, int surf_no); -void BackupSurface(int surf_no, RECT *rect); -void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, int surf_no); -void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, int surf_no); +bool MakeSurface_File(const char *name, Surface_Ids surf_no); +bool MakeSurface_Resource(const char *res, Surface_Ids surf_no); +bool ReloadBitmap_File(const char *name, Surface_Ids surf_no); +bool ReloadBitmap_Resource(const char *res, Surface_Ids surf_no); +bool MakeSurface_Generic(int bxsize, int bysize, Surface_Ids surf_no); +void BackupSurface(Surface_Ids surf_no, RECT *rect); +void PutBitmap3(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no); +void PutBitmap4(RECT *rcView, int x, int y, RECT *rect, Surface_Ids surf_no); void Surface2Surface(int x, int y, RECT *rect, int to, int from); void CortBox(RECT *rect, uint32_t col); -void CortBox2(RECT *rect, uint32_t col, int surf_no); +void CortBox2(RECT *rect, uint32_t col, Surface_Ids surf_no); void InitTextObject(const char *font_name); void PutText(int x, int y, const char *text, uint32_t color); -void PutText2(int x, int y, const char *text, uint32_t color, int surf_no); +void PutText2(int x, int y, const char *text, uint32_t color, Surface_Ids surf_no); void EndTextObject(); diff --git a/src/Ending.cpp b/src/Ending.cpp index 8d4dd5af..1a045e42 100644 --- a/src/Ending.cpp +++ b/src/Ending.cpp @@ -455,9 +455,9 @@ int Scene_DownIsland(int mode) //Draw scene CortBox(&grcFull, 0); - PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 80 + (WINDOW_HEIGHT - 240) / 2, &rc_sky, 21); - PutBitmap3(&rc_frame, sprite.x / 0x200 - 20 + (WINDOW_WIDTH - 320) / 2, sprite.y / 512 - 12 + (WINDOW_HEIGHT - 240) / 2, &rc_sprite, 21); - PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 128 + (WINDOW_HEIGHT - 240) / 2, &rc_ground, 21); + PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 80 + (WINDOW_HEIGHT - 240) / 2, &rc_sky, SURFACE_ID_LEVEL_SPRITESET_1); + PutBitmap3(&rc_frame, sprite.x / 0x200 - 20 + (WINDOW_WIDTH - 320) / 2, sprite.y / 512 - 12 + (WINDOW_HEIGHT - 240) / 2, &rc_sprite, SURFACE_ID_LEVEL_SPRITESET_1); + PutBitmap3(&rc_frame, 80 + (WINDOW_WIDTH - 320) / 2, 128 + (WINDOW_HEIGHT - 240) / 2, &rc_ground, SURFACE_ID_LEVEL_SPRITESET_1); PutTimeCounter(16, 8); //Draw window diff --git a/src/Escape.cpp b/src/Escape.cpp index f1befd4f..795fcd29 100644 --- a/src/Escape.cpp +++ b/src/Escape.cpp @@ -33,7 +33,7 @@ int Call_Escape() //Draw screen CortBox(&grcFull, 0x000000); - PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, 26); + PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, SURFACE_ID_TEXT_BOX); PutFramePerSecound(); if (!Flip_SystemTask()) diff --git a/src/Fade.cpp b/src/Fade.cpp index 6fd55084..cb25119d 100644 --- a/src/Fade.cpp +++ b/src/Fade.cpp @@ -283,7 +283,7 @@ void PutFade() { rect.left = 16 * gFade.ani_no[y][x]; rect.right = rect.left + 16; - PutBitmap3(&grcGame, 16 * x, 16 * y, &rect, 6); + PutBitmap3(&grcGame, 16 * x, 16 * y, &rect, SURFACE_ID_FADE); } } } diff --git a/src/Game.cpp b/src/Game.cpp index f7f2f8b8..fa5fbd50 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -352,14 +352,14 @@ int ModeTitle() PutNumber4((WINDOW_WIDTH + 56) / 2, WINDOW_HEIGHT - 24, v4, 0); //Draw main title - PutBitmap3(&grcGame, (WINDOW_WIDTH - 144) / 2, 40, &rcTitle, 0); - PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 16) / 2, &rcNew, 0); - PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 56) / 2, &rcContinue, 0); - PutBitmap3(&grcGame, (WINDOW_WIDTH - 160) / 2, WINDOW_HEIGHT - 48, &rcPixel, 1); + PutBitmap3(&grcGame, (WINDOW_WIDTH - 144) / 2, 40, &rcTitle, SURFACE_ID_TITLE); + PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 16) / 2, &rcNew, SURFACE_ID_TITLE); + PutBitmap3(&grcGame, (WINDOW_WIDTH - 48) / 2, (WINDOW_HEIGHT + 56) / 2, &rcContinue, SURFACE_ID_TITLE); + PutBitmap3(&grcGame, (WINDOW_WIDTH - 160) / 2, WINDOW_HEIGHT - 48, &rcPixel, SURFACE_ID_PIXEL); //Draw character cursor RECT char_rc; - int char_surf; + Surface_Ids char_surf; switch ( char_type ) { @@ -530,7 +530,7 @@ int ModeAction() //Open inventory if (gKeyTrg & gKeyItem) { - BackupSurface(10, &grcGame); + BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame); switch (CampLoop()) { @@ -544,7 +544,7 @@ int ModeAction() } else if (gMC.equip & 2 && gKeyTrg & gKeyMap) { - BackupSurface(10, &grcGame); + BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcGame); switch (MiniMapLoop()) { diff --git a/src/GenericLoad.cpp b/src/GenericLoad.cpp index b6edacd2..7c1c660f 100644 --- a/src/GenericLoad.cpp +++ b/src/GenericLoad.cpp @@ -149,37 +149,37 @@ static const PIXTONEPARAMETER gPtpTable[139] = bool LoadGenericData() { - MakeSurface_Resource("PIXEL", 1); + MakeSurface_Resource("PIXEL", SURFACE_ID_PIXEL); bool bError = false; - if (!MakeSurface_File("MyChar", 16)) + if (!MakeSurface_File("MyChar", SURFACE_ID_MY_CHAR)) bError = true; - if (!MakeSurface_File("Title", 0)) + if (!MakeSurface_File("Title", SURFACE_ID_TITLE)) bError = true; - if (!MakeSurface_File("ArmsImage", 12)) + if (!MakeSurface_File("ArmsImage", SURFACE_ID_ARMS_IMAGE)) bError = true; - if (!MakeSurface_File("Arms", 11)) + if (!MakeSurface_File("Arms", SURFACE_ID_ARMS)) bError = true; - if (!MakeSurface_File("ItemImage", 8)) + if (!MakeSurface_File("ItemImage", SURFACE_ID_ITEM_IMAGE)) bError = true; - if (!MakeSurface_File("StageImage", 14)) + if (!MakeSurface_File("StageImage", SURFACE_ID_STAGE_ITEM)) bError = true; - if (!MakeSurface_File("Npc/NpcSym", 20)) + if (!MakeSurface_File("Npc/NpcSym", SURFACE_ID_NPC_SYM)) bError = true; - if (!MakeSurface_File("Npc/NpcRegu", 23)) + if (!MakeSurface_File("Npc/NpcRegu", SURFACE_ID_NPC_REGU)) bError = true; - if (!MakeSurface_File("TextBox", 26)) + if (!MakeSurface_File("TextBox", SURFACE_ID_TEXT_BOX)) bError = true; - if (!MakeSurface_File("Caret", 19)) + if (!MakeSurface_File("Caret", SURFACE_ID_CARET)) bError = true; - if (!MakeSurface_File("Bullet", 17)) + if (!MakeSurface_File("Bullet", SURFACE_ID_BULLET)) bError = true; - if (!MakeSurface_File("Face", 27)) + if (!MakeSurface_File("Face", SURFACE_ID_FACE)) bError = true; - if (!MakeSurface_File("Fade", 6)) + if (!MakeSurface_File("Fade", SURFACE_ID_FADE)) bError = true; - MakeSurface_Resource("CREDIT01", 36); + MakeSurface_Resource("CREDIT01", SURFACE_ID_CREDITS_IMAGE); if (bError) { @@ -190,10 +190,10 @@ bool LoadGenericData() MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_SCREEN_GRAB); MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_LEVEL_BACKGROUND); MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_MAP); - MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, 37); //Unknown? + MakeSurface_Generic(WINDOW_WIDTH, WINDOW_HEIGHT, SURFACE_ID_CASTS); MakeSurface_Generic(256, 256, SURFACE_ID_LEVEL_TILESET); MakeSurface_Generic(160, 16, SURFACE_ID_ROOM_NAME); - MakeSurface_Generic(40, 240, 29); //Unknown? + MakeSurface_Generic(40, 240, SURFACE_ID_VALUE_VIEW); MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_SPRITESET_1); MakeSurface_Generic(320, 240, SURFACE_ID_LEVEL_SPRITESET_2); MakeSurface_Generic(WINDOW_WIDTH, 16 * MAX_STRIP, SURFACE_ID_CREDIT_CAST); diff --git a/src/MiniMap.cpp b/src/MiniMap.cpp index f4cc37cd..f0f03856 100644 --- a/src/MiniMap.cpp +++ b/src/MiniMap.cpp @@ -100,7 +100,7 @@ int MiniMapLoop() } } - PutBitmap4(&grcGame, 0, 0, &grcGame, 10); + PutBitmap4(&grcGame, 0, 0, &grcGame, SURFACE_ID_SCREEN_GRAB); rcView = {(WINDOW_WIDTH / 2) - f * gMap.width / 16, (WINDOW_HEIGHT / 2) - f * gMap.length / 16, (WINDOW_WIDTH / 2) + f * gMap.width / 16, (WINDOW_HEIGHT / 2) + f * gMap.length / 16}; PutMapName(true); @@ -114,7 +114,7 @@ int MiniMapLoop() RECT rcMiniMap = {0, 0, gMap.width, gMap.length}; rcView.right = --rcView.left + gMap.width + 2; rcView.bottom = --rcView.top + gMap.length + 2; - CortBox2(&rcMiniMap, 0, 9); + CortBox2(&rcMiniMap, 0, SURFACE_ID_MAP); int line = 0; uint8_t my_wait = 0; @@ -136,19 +136,19 @@ int MiniMapLoop() } } - PutBitmap4(&grcGame, 0, 0, &grcGame, 10); + PutBitmap4(&grcGame, 0, 0, &grcGame, SURFACE_ID_SCREEN_GRAB); CortBox(&rcView, 0); if (gMap.length > line) WriteMiniMapLine(line++); if (gMap.length > line) WriteMiniMapLine(line++); - PutBitmap3(&grcGame, rcView.left + 1, rcView.top + 1, &rcMiniMap, 9); + PutBitmap3(&grcGame, rcView.left + 1, rcView.top + 1, &rcMiniMap, SURFACE_ID_MAP); PutMapName(true); if ((++my_wait >> 3) & 1) - PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, 26); + PutBitmap3(&grcGame, my_x + rcView.left + 1, my_y + rcView.top + 1, &my_rect, SURFACE_ID_TEXT_BOX); PutFramePerSecound(); if (!Flip_SystemTask()) @@ -170,7 +170,7 @@ int MiniMapLoop() } } - PutBitmap4(&grcGame, 0, 0, &grcGame, 10); + PutBitmap4(&grcGame, 0, 0, &grcGame, SURFACE_ID_SCREEN_GRAB); rcView = {(WINDOW_WIDTH / 2) - f * gMap.width / 16, (WINDOW_HEIGHT / 2) - f * gMap.length / 16, (WINDOW_WIDTH / 2) + f * gMap.width / 16, (WINDOW_HEIGHT / 2) + f * gMap.length / 16}; PutMapName(true); CortBox(&rcView, 0); diff --git a/src/MyChar.cpp b/src/MyChar.cpp index 935a20c4..bb0b0854 100644 --- a/src/MyChar.cpp +++ b/src/MyChar.cpp @@ -193,14 +193,14 @@ void PutMyChar(int fx, int fy) (gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y, &gMC.rect_arms, - 11); + SURFACE_ID_ARMS); else PutBitmap3( &grcGame, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200 - 8, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200 + arms_offset_y, &gMC.rect_arms, - 11); + SURFACE_ID_ARMS); if (!((gMC.shock >> 1) & 1)) { @@ -212,7 +212,7 @@ void PutMyChar(int fx, int fy) rect.bottom += 32; } - PutBitmap3(&grcGame, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, 16); + PutBitmap3(&grcGame, (gMC.x - gMC.view.left) / 0x200 - fx / 0x200, (gMC.y - gMC.view.top) / 0x200 - fy / 0x200, &rect, SURFACE_ID_MY_CHAR); //Draw airtank RECT rcBubble[2]; @@ -221,9 +221,9 @@ void PutMyChar(int fx, int fy) ++gMC.bubble; if (gMC.equip & 0x10 && gMC.flag & 0x100) - PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], 19); + PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], SURFACE_ID_CARET); else if (gMC.unit == 1) - PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], 19); + PutBitmap3(&grcGame, gMC.x / 0x200 - 12 - fx / 0x200, gMC.y / 0x200 - 12 - fy / 0x200, &rcBubble[(gMC.bubble >> 1) & 1], SURFACE_ID_CARET); } } } diff --git a/src/MycParam.cpp b/src/MycParam.cpp index ebfd30e2..3918f6ca 100644 --- a/src/MycParam.cpp +++ b/src/MycParam.cpp @@ -218,15 +218,15 @@ void PutArmsEnergy(bool flash) } else { - PutBitmap3(&rcView, gArmsEnergyX + 48, 16, &rcNone, 26); - PutBitmap3(&rcView, gArmsEnergyX + 48, 24, &rcNone, 26); + PutBitmap3(&rcView, gArmsEnergyX + 48, 16, &rcNone, SURFACE_ID_TEXT_BOX); + PutBitmap3(&rcView, gArmsEnergyX + 48, 24, &rcNone, SURFACE_ID_TEXT_BOX); } //Draw experience and ammo if (!flash || !((gMC.shock >> 1) & 1)) { - PutBitmap3(&rcView, gArmsEnergyX + 32, 24, &rcPer, 26); - PutBitmap3(&rcView, gArmsEnergyX, 32, &rcLv, 26); + PutBitmap3(&rcView, gArmsEnergyX + 32, 24, &rcPer, SURFACE_ID_TEXT_BOX); + PutBitmap3(&rcView, gArmsEnergyX, 32, &rcLv, SURFACE_ID_TEXT_BOX); PutNumber4(gArmsEnergyX - 8, 32, gArmsData[gSelectedArms].level, 0); RECT rcExpBox = {0, 72, 40, 80}; @@ -239,7 +239,7 @@ void PutArmsEnergy(bool flash) int exp_now = gArmsData[gSelectedArms].exp; int exp_next = gArmsLevelTable[0].exp[lv + 3 * arms_code]; - PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpBox, 26); + PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpBox, SURFACE_ID_TEXT_BOX); if (lv != 2 || gArmsData[gSelectedArms].exp != gArmsLevelTable[0].exp[3 * arms_code + 2]) { @@ -248,16 +248,16 @@ void PutArmsEnergy(bool flash) else rcExpVal.right = 0; - PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpVal, 26); + PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpVal, SURFACE_ID_TEXT_BOX); } else { - PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpMax, 26); + PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpMax, SURFACE_ID_TEXT_BOX); } static int add_flash = true; if (gMC.exp_wait && ((add_flash++ >> 1) & 1)) - PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpFlash, 26); + PutBitmap3(&rcView, gArmsEnergyX + 24, 32, &rcExpFlash, SURFACE_ID_TEXT_BOX); } } @@ -293,7 +293,7 @@ void PutActiveArmsList() //Draw icon rect.left = 16 * gArmsData[a].code; rect.right = rect.left + 16; - PutBitmap3(&grcGame, x, 16, &rect, 12); + PutBitmap3(&grcGame, x, 16, &rect, SURFACE_ID_ARMS_IMAGE); } } } @@ -319,9 +319,9 @@ void PutMyLife(bool flash) rcLife.right = 40 * gMC.life / gMC.max_life - 1; rcBr.right = 40 * gMC.lifeBr / gMC.max_life - 1; - PutBitmap3(&grcGame, 16, 40, &rcCase, 26); - PutBitmap3(&grcGame, 40, 40, &rcBr, 26); - PutBitmap3(&grcGame, 40, 40, &rcLife, 26); + PutBitmap3(&grcGame, 16, 40, &rcCase, SURFACE_ID_TEXT_BOX); + PutBitmap3(&grcGame, 40, 40, &rcBr, SURFACE_ID_TEXT_BOX); + PutBitmap3(&grcGame, 40, 40, &rcLife, SURFACE_ID_TEXT_BOX); PutNumber4(8, 40, gMC.lifeBr, 0); } } @@ -340,9 +340,9 @@ void PutMyAir(int x, int y) //Draw "AIR" text if (gMC.air % 30 <= 10) - PutBitmap3(&grcGame, x, y, &rcAir[1], 26); + PutBitmap3(&grcGame, x, y, &rcAir[1], SURFACE_ID_TEXT_BOX); else - PutBitmap3(&grcGame, x, y, &rcAir[0], 26); + PutBitmap3(&grcGame, x, y, &rcAir[0], SURFACE_ID_TEXT_BOX); } } @@ -362,20 +362,20 @@ void PutTimeCounter(int x, int y) ++time_count; if (time_count % 30 <= 10) - PutBitmap3(&grcGame, x, y, &rcTime[1], 26); + PutBitmap3(&grcGame, x, y, &rcTime[1], SURFACE_ID_TEXT_BOX); else - PutBitmap3(&grcGame, x, y, &rcTime[0], 26); + PutBitmap3(&grcGame, x, y, &rcTime[0], SURFACE_ID_TEXT_BOX); } else { - PutBitmap3(&grcGame, x, y, &rcTime[0], 26); + PutBitmap3(&grcGame, x, y, &rcTime[0], SURFACE_ID_TEXT_BOX); } //Draw time PutNumber4(x, y, time_count / 3000, false); PutNumber4(x + 20, y, time_count / 50 % 60, true); PutNumber4(x + 32, y, time_count / 5 % 10, false); - PutBitmap3(&grcGame, x + 30, y, &rcTime[2], 26); + PutBitmap3(&grcGame, x + 30, y, &rcTime[2], SURFACE_ID_TEXT_BOX); } else { diff --git a/src/NpChar.h b/src/NpChar.h index 4cd6b14e..2ba81838 100644 --- a/src/NpChar.h +++ b/src/NpChar.h @@ -2,6 +2,8 @@ #include #include "WindowsWrapper.h" +#include "Draw.h" + #define NPC_MAX 0x200 enum NPC_flags @@ -38,7 +40,7 @@ struct NPCHAR int code_char; int code_flag; int code_event; - int surf; + Surface_Ids surf; int hit_voice; int destroy_voice; int life; diff --git a/src/NpcAct060.cpp b/src/NpcAct060.cpp index 0e352666..eefcc7e9 100644 --- a/src/NpcAct060.cpp +++ b/src/NpcAct060.cpp @@ -367,7 +367,7 @@ void ActNpc061(NPCHAR *npc) SetNpChar(4, npc->x + (Random(-12, 12) * 0x200), npc->y + (Random(-12, 12) * 0x200), Random(-341, 341), Random(-0x600, 0), 0, 0, 0x100); npc->act_no = 50; - npc->surf = 20; + npc->surf = SURFACE_ID_NPC_SYM; npc->ani_no = 10; } diff --git a/src/NpcAct340.cpp b/src/NpcAct340.cpp index 606816c7..fe701095 100644 --- a/src/NpcAct340.cpp +++ b/src/NpcAct340.cpp @@ -1479,7 +1479,7 @@ void ActNpc352(NPCHAR *npc) case 9: case 12: case 13: - npc->surf = 21; + npc->surf = SURFACE_ID_LEVEL_SPRITESET_1; break; default: break; @@ -1747,28 +1747,28 @@ void ActNpc355(NPCHAR *npc) switch (npc->direct) { case 0: - npc->surf = 16; + npc->surf = SURFACE_ID_MY_CHAR; npc->ani_no = 0; npc->x = npc->pNpc->x - 0x1C00; npc->y = npc->pNpc->y + 0x1400; break; case 1: - npc->surf = 23; + npc->surf = SURFACE_ID_NPC_REGU; npc->ani_no = 1; npc->x = npc->pNpc->x + 0x1C00; npc->y = npc->pNpc->y + 0x1400; break; case 2: - npc->surf = 16; + npc->surf = SURFACE_ID_MY_CHAR; npc->ani_no = 2; npc->x = npc->pNpc->x - 0xE00; npc->y = npc->pNpc->y - 0x2600; break; case 3: - npc->surf = 23; + npc->surf = SURFACE_ID_NPC_REGU; npc->ani_no = 3; npc->x = npc->pNpc->x + 0x800; npc->y = npc->pNpc->y - 0x2600; diff --git a/src/NpcTbl.h b/src/NpcTbl.h index 53adc243..8a41c7d5 100644 --- a/src/NpcTbl.h +++ b/src/NpcTbl.h @@ -1,6 +1,7 @@ #pragma once #include #include "NpChar.h" +#include "Draw.h" struct NPC_TBL_RECT { @@ -14,7 +15,7 @@ struct NPC_TABLE { uint16_t bits; uint16_t life; - uint8_t surf; + Surface_Ids surf; uint8_t hit_voice; uint8_t destroy_voice; uint8_t size; diff --git a/src/SelStage.cpp b/src/SelStage.cpp index d69277f4..1e576cde 100644 --- a/src/SelStage.cpp +++ b/src/SelStage.cpp @@ -138,7 +138,7 @@ int StageSelectLoop(int *p_event) RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT}; gSelectedStage = 0; - BackupSurface(10, &grcFull); + BackupSurface(SURFACE_ID_SCREEN_GRAB, &grcFull); GetTextScriptPath(old_script_path); LoadTextScript2("StageSelect.tsc"); gStageSelectTitleY = (WINDOW_HEIGHT / 2) - 66; @@ -166,10 +166,10 @@ int StageSelectLoop(int *p_event) return 2; #ifdef FIX_BUGS - PutBitmap4(&rcView, 0, 0, &rcView, 10); + PutBitmap4(&rcView, 0, 0, &rcView, SURFACE_ID_SCREEN_GRAB); #else // The original accidentally drew the screencap with transparency enabled - PutBitmap3(&rcView, 0, 0, &rcView, 10); + PutBitmap3(&rcView, 0, 0, &rcView, SURFACE_ID_SCREEN_GRAB); #endif PutStageSelectObject(); PutTextScript(); diff --git a/src/Star.cpp b/src/Star.cpp index 49401717..9567b4c1 100644 --- a/src/Star.cpp +++ b/src/Star.cpp @@ -120,7 +120,7 @@ void PutStar(int fx, int fy) for (int i = 0; i < 3; i++) { if (gMC.star > i) - PutBitmap3(&grcGame, star[i].x / 0x200 - fx / 0x200 - 4, star[i].y / 0x200 - fy / 0x200 - 4, &rc[i], 16); + PutBitmap3(&grcGame, star[i].x / 0x200 - fx / 0x200 - 4, star[i].y / 0x200 - fy / 0x200 - 4, &rc[i], SURFACE_ID_MY_CHAR); } } } diff --git a/src/TextScr.cpp b/src/TextScr.cpp index 4eb19eaa..e8050bae 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -53,7 +53,7 @@ BOOL InitTextScript2() //Create line surfaces for (int i = 0; i < 4; i++) - MakeSurface_Generic(gRect_line.right, gRect_line.bottom, i + 30); + MakeSurface_Generic(gRect_line.right, gRect_line.bottom, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1)); //Clear text memset(text, 0, sizeof(text)); @@ -216,7 +216,7 @@ BOOL StartTextScript(int no) for (int i = 0; i < 4; i++) { gTS.ypos_line[i] = 16 * i; - CortBox2(&gRect_line, 0x000000, i + 30); + CortBox2(&gRect_line, 0x000000, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1)); memset(&text[i * 0x40], 0, 0x40); }*/ @@ -265,7 +265,7 @@ BOOL JumpTextScript(int no) for (int i = 0; i < 4; i++) { gTS.ypos_line[i] = 16 * i; - CortBox2(&gRect_line, 0x000000, i + 30); + CortBox2(&gRect_line, 0x000000, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1)); memset(&text[i * 0x40], 0, 0x40); } @@ -317,7 +317,7 @@ void CheckNewLine() { gTS.mode = 3; g_GameFlags |= 4; - CortBox2(&gRect_line, 0, gTS.line % 4 + 30); + CortBox2(&gRect_line, 0, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1)); memset(&text[gTS.line % 4 * 0x40], 0, 0x40); } } @@ -357,7 +357,7 @@ void SetNumberTextScript(int index) str[offset + 1] = 0; //Append number to line - PutText2(6 * gTS.p_write, 0, str, 0xFFFFFE, gTS.line % 4 + 30); + PutText2(6 * gTS.p_write, 0, str, 0xFFFFFE, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1)); strcat(&text[gTS.line % 4 * 0x40], str); //Play sound and reset blinking cursor @@ -385,7 +385,7 @@ void ClearTextLine() for (int i = 0; i < 4; i++) { gTS.ypos_line[i] = 16 * i; - CortBox2(&gRect_line, 0x000000, i + 30); + CortBox2(&gRect_line, 0x000000, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1)); memset(&text[i * 0x40], 0, 0x40); } } @@ -418,11 +418,11 @@ void PutTextScript() RECT rcFrame2 = {0, 8, 244, 16}; RECT rcFrame3 = {0, 16, 244, 24}; - PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, gTS.rcText.top - 10, &rcFrame1, 26); + PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, gTS.rcText.top - 10, &rcFrame1, SURFACE_ID_TEXT_BOX); int i; for (i = 1; i < 7; i++) - PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, 8 * i + gTS.rcText.top - 10, &rcFrame2, 26); - PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, 8 * i + gTS.rcText.top - 10, &rcFrame3, 26); + PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, 8 * i + gTS.rcText.top - 10, &rcFrame2, SURFACE_ID_TEXT_BOX); + PutBitmap3(&grcFull, WINDOW_WIDTH / 2 - 122, 8 * i + gTS.rcText.top - 10, &rcFrame3, SURFACE_ID_TEXT_BOX); } //Draw face picture @@ -434,7 +434,7 @@ void PutTextScript() if (gTS.face_x < (TEXT_LEFT * 0x200)) gTS.face_x += 0x1000; - PutBitmap3(&gTS.rcText, gTS.face_x / 0x200, gTS.rcText.top - 3, &rcFace, 27); + PutBitmap3(&gTS.rcText, gTS.face_x / 0x200, gTS.rcText.top - 3, &rcFace, SURFACE_ID_FACE); //Draw text int text_offset; @@ -444,7 +444,7 @@ void PutTextScript() text_offset = 0; for (int i = 0; i < 4; i++) - PutBitmap3(&gTS.rcText, text_offset + TEXT_LEFT, gTS.offsetY + gTS.ypos_line[i] + gTS.rcText.top, &gRect_line, i + 30); + PutBitmap3(&gTS.rcText, text_offset + TEXT_LEFT, gTS.offsetY + gTS.ypos_line[i] + gTS.rcText.top, &gRect_line, (Surface_Ids)(i + SURFACE_ID_TEXT_LINE1)); //Draw NOD cursor if ((gTS.wait_beam++ % 20 > 12) && gTS.mode == 2) @@ -466,12 +466,12 @@ void PutTextScript() if (gTS.item) { - PutBitmap3(&grcFull, (WINDOW_WIDTH - 80) / 2, WINDOW_HEIGHT - 112, &rcItemBox1, 26); - PutBitmap3(&grcFull, (WINDOW_WIDTH - 80) / 2, WINDOW_HEIGHT - 96, &rcItemBox2, 26); - PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 112, &rcItemBox3, 26); - PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 104, &rcItemBox4, 26); - PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 96, &rcItemBox4, 26); - PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 88, &rcItemBox5, 26); + PutBitmap3(&grcFull, (WINDOW_WIDTH - 80) / 2, WINDOW_HEIGHT - 112, &rcItemBox1, SURFACE_ID_TEXT_BOX); + PutBitmap3(&grcFull, (WINDOW_WIDTH - 80) / 2, WINDOW_HEIGHT - 96, &rcItemBox2, SURFACE_ID_TEXT_BOX); + PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 112, &rcItemBox3, SURFACE_ID_TEXT_BOX); + PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 104, &rcItemBox4, SURFACE_ID_TEXT_BOX); + PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 96, &rcItemBox4, SURFACE_ID_TEXT_BOX); + PutBitmap3(&grcFull, (WINDOW_WIDTH + 64) / 2, WINDOW_HEIGHT - 88, &rcItemBox5, SURFACE_ID_TEXT_BOX); if (gTS.item_y < WINDOW_HEIGHT - 104) ++gTS.item_y; @@ -483,7 +483,7 @@ void PutTextScript() rect.right = rect.left + 16; rect.top = 16 * (gTS.item / 16); rect.bottom = rect.top + 16; - PutBitmap3(&grcFull, (WINDOW_WIDTH - 24) / 2, gTS.item_y, &rect, 12); + PutBitmap3(&grcFull, (WINDOW_WIDTH - 24) / 2, gTS.item_y, &rect, SURFACE_ID_ARMS_IMAGE); } else { @@ -491,7 +491,7 @@ void PutTextScript() rect.right = rect.left + 32; rect.top = 16 * ((gTS.item - 1000) / 8); rect.bottom = rect.top + 16; - PutBitmap3(&grcFull, (WINDOW_WIDTH - 40) / 2, gTS.item_y, &rect, 8); + PutBitmap3(&grcFull, (WINDOW_WIDTH - 40) / 2, gTS.item_y, &rect, SURFACE_ID_ITEM_IMAGE); } } @@ -507,9 +507,9 @@ void PutTextScript() else i = WINDOW_HEIGHT - 96; - PutBitmap3(&grcFull, (WINDOW_WIDTH + 112) / 2, i, &rect_yesno, 26); + PutBitmap3(&grcFull, (WINDOW_WIDTH + 112) / 2, i, &rect_yesno, SURFACE_ID_TEXT_BOX); if (gTS.wait == 16) - PutBitmap3(&grcFull, 41 * gTS.select + (WINDOW_WIDTH + 102) / 2, WINDOW_HEIGHT - 86, &rect_cur, 26); + PutBitmap3(&grcFull, 41 * gTS.select + (WINDOW_WIDTH + 102) / 2, WINDOW_HEIGHT - 86, &rect_cur, SURFACE_ID_TEXT_BOX); } } @@ -1233,7 +1233,7 @@ int TextScriptProc() gTS.p_write = x; //Print text - PutText2(0, 0, str, 0xFFFFFE, gTS.line % 4 + 30); + PutText2(0, 0, str, 0xFFFFFE, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1)); sprintf(&text[gTS.line % 4 * 0x40], str); //Check if should move to next line (prevent a memory overflow, come on guys, this isn't a leftover of pixel trying to make text wrapping) @@ -1263,11 +1263,11 @@ int TextScriptProc() //Print text if (c[0] == '=') { - Surface2Surface(6 * gTS.p_write, 2, &rcSymbol, gTS.line % 4 + 30, 26); + Surface2Surface(6 * gTS.p_write, 2, &rcSymbol, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1), SURFACE_ID_TEXT_BOX); } else { - PutText2(6 * gTS.p_write, 0, c, 0xFFFFFE, gTS.line % 4 + 30); + PutText2(6 * gTS.p_write, 0, c, 0xFFFFFE, (Surface_Ids)(gTS.line % 4 + SURFACE_ID_TEXT_LINE1)); } strcat(&text[gTS.line % 4 * 0x40], c); diff --git a/src/ValueView.cpp b/src/ValueView.cpp index 48d85c59..7a637d0b 100644 --- a/src/ValueView.cpp +++ b/src/ValueView.cpp @@ -131,12 +131,12 @@ void SetValueView(int *px, int *py, int value) RECT rcMinus = {40, 48, 48, 56}; //Draw value - CortBox2(&gVV[index].rect, 0x000000, 29); + CortBox2(&gVV[index].rect, 0x000000, SURFACE_ID_VALUE_VIEW); if (minus) - Surface2Surface(gVV[index].rect.left, gVV[index].rect.top, &rcMinus, 29, 26); + Surface2Surface(gVV[index].rect.left, gVV[index].rect.top, &rcMinus, SURFACE_ID_VALUE_VIEW, SURFACE_ID_TEXT_BOX); else - Surface2Surface(gVV[index].rect.left, gVV[index].rect.top, &rcPlus, 29, 26); + Surface2Surface(gVV[index].rect.left, gVV[index].rect.top, &rcPlus, SURFACE_ID_VALUE_VIEW, SURFACE_ID_TEXT_BOX); for (int i = 3; i >= 0; i--) { @@ -181,7 +181,7 @@ void PutValueView(int flx, int fly) (*gVV[v].px) / 0x200 - (gVV[v].rect.right - gVV[v].rect.left) / 2 - flx / 0x200, (*gVV[v].py) / 0x200 + gVV[v].offset_y / 0x200 - 4 - fly / 0x200, &gVV[v].rect, - 29); + SURFACE_ID_VALUE_VIEW); } } }