ref: 8a569b127f58dbc508a2f69029776bf7a64fa1a8
parent: f3a2c96ce6bfa8312134718b4b320151bd340dbf
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Apr 8 12:32:44 EDT 2019
Made MapName.cpp ASM-accurate
--- a/src/MapName.cpp
+++ b/src/MapName.cpp
@@ -5,6 +5,7 @@
#include "CommonDefines.h"
#include "Draw.h"
+#include "WindowsWrapper.h"
MAP_NAME gMapName;
RECT rc = { 0, 0, 160, 12 };
@@ -11,22 +12,71 @@
void ReadyMapName(const char *str)
{
- //Reset map name flags
- gMapName.flag = 0;
- gMapName.wait = 0;
-
+ int a;
+
//Handle "Studio Pixel presents" text in the intro
+ unsigned char presentText[24] = {
#ifdef JAPANESE
- char presentText[24] = "�J����Pixel presents";
+ // "�J����Pixel presents"
+ 0x8A-1, // �J
+ 0x4A-1,
+ 0x94-1, // ��
+ 0xAD-1,
+ 0x8E-1, // ��
+ 0xBA-1,
+ 'P'-1,
+ 'i'-1,
+ 'x'-1,
+ 'e'-1,
+ 'l'-1,
+ ' '-1,
+ 'p'-1,
+ 'r'-1,
+ 'e'-1,
+ 's'-1,
+ 'e'-1,
+ 'n'-1,
+ 't'-1,
+ 's'-1,
#else
- char presentText[24] = " Studio Pixel presents";
+ // " Studio Pixel presents"
+ ' '-1,
+ ' '-1,
+ 'S'-1,
+ 't'-1,
+ 'u'-1,
+ 'd'-1,
+ 'i'-1,
+ 'o'-1,
+ ' '-1,
+ 'P'-1,
+ 'i'-1,
+ 'x'-1,
+ 'e'-1,
+ 'l'-1,
+ ' '-1,
+ 'p'-1,
+ 'r'-1,
+ 'e'-1,
+ 's'-1,
+ 'e'-1,
+ 'n'-1,
+ 't'-1,
+ 's'-1,
#endif
-
+ 0xFF
+ };
+
+ //Reset map name flags
+ gMapName.flag = 0;
+ gMapName.wait = 0;
+
if (!strcmp(str, "u"))
{
- /*for (i = 0; i < strlen(presentText); i++) //No need for this, we aren't encrypting the text
- ++studio_pixel_presents_string[i];*/
- str = presentText;
+ for (a = 0; a < (int)sizeof(presentText); ++a)
+ presentText[a] = presentText[a] + 1;
+
+ str = (char*)presentText;
}
//Copy map's name to the MapName
@@ -33,19 +83,27 @@
strcpy(gMapName.name, str);
//Draw the text to the surface
- int len = (int)strlen(gMapName.name);
-
+ a = (int)strlen(gMapName.name);
+
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
- PutText2((-6 * len + 160) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
- PutText2((-6 * len + 160) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
+ PutText2((160 - 6 * a) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
+ PutText2((160 - 6 * a) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
}
-void PutMapName(bool bMini)
+void PutMapName(BOOL bMini)
{
+ // 'unused_rect' isn't the original name. The Linux port optimised this out, so there's no name for it.
+ RECT unused_rect = {0, 0, 160, 16};
+
if (bMini)
{
//Map system
- RECT rcBack = {0, 7, WINDOW_WIDTH, 24};
+ RECT rcBack;
+ rcBack.left = 0;
+ rcBack.right = WINDOW_WIDTH;
+ rcBack.top = 7;
+ rcBack.bottom = 24;
+
CortBox(&rcBack, 0x000000);
PutBitmap3(&grcGame, (WINDOW_WIDTH - 172) / 2, 10, &rc, SURFACE_ID_ROOM_NAME);
}
@@ -69,6 +127,6 @@
int len = (int)strlen(gMapName.name);
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
- PutText2((-6 * len + 160) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
- PutText2((-6 * len + 160) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
+ PutText2((160 - 6 * len) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
+ PutText2((160 - 6 * len) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
}
--- a/src/MapName.h
+++ b/src/MapName.h
@@ -1,5 +1,7 @@
#pragma once
+#include "WindowsWrapper.h"
+
struct MAP_NAME
{
int flag;
@@ -8,6 +10,6 @@
};
void ReadyMapName(const char *str);
-void PutMapName(bool bMini);
+void PutMapName(BOOL bMini);
void StartMapName();
void RestoreMapName();