summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Bouchard <alexbouchard04@gmail.com>2020-03-29 13:59:31 -0400
committerAlex Bouchard <alexbouchard04@gmail.com>2020-03-29 13:59:31 -0400
commitadf8468195e6f101cef6c09d9dfc17f43b4b2fb4 (patch)
tree433acd8df496bdc8ea28f5f9c0880c41f4401488
parent4661174778282da4ef152c9750eb8b2cb1e143c2 (diff)
changed the order in wich items are placed, should prevent crashingv0.12b
-rw-r--r--include/defines.h2
-rw-r--r--include/itemChecks.h1
-rw-r--r--source/chestRando.cpp65
-rw-r--r--source/itemChecks.cpp78
4 files changed, 97 insertions, 49 deletions
diff --git a/include/defines.h b/include/defines.h
index 40ce7fb..23c008b 100644
--- a/include/defines.h
+++ b/include/defines.h
@@ -32,7 +32,7 @@ typedef signed char s8;
// Mnemonics
#define AUTHOR "AECX"
-#define VERSION "v0.11.2b"
+#define VERSION "v0.11.3b"
#define RAND_SEED mod::tools::randomSeed
#define gameInfo tp::d_com_inf_game::dComIfG_gameInfo
#define getPlayerPos tp::d_map_path_dmap::getMapPlayerPos
diff --git a/include/itemChecks.h b/include/itemChecks.h
index 64ab01b..fa52a09 100644
--- a/include/itemChecks.h
+++ b/include/itemChecks.h
@@ -6,4 +6,5 @@
namespace mod::item
{
extern ItemCheck checks[487];
+ extern u16 checkPriorityOrder[18];
} \ No newline at end of file
diff --git a/source/chestRando.cpp b/source/chestRando.cpp
index 725f293..5ac4c66 100644
--- a/source/chestRando.cpp
+++ b/source/chestRando.cpp
@@ -54,6 +54,49 @@ namespace mod
placeCheck(&item::checks[i], &item::checks[i]);
}
}
+
+ //do needed items in order
+ for(u16 i = 0; i < sizeof(item::checkPriorityOrder)/sizeof(u16); i++)
+ {
+ destCheck = &item::checks[item::checkPriorityOrder[i]];
+ if(!destCheck->source)
+ {
+ if(destCheck->itemID == items::Item::Ordon_Sword)
+ {
+ sourceCheck = findSource(destCheck->destLayer, 0x1, destCheck);//to prevent woodensword from being overwritten before losing it
+ }
+ else if (destCheck->itemID == items::Item::Ordon_Shield || destCheck->itemID == items::Item::Wooden_Shield || destCheck->itemID == items::Item::Hylian_Shield)
+ {
+ sourceCheck = findSource(destCheck->destLayer, 0x2, destCheck);//to prevent softlocking the game when you try to get ordon shield check
+ }
+ else if (destCheck->itemID == items::Item::Zora_Armor || destCheck->itemID == items::Item::Magic_Armor)
+ {
+ sourceCheck = findSource(destCheck->destLayer, 0x2, destCheck);//to prevent softlocking the game when you try to get ordon shield check
+ }
+ else if (isProgressiveEnabled == 0 && destCheck->itemID == items::Item::Clawshots)
+ {
+ sourceCheck = findSource(destCheck->destLayer, 0x7, destCheck);//to prevent Clawshots from being overwritten by Clawshot
+ }
+ else
+ {
+ sourceCheck = findSource(destCheck->destLayer, 0x0, destCheck);
+ }
+ placeCheck(sourceCheck, destCheck);
+ //layerCheckCount++;
+ }
+ }
+
+ //do dungeon items
+ for(u16 i = 0; i <= totalChecks; i++)
+ {
+ destCheck = &item::checks[item::checkPriorityOrder[i]];
+ if(!destCheck->source && destCheck->type == item::ItemType::Dungeon)
+ {
+ sourceCheck = findSource(destCheck->destLayer, 0x0, destCheck);
+ placeCheck(sourceCheck, destCheck);
+ //layerCheckCount++;
+ }
+ }
// Place layer checks
for(u16 i = 0; i < totalChecks; i++)
@@ -116,7 +159,8 @@ namespace mod
}
// Place items that unlock other locations before caring about remaining items
- for(u16 i = 0; i < totalChecks; i++)
+ //useless
+ /*for(u16 i = 0; i < totalChecks; i++)
{
destCheck = &item::checks[i];
@@ -137,7 +181,7 @@ namespace mod
placeCheck(sourceCheck, destCheck);
}
}
- }
+ }*/
// Place remaining
for(u16 i = 0; i < totalChecks; i++)
@@ -365,23 +409,6 @@ namespace mod
return item;
}*/
- if(item == items::Item::Key_Shard_1)
- {
- return 0xFF;
- }
- else if(item == items::Item::Key_Shard_2)
- {
- return 0xFF;
- }
- else if(item == items::Item::Key_Shard_3)
- {
- return 0xFF;
- }
- else if(item == items::Item::Big_Key_Goron_Mines)
- {
- return 0xFF;
- }
-
for(u16 i = 0; i < totalChecks; i++)
{
sourceCheck = &item::checks[i];
diff --git a/source/itemChecks.cpp b/source/itemChecks.cpp
index 6965852..decf115 100644
--- a/source/itemChecks.cpp
+++ b/source/itemChecks.cpp
@@ -23,7 +23,7 @@ namespace mod::item
/* 13 */{0x21, 3, stage::allStages[6], 3, 0x1, 0xFF, 0b110000000000000000100, -4000.0000000, 2955.5900880, 9075.0000000, nullptr, nullptr},
/* 14 */{0x21, 3, stage::allStages[6], 5, 0x1, 0xFF, 0b110100000000000100100, -14275.0000000, 3402.7832030, 6150.0000000, nullptr, nullptr},
/* 15 */{0x24, 2, stage::allStages[6], 0, 0x1, 0x1, 0b100100000000000000100, 0.0000000, 3150.0000000, 7125.0000000, nullptr, nullptr},
-/* 16 */{0x26, 2, stage::allStages[6], 1, 0x2, 0x1, 0b100100000000001000100, 9225.0009770, 3471.9599610, 8465.1347660, nullptr, nullptr},
+/* 16 */{0x26, 2, stage::allStages[6], 1, 0x1, 0x1, 0b100100000000000000100, 9225.0009770, 3471.9599610, 8465.1347660, nullptr, nullptr},
/* 17 */{0x03, 7, stage::allStages[6], 1, 0x1, 0xFF, 0b000000000000000000100, 10261.0000000, 3175.0000000, 8295.0000000, nullptr, nullptr},
/* 18 */{0x20, 8, stage::allStages[6], 10, 0x2, 0xFF, 0b000100000010000000000, 1174.2510990, 5002.3901370, -9219.0937500, nullptr, nullptr},
/* 19 */{0x04, 7, stage::allStages[6], 11, 0x2, 0xFF, 0b000100000000000100000, 11183.0000000, 3806.5500490, -6305.0000000, nullptr, nullptr},
@@ -168,7 +168,7 @@ namespace mod::item
/* 158 */{0x03, 7, stage::allStages[24], 13, 0x9, 0xFF, 0b000000000000100000000, -10812.5000000, -1825.0000000, -5712.5000000, nullptr, nullptr},
/* 159 */{0x21, 3, stage::allStages[24], 13, 0x9, 0xFF, 0b000000000000100000000, -5475.0000000, -1325.0000000, -4875.0000000, nullptr, nullptr},
/* 160 */{0x03, 7, stage::allStages[24], 13, 0x9, 0xFF, 0b000000000000100000000, -6225.0000000, -1125.0000000, -7275.0000000, nullptr, nullptr},
-/* 161 */{0x26, 2, stage::allStages[24], 9, 0x9, 0x8, 0b000000000000100000000, -3675.0000000, 500.0000000, -7250.0000000, nullptr, nullptr},
+/* 161 */{0x26, 2, stage::allStages[24], 9, 0x9, 0x9, 0b000000000000100000000, -3675.0000000, 500.0000000, -7250.0000000, nullptr, nullptr},
/* 162 */{0x21, 3, stage::allStages[56], 11, 0x9, 0xFF, 0b000000000000100000000, -88260.0000000, 2950.0000000, -8150.0000000, nullptr, nullptr},
/* 163 */{0x0A, 5, stage::allStages[36], 1, 0x9, 0xFF, 0b100000000000100000010, 464.9176030, -262.3106380, -709.6952510, nullptr, nullptr},
/* 164 */{0x0A, 5, stage::allStages[36], 1, 0x9, 0xFF, 0b100000000000100000010, -1153.7760010, -255.8396450, -980.6660160, nullptr, nullptr},
@@ -194,7 +194,7 @@ namespace mod::item
/* 184 */{0x20, 8, stage::allStages[27], 5, 0x11, 0xFF, 0b100000000110000000000, 4350.0000000, 953.0000000, -4900.0000000, nullptr, nullptr},
/* 185 */{0x04, 7, stage::allStages[27], 9, 0x11, 0xFF, 0b000000000100000000000, -5347.3071290, -50.0000000, -6500.8867190, nullptr, nullptr},
/* 186 */{0x0A, 5, stage::allStages[27], 9, 0x11, 0xFF, 0b000000100100000000000, -1818.3217770, 0.0000000, -7562.9838870, nullptr, nullptr},
-/* 187 */{0xF6, 2, stage::allStages[27], 11, 0x11, 0x10, 0b100000100100000000000, -4350.0000000, 1050.0000000, -8560.5742190, nullptr, nullptr},
+/* 187 */{0xF6, 2, stage::allStages[27], 11, 0x11, 0x11, 0b100000100100000000000, -4350.0000000, 1050.0000000, -8560.5742190, nullptr, nullptr},
/* 188 */{0x06, 7, stage::allStages[51], 2, 0x11, 0xFF, 0b110000000100000000010, -6233.2583010, -1800.0000000, -9865.0205080, nullptr, nullptr},
/* 189 */{0x06, 7, stage::allStages[38], 3, 0x11, 0xFF, 0b100000000100000000010, -810.7105710, -300.0000000, -2101.0502930, nullptr, nullptr},
/* 190 */{0x21, 3, stage::allStages[30], 0, 0x11, 0xFF, 0b000000000100000000000, 0.0000000, 0.0000000, -7900.0000000, nullptr, nullptr},
@@ -304,7 +304,7 @@ namespace mod::item
/* 294 */{0x65, 9, stage::allStages[65], 1, 0x0, 0xFF, 0b000000000000000000000, -55.0000000, 0.0000000, -156.0000000, nullptr, nullptr},
/* 295 */{0x4B, 12, stage::allStages[65], 1, 0x0, 0x0, 0b000000000000000000000, -55.0000000, 0.0000000, -156.0000000, nullptr, nullptr},
/* 296 */{0x48, 0, stage::allStages[45], 3, 0x0, 0x0, 0b100010000000000001000, -13659.0000000, 0.0000000, -14367.0000000, nullptr, nullptr},
-/* 297 */{0x2C, 12, stage::allStages[68], 3, 0xFF, 0xFF, 0b001000000000000000000, -500.0000000, 320.0000000, -695.0000000, nullptr, nullptr},
+/* 297 */{0x2C, 12, stage::allStages[68], 3, 0xFF, 0x2, 0b001000000000000000000, -500.0000000, 320.0000000, -695.0000000, nullptr, nullptr},
/* 298 */{0x2B, 12, stage::allStages[68], 3, 0x2, 0xFF, 0b001000000000000000000, -500.0000000, 320.0000000, -695.0000000, nullptr, nullptr},
/* 299 */{0x55, 1, stage::allStages[74], 7, 0x7, 0x7, 0b111111100010000000000, -4400.0000000, 0.0000000, 2500.0000000, nullptr, nullptr},
/* 300 */{0x56, 1, stage::allStages[74], 7, 0x14, 0x14, 0b111111100001000000000, -4400.0000000, 0.0000000, 2500.0000000, nullptr, nullptr},
@@ -326,32 +326,31 @@ namespace mod::item
/* 316 */{0x4F, 1, stage::allStages[52], 0, 0x5, 0xFF, 0b111111110000000000000, -77679.9375000, -18765.0000000, 40764.0000000, nullptr, nullptr},
/* 317 */{0x3D, 0, stage::allStages[48], 0, 0x9, 0x9, 0b111111010010101000000, 21070.0000000, 500.0000000, 181.0000000, nullptr, nullptr},
/* 318 */{0x3E, 12, stage::allStages[68], 3, 0x4, 0x11, 0b111111000000000000000, -500.0000000, 320.0000000, -695.0000000, nullptr, nullptr},
-///* 319 */{0xEB, 0, stage::allStages[68], 0, 0x12, 0xFF, 0b111111010110111000000, 2537.0000000, 104.0000000, -1304.0000000, nullptr, nullptr},
-/* 320 */{0x51, 0, stage::allStages[50], 0, 0x5, 0xFF, 0b111111010000000000000, 44.0000000, -3854.0000000, -2626.0000000, nullptr, nullptr},
-/* 321 */{0x70, 0, stage::allStages[68], 1, 0xFF, 0x4, 0b111111000000000000000, 800.0000000, 0.0000000, -300.0000000, nullptr, nullptr},
-/* 322 */{0x51, 0, stage::allStages[52], 0, 0x5, 0xFF, 0b111111100000000000000, -77680.0000000, -18765.0000000, 40764.0000000, nullptr, nullptr},
-/* 323 */{0x90, 4, stage::allStages[52], 0, 0x7, 0x7, 0b111111010010001000000, -116365.0000000, -13860.0000000, 58454.0000000, nullptr, nullptr},
-/* 324 */{0x91, 4, stage::allStages[51], 0, 0x9, 0x9, 0b000000000000000000000, 31662.0000000, -13330.0000000, -11934.0000000, nullptr, nullptr},
-/* 325 */{0x80, 4, stage::allStages[46], 0, 0x12, 0x12, 0b000000000000000000000, -344.0000000, 0.0000000, 234.0000000, nullptr, nullptr},
-/* 326 */{0x81, 4, stage::allStages[53], 5, 0x12, 0x12, 0b000000000000000000000, 3505.0000000, -1150.0000000, 3388.0000000, nullptr, nullptr},
-/* 327 */{0x82, 4, stage::allStages[57], 16, 0x12, 0x12, 0b000000000000000000000, -51480.0000000, -6425.0000000, 34034.0000000, nullptr, nullptr},
-/* 328 */{0x83, 4, stage::allStages[63], 0, 0x12, 0x12, 0b000000000000000000000, 2360.0000000, 104.0000000, -1150.0000000, nullptr, nullptr},
-/* 329 */{0x84, 4, stage::allStages[68], 0, 0x12, 0x12, 0b000000000000000000000, -386.0000000, 0.0000000, 393.0000000, nullptr, nullptr},
+/* 319 */{0x51, 0, stage::allStages[50], 0, 0x5, 0xFF, 0b111111010000000000000, 44.0000000, -3854.0000000, -2626.0000000, nullptr, nullptr},
+/* 320 */{0x70, 0, stage::allStages[68], 1, 0xFF, 0x4, 0b111111000000000000000, 800.0000000, 0.0000000, -300.0000000, nullptr, nullptr},
+/* 321 */{0x51, 0, stage::allStages[52], 0, 0x5, 0xFF, 0b111111100000000000000, -77680.0000000, -18765.0000000, 40764.0000000, nullptr, nullptr},
+/* 322 */{0x90, 4, stage::allStages[52], 0, 0x7, 0x7, 0b111111010010001000000, -116365.0000000, -13860.0000000, 58454.0000000, nullptr, nullptr},
+/* 323 */{0x91, 4, stage::allStages[51], 0, 0x9, 0x9, 0b000000000000000000000, 31662.0000000, -13330.0000000, -11934.0000000, nullptr, nullptr},
+/* 324 */{0x80, 4, stage::allStages[46], 0, 0x12, 0x12, 0b000000000000000000000, -344.0000000, 0.0000000, 234.0000000, nullptr, nullptr},
+/* 325 */{0x81, 4, stage::allStages[53], 5, 0x12, 0x12, 0b000000000000000000000, 3505.0000000, -1150.0000000, 3388.0000000, nullptr, nullptr},
+/* 326 */{0x82, 4, stage::allStages[57], 16, 0x12, 0x12, 0b000000000000000000000, -51480.0000000, -6425.0000000, 34034.0000000, nullptr, nullptr},
+/* 327 */{0x83, 4, stage::allStages[63], 0, 0x12, 0x12, 0b000000000000000000000, 2360.0000000, 104.0000000, -1150.0000000, nullptr, nullptr},
+/* 328 */{0x84, 4, stage::allStages[68], 0, 0x12, 0x12, 0b000000000000000000000, -386.0000000, 0.0000000, 393.0000000, nullptr, nullptr},
-/* 330 */{0x9d, 9, stage::allStages[45], 4, 0x1, 0xFF, 0b000000000000000000000, -13659.433594, -0.454284, -14367.083008, nullptr, nullptr},
-/* 331 */{0x75, 9, stage::allStages[73], 5, 0x7, 0xFF, 0b000000000000000000000, 4250.363281, 134.492020, 1813.639648, nullptr, nullptr},
-//TODO/* 332 not randomized*///{0x60, 9, stage::allStages[62], 0, 0x5, 0xFF, 0b000000000000000000000, -13659.0000000, 0.0000000, -14367.0000000, nullptr, nullptr},
-/* 333 */{0x2B, 12, stage::allStages[47], 3, 0x3, 0xFF, 0b001000000000000000000, -6545.0000000, -125.0000000, -2275.0000000, nullptr, nullptr},
-/* 334 */{0x21, 3, stage::allStages[46], 0, 0x4, 0xFF, 0b000001000000000000000, -900.000000, 0.780221, 6600.000000, nullptr, nullptr},
-/* 335 */{0x21, 3, stage::allStages[53], 2, 0x5, 0xFF, 0b000000000000000000000, -4142.703125, 0.000000, -569.375000, nullptr, nullptr},
-/* 336 */{0x21, 3, stage::allStages[62], 0, 0x7, 0xFF, 0b101000000010000000000, -2678.128906, -167.094162, 2246.794186, nullptr, nullptr},
-/* 337 */{0x21, 3, stage::allStages[56], 0, 0x7, 0xFF, 0b000000000000000000000, -25148.583984, -200.000000, 9814.881836, nullptr, nullptr},
-/* 338 */{0x21, 3, stage::allStages[61], 0, 0x7, 0xFF, 0b000000000000000000000, 3618.216797, 232.476608, 541.905518, nullptr, nullptr},
-/* 339 */{0x21, 3, stage::allStages[55], 1, 0x7, 0xFF, 0b000000000000000000000, 4708.924805, 260.000000, -3120.967529, nullptr, nullptr},
-/* 340 */{0x23, 2, stage::allStages[27], 1, 0x10, 0x10, 0b000000000000000000000, 293.920288, 0.000000, -337.167480, nullptr, nullptr},
-/* 341 */{0x21, 3, stage::allStages[51], 1, 0x11, 0xFF, 0b000000000000000000000, -71795.539062, -54450.000000, 56396.738281, nullptr, nullptr},
-/* 342 */{0x21, 3, stage::allStages[63], 0, 0x12, 0xFF, 0b000000000000000000010, 2200.000000, 104.574730, -1200.000000, nullptr, nullptr},
-/* 343 */{0x20, 8, stage::allStages[20], 13, 0xFF, 0xFF, 0b000000000000000000000, -7625.000000, 52.000000, -5525.000000, nullptr, nullptr},
+/* 329 */{0x9d, 9, stage::allStages[45], 4, 0x1, 0xFF, 0b000000000000000000000, -13659.433594, -0.454284, -14367.083008, nullptr, nullptr},
+/* 330 */{0x75, 9, stage::allStages[73], 5, 0x7, 0xFF, 0b000000000000000000000, 4250.363281, 134.492020, 1813.639648, nullptr, nullptr},
+//TODO/* 331 not randomized*///{0x60, 9, stage::allStages[62], 0, 0x5, 0xFF, 0b000000000000000000000, -13659.0000000, 0.0000000, -14367.0000000, nullptr, nullptr},
+/* 332 */{0x2B, 12, stage::allStages[47], 3, 0x3, 0xFF, 0b001000000000000000000, -6545.0000000, -125.0000000, -2275.0000000, nullptr, nullptr},
+/* 333 */{0x21, 3, stage::allStages[46], 0, 0x4, 0xFF, 0b000001000000000000000, -900.000000, 0.780221, 6600.000000, nullptr, nullptr},
+/* 334 */{0x21, 3, stage::allStages[53], 2, 0x5, 0xFF, 0b000000000000000000000, -4142.703125, 0.000000, -569.375000, nullptr, nullptr},
+/* 335 */{0x21, 3, stage::allStages[62], 0, 0x7, 0xFF, 0b101000000010000000000, -2678.128906, -167.094162, 2246.794186, nullptr, nullptr},
+/* 336 */{0x21, 3, stage::allStages[56], 0, 0x7, 0xFF, 0b000000000000000000000, -25148.583984, -200.000000, 9814.881836, nullptr, nullptr},
+/* 337 */{0x21, 3, stage::allStages[61], 0, 0x7, 0xFF, 0b000000000000000000000, 3618.216797, 232.476608, 541.905518, nullptr, nullptr},
+/* 338 */{0x21, 3, stage::allStages[55], 1, 0x7, 0xFF, 0b000000000000000000000, 4708.924805, 260.000000, -3120.967529, nullptr, nullptr},
+/* 339 */{0x23, 2, stage::allStages[27], 1, 0x10, 0x10, 0b000000000000000000000, 293.920288, 0.000000, -337.167480, nullptr, nullptr},
+/* 340 */{0x21, 3, stage::allStages[51], 1, 0x11, 0xFF, 0b000000000000000000000, -71795.539062, -54450.000000, 56396.738281, nullptr, nullptr},
+/* 341 */{0x21, 3, stage::allStages[63], 0, 0x12, 0xFF, 0b000000000000000000010, 2200.000000, 104.574730, -1200.000000, nullptr, nullptr},
+/* 342 */{0x20, 8, stage::allStages[20], 13, 0xFF, 0xFF, 0b000000000000000000000, -7625.000000, 52.000000, -5525.000000, nullptr, nullptr},
//Ooccoo
{0x25, 2, stage::allStages[6], 1, 0x1, 0x1, 0b000000000000000000100, 3775.943604, 3167.790039, 5428.488281, nullptr, nullptr},
@@ -550,4 +549,25 @@ namespace mod::item
//Yeto soup
//{0x7f, 12, stage::allStages[27], 2, 0x10, 0xFF, 0b000000000000000000000, 3154.522705, 144.729996, 340.811127, nullptr, nullptr},
};
+
+ u16 checkPriorityOrder[18] = {
+ 293, //fishing rod
+ 0, //wooden sword
+ 295, //slingshot
+ 296, //lantern
+ 292, //ordon sword
+ 298, //boomerang
+ 21, //iron boots
+ 291, //ordon shield
+ 297, //hylian shield
+ 33, //bow
+ 320, //bomb bag
+ 314, //zora armor
+ 58, //clawshot
+ 155, //spinner
+ 317, //coral earring
+ 290, //ball and chain
+ 202, //doninion rod
+ 224 //double clawshot
+ };
} \ No newline at end of file