shithub: cstory

Download patch

ref: d3af5e372ff9b2d0861f700b3e5af683f8ca758a
parent: 9b82baeb021dfa6b49225d7410586922c1b4f532
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon May 13 15:00:48 EDT 2019

Made ArmsItem.cpp ASM-accurate

--- a/msvc2003/devilution/comparer-config.toml
+++ b/msvc2003/devilution/comparer-config.toml
@@ -3,8 +3,76 @@
 address_offset = 0x400000
 
 [[func]]
+name = "ClearArmsData"
+addr = 0x401000
+
+[[func]]
+name = "ClearItemData"
+addr = 0x401030
+
+[[func]]
 name = "AddArmsData"
 addr = 0x401050
+
+[[func]]
+name = "SubArmsData"
+addr = 0x401160
+
+[[func]]
+name = "TradeArms"
+addr = 0x401220
+
+[[func]]
+name = "AddItemData"
+addr = 0x4012D0
+
+[[func]]
+name = "SubItemData"
+addr = 0x401330
+
+[[func]]
+name = "MoveCampCursor"
+addr = 0x4013C0
+
+[[func]]
+name = "PutCampObject"
+addr = 0x4016F0
+
+[[func]]
+name = "CampLoop"
+addr = 0x401D10
+
+[[func]]
+name = "CheckItem"
+addr = 0x401F20
+
+[[func]]
+name = "CheckArms"
+addr = 0x401F60
+
+[[func]]
+name = "UseArmsEnergy"
+addr = 0x401FA0
+
+[[func]]
+name = "ChargeArmsEnergy"
+addr = 0x402020
+
+[[func]]
+name = "FullArmsEnergy"
+addr = 0x402090
+
+[[func]]
+name = "RotationArms"
+addr = 0x4020E0
+
+[[func]]
+name = "RotationArmsRev"
+addr = 0x402190
+
+[[func]]
+name = "ChangeToFirstArms"
+addr = 0x402240
 
 [[func]]
 name = "InitBack"
--- a/src/ArmsItem.cpp
+++ b/src/ArmsItem.cpp
@@ -270,6 +270,10 @@
 
 void PutCampObject()
 {
+	int i;
+	RECT rcArms;
+	RECT rcItem;
+
 	// Get rects
 	RECT rcPer = {72, 48, 80, 56};
 	RECT rcNone = {80, 48, 96, 56};
@@ -284,11 +288,10 @@
 	RECT rcBoxBottom = {0, 16, 244, 24};
 
 	// Draw box
-	int y;
 	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, SURFACE_ID_TEXT_BOX);
-	PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (y + 1)), &rcBoxBottom, SURFACE_ID_TEXT_BOX);
+	for (i = 1; i < 18; ++i)
+		PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (i + 1)), &rcBoxBody, SURFACE_ID_TEXT_BOX);
+	PutBitmap3(&rcView, (WINDOW_WIDTH - 244) / 2, ((WINDOW_HEIGHT - 240) / 2) + (8 * (i + 1)), &rcBoxBottom, SURFACE_ID_TEXT_BOX);
 
 	// Move titles
 	if (gCampTitleY > (WINDOW_HEIGHT - 208) / 2)
@@ -308,12 +311,11 @@
 		PutBitmap3(&rcView, 40 * gSelectedArms + (WINDOW_WIDTH - 224) / 2, (WINDOW_HEIGHT / 2) - 96, &rcCur1[1], SURFACE_ID_TEXT_BOX);
 
 	// Draw arms
-	for (int i = 0; i < ARMS_MAX; i++)
+	for (i = 0; i < ARMS_MAX; i++)
 	{
 		if (gArmsData[i].code == 0)
 			break;
 
-		RECT rcArms;
 		rcArms.left = 16 * (gArmsData[i].code % 16);
 		rcArms.right = rcArms.left + 16;
 		rcArms.top = 16 * (gArmsData[i].code / 16);
@@ -343,12 +345,11 @@
 	else
 		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; i++)
+	for (i = 0; i < ITEM_MAX; i++)
 	{
 		if (gItemData[i].code == 0)
 			break;
 
-		RECT rcItem;
 		rcItem.left = 32 * (gItemData[i].code % 8);
 		rcItem.right = rcItem.left + 32;
 		rcItem.top = 16 * (gItemData[i].code / 8);
@@ -360,10 +361,12 @@
 
 int CampLoop()
 {
+	int arms_num;
+	char old_script_path[PATH_LENGTH];
+
 	RECT rcView = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
 
 	// Load the inventory script
-	char old_script_path[PATH_LENGTH];
 	GetTextScriptPath(old_script_path);
 
 	LoadTextScript2("ArmsItem.tsc");
@@ -373,7 +376,7 @@
 	gSelectedItem = 0;
 
 	// Run script
-	int arms_num = 0;
+	arms_num = 0;
 	for (; gArmsData[arms_num].code != 0;)
 		++arms_num;