summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Noga <Tempus@Spectrum-Song.local>2011-05-17 13:03:04 -0500
committerColin Noga <Tempus@Spectrum-Song.local>2011-05-17 13:03:04 -0500
commit67ecb74a9c0432af36bccdca69a1c461035a3f6d (patch)
tree56eb3367122c3bbc63f9f92b937051eb9b233030 /src
parentdc60abac09195b10032ea97caf3dff5fe709fbab (diff)
downloadkamek-67ecb74a9c0432af36bccdca69a1c461035a3f6d.tar.gz
kamek-67ecb74a9c0432af36bccdca69a1c461035a3f6d.zip
temporary fixes and in-progress changes to the size hack
Diffstat (limited to '')
-rw-r--r--src/growup.s165
-rw-r--r--src/levelspecial.cpp39
-rw-r--r--src/spritetex.S2
3 files changed, 162 insertions, 44 deletions
diff --git a/src/growup.s b/src/growup.s
index 903b766..91576f9 100644
--- a/src/growup.s
+++ b/src/growup.s
@@ -18,13 +18,8 @@
.align 4
-.global ModifyGlobalSizes
-ModifyGlobalSizes:
-
-# lhz r10, 8(r3)
-# cmpwi r10, 60
-# beq dontDoAnything
+LoadFromSettings:
# we can trash r10 for now, it's not supposed to be guaranteed anyway
lwz r10, 4(r3) # get the sprite settings
srwi r10, r10, 20 # get the highest nybble as r10 (maps to Nyb5 in Reggie)
@@ -34,23 +29,65 @@ ModifyGlobalSizes:
lis r11, LookupTable@h
ori r11, r11, LookupTable@l
slwi r10, r10, 2 # size *= 4 (size of float)
- lfsx f5, r11, r10 # get it from the array
+ lfsx f8, r11, r10 # get it from the array
+ blr
+
+
+ModelNoChanges:
+ lwz r4, 0x47C(r3)
+ lfs f0, 0xDC(r4)
+ stfs f0, 0xDC(r3)
+ stfs f0, 0x464(r4)
+ lfs f0, 0xE0(r4)
+ stfs f0, 0xE0(r3)
+ stfs f0, 0x468(r4)
+ lfs f0, 0xE4(r4)
+ stfs f0, 0xE4(r3)
+ stfs f0, 0x46C(r4)
+ blr
+
+
+.global ModifyGlobalSizes
+ModifyGlobalSizes:
+
+ # Go back if SizerOn is 0 (off)
+ lis r10, SizerOn@h
+ ori r10, r10, SizerOn@l
+ lbz r10, 0(r10)
+ cmpwi r10, 0
+ beq ModelNoChanges
+
+ # Load 1
+ lis r10, One@h
+ ori r10, r10, One@l
+ lfs f7, 0(r10)
+
+ # Load Global
+ lis r11, GlobalSpriteSize@h
+ ori r11, r11, GlobalSpriteSize@l
+ lfs f8, 0(r11)
+
+ # If Global == 1.0,
+ fcmpu cr0, f7, f8
+ mflr r9
+ beql cr0, LoadFromSettings
+ mtlr r9
# Modify the actor
lwz r4, 0x47C(r3)
lfs f0, 0xDC(r4)
- fmuls f0, f0, f5
+ fmuls f0, f0, f8
stfs f0, 0xDC(r3)
stfs f0, 0x464(r4)
lfs f0, 0xE0(r4)
- fmuls f0, f0, f5
+ fmuls f0, f0, f8
stfs f0, 0xE0(r3)
stfs f0, 0x468(r4)
lfs f0, 0xE4(r4)
- fmuls f0, f0, f5
+ fmuls f0, f0, f8
stfs f0, 0xE4(r3)
stfs f0, 0x46C(r4)
@@ -87,25 +124,58 @@ ModifyGlobalSizes:
-
-#dontDoAnything:
-# blr
-
+CollisionNoChanges:
+ stw r4, 4(r3)
+ li r0, 0
+ lfs f0, 0(r5)
+ stfs f0, 0x1C(r3)
+ lfs f0, 4(r5)
+ stfs f0, 0x20(r3)
+ lfs f0, 8(r5)
+ stfs f0, 0x24(r3)
+ lfs f0, 0xC(r5)
+ stfs f0, 0x28(r3)
+ lbz r4, 0x10(r5)
+ stb r4, 0x2C(r3)
+ lbz r4, 0x11(r5)
+ stb r4, 0x2D(r3)
+ lwz r4, 0x14(r5)
+ stw r4, 0x30(r3)
+ lwz r4, 0x18(r5)
+ stw r4, 0x34(r3)
+ lhz r4, 0x1C(r5)
+ sth r4, 0x38(r3)
+ lwz r4, 0x20(r5)
+ stw r4, 0x3C(r3)
+ stb r0, 0xA1(r3)
+ blr
.global ModifyCollision
ModifyCollision:
- # we can trash r10 for now, it's not supposed to be guaranteed anyway
- lwz r10, 4(r4) # get the sprite settings
- srwi r10, r10, 20 # get the highest nybble as r10 (maps to Nyb5 in Reggie)
- andi. r10, r10, 0xF
-
- # first off, get the value from the lookup table
- lis r11, LookupTable@h
- ori r11, r11, LookupTable@l
- slwi r10, r10, 2 # size *= 4 (size of float)
- lfsx f8, r11, r10 # get it from the array
+ # Go back if SizerOn is 0 (off)
+ lis r10, SizerOn@h
+ ori r10, r10, SizerOn@l
+ lbz r10, 0(r10)
+ cmpwi r10, 0
+ beq CollisionNoChanges
+
+ # Load 1
+ lis r10, One@h
+ ori r10, r10, One@l
+ lfs f7, 0(r10)
+
+ # Load Global
+ lis r11, GlobalSpriteSize@h
+ ori r11, r11, GlobalSpriteSize@l
+ lfs f8, 0(r11)
+
+ # If Global == 1.0,
+ fcmpu cr0, f7, f8
+ mflr r9
+ beql cr0, LoadFromSettings
+ mtlr r9
#This is the old ActivePhysics_InitWithStruct function.
stw r4, 4(r3)
@@ -153,7 +223,8 @@ ModifyCollision:
ModifyStandOnTopInitA:
# we can trash r10 for now, it's not supposed to be guaranteed anyway
- lwz r10, 4(r4) # get the sprite settings
+ lwz r10, 4(r3)
+ lwz r10, 4(r10) # get the sprite settings
srwi r10, r10, 20 # get the highest nybble as r10 (maps to Nyb5 in Reggie)
andi. r10, r10, 0xF
@@ -183,7 +254,8 @@ ModifyStandOnTopInitA:
ModifyStandOnTopInitB:
# we can trash r10 for now, it's not supposed to be guaranteed anyway
- lwz r10, 4(r4) # get the sprite settings
+ lwz r10, 4(r3)
+ lwz r10, 4(r10) # get the sprite settings
srwi r10, r10, 20 # get the highest nybble as r10 (maps to Nyb5 in Reggie)
andi. r10, r10, 0xF
@@ -238,7 +310,8 @@ ModifyStandOnTopInitD:
# we can trash r10 for now, it's not supposed to be guaranteed anyway
- lwz r10, 4(r4) # get the sprite settings
+ lwz r10, 4(r3)
+ lwz r10, 4(r10) # get the sprite settings
srwi r10, r10, 20 # get the highest nybble as r10 (maps to Nyb5 in Reggie)
andi. r10, r10, 0xF
@@ -283,7 +356,8 @@ ModifyStandOnTopInitD:
ModifyRiderInitA:
# we can trash r10 for now, it's not supposed to be guaranteed anyway
- lwz r10, 4(r4) # get the sprite settings
+ lwz r10, 4(r3)
+ lwz r10, 4(r10) # get the sprite settings
srwi r10, r10, 20 # get the highest nybble as r10 (maps to Nyb5 in Reggie)
andi. r10, r10, 0xF
@@ -316,7 +390,8 @@ ModifyRiderInitA:
ModifyRiderInitB:
# we can trash r10 for now, it's not supposed to be guaranteed anyway
- lwz r10, 4(r4) # get the sprite settings
+ lwz r10, 4(r3)
+ lwz r10, 4(r10) # get the sprite settings
srwi r10, r10, 20 # get the highest nybble as r10 (maps to Nyb5 in Reggie)
andi. r10, r10, 0xF
@@ -350,7 +425,8 @@ ModifyRiderInitB:
ModifyRiderInitC:
# we can trash r10 for now, it's not supposed to be guaranteed anyway
- lwz r10, 4(r4) # get the sprite settings
+ lwz r10, 4(r3)
+ lwz r10, 4(r10) # get the sprite settings
srwi r10, r10, 20 # get the highest nybble as r10 (maps to Nyb5 in Reggie)
andi. r10, r10, 0xF
@@ -377,7 +453,8 @@ ModifyRiderInitC:
ModifyRiderInitD:
# we can trash r10 for now, it's not supposed to be guaranteed anyway
- lwz r10, 4(r4) # get the sprite settings
+ lwz r10, 4(r3)
+ lwz r10, 4(r10) # get the sprite settings
srwi r10, r10, 20 # get the highest nybble as r10 (maps to Nyb5 in Reggie)
andi. r10, r10, 0xF
@@ -404,15 +481,9 @@ ModifyRiderInitD:
.global InheritSettings_A
InheritSettings_A:
- li r4, 0
+ li r0, 0
blr
- lwz r4, 4(r0)
-
- li r10, 0
- stw r10, 8(r4)
-
- blr
.global InheritSettings_B
@@ -500,6 +571,7 @@ PiranhaFirePos:
+
.global PipeGeneratorSpawn
PipeGeneratorSpawn:
@@ -520,6 +592,23 @@ LakituBomb:
.data
+
+One:
+ .float 1.0
+
+.global GlobalSpriteSize
+GlobalSpriteSize:
+ .float 1.0
+
+.global GlobalRiderSize
+GlobalRiderSize:
+ .float 1.0
+
+.global SizerOn
+SizerOn:
+ .byte 0
+
+
LookupTable:
.float 1, 1, 1, 1, 0.25, 0.5, 0.75, 1.25, 1.5, 2, 2.5, 3, 4, 5, 8, 10
diff --git a/src/levelspecial.cpp b/src/levelspecial.cpp
index 245dc87..d92c5ce 100644
--- a/src/levelspecial.cpp
+++ b/src/levelspecial.cpp
@@ -35,6 +35,15 @@ extern float MarioJumpArc;
extern float MiniMarioJumpArc;
extern float MarioSize;
+extern float GlobalSpriteSize;
+extern float GlobalRiderSize;
+extern char SizerOn;
+
+
+float GlobalSizeFloatModifications [] = {1, 0.25, 0.5, 0.75, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5, 6, 7, 8, 10 };
+float GlobalRiderFloatModifications [] = {1, 0.6, 0.7, 0.9, 1, 1, 1, 1.1, 1.25, 1.5, 2, 2.5, 3, 3.5, 4, 5};
+
+
extern "C" void GetSpecificPlayerActor(int number);
void LevelSpecial_Update(LevelSpecial *self);
@@ -55,6 +64,9 @@ bool ResetAfterLevel(void) {
MarioJumpArc = 2.5;
MiniMarioJumpArc = 2.5;
MarioSize = 1.0;
+ GlobalSpriteSize = 1.0;
+ GlobalRiderSize = 1.0;
+ SizerOn = 0;
return true;
}
@@ -133,6 +145,18 @@ void LevelSpecial_Update(LevelSpecial *self) {
else //Half-Pint
MarioSize = 0.25;
break;
+
+
+ case 5: // Global Enemy Size
+ SizerOn = 1;
+
+ GlobalSpriteSize = GlobalSizeFloatModifications[self->effect];
+ GlobalRiderSize = GlobalRiderFloatModifications[self->effect];
+
+
+ case 6: // Individual Enemy Size
+ SizerOn = 1;
+
default:
break;
@@ -165,6 +189,15 @@ void LevelSpecial_Update(LevelSpecial *self) {
MarioSize = 1.0;
break;
+ case 5: // Global Enemy Size
+ SizerOn = 0;
+
+ GlobalSpriteSize = 1.0;
+ GlobalRiderSize = 1.0;
+
+ case 6: // Individual Enemy Size
+ SizerOn = 0;
+
default:
break;
}
@@ -178,8 +211,4 @@ void LevelSpecial_Update(LevelSpecial *self) {
self->lastEvState = newEvState;
-}
-
-
-
-
+}
diff --git a/src/spritetex.S b/src/spritetex.S
index 0f89cd5..bd13428 100644
--- a/src/spritetex.S
+++ b/src/spritetex.S
@@ -171,7 +171,7 @@ TEX_SpringBlock:
.global TEX_Coaster
TEX_Coaster:
- lwz r5, 4(r31)
+ lwz r5, 4(r3)
srwi r5, r5, 24
andi. r5, r5, 0xF
b GetTexFilenameForR5