Add CWorldLayerState

Former-commit-id: d550cdeb64
This commit is contained in:
Henrique Gemignani Passos Lima 2022-11-04 18:15:45 +02:00
parent 8b1b9eb313
commit 88e3fedf85
9 changed files with 179 additions and 35 deletions

View File

@ -3936,7 +3936,7 @@ LoadScriptObjects__9CGameAreaFR13CStateManager:
/* 80060F94 0005DEF4 83 C3 00 00 */ lwz r30, 0(r3) /* 80060F94 0005DEF4 83 C3 00 00 */ lwz r30, 0(r3)
/* 80060F98 0005DEF8 90 01 00 2C */ stw r0, 0x2c(r1) /* 80060F98 0005DEF8 90 01 00 2C */ stw r0, 0x2c(r1)
/* 80060F9C 0005DEFC 7F C3 F3 78 */ mr r3, r30 /* 80060F9C 0005DEFC 7F C3 F3 78 */ mr r3, r30
/* 80060FA0 0005DF00 48 1D 30 15 */ bl GetAreaLayerCount__16CWorldLayerStateFi /* 80060FA0 0005DF00 48 1D 30 15 */ bl GetAreaLayerCount__16CWorldLayerStateFRC7TAreaId
/* 80060FA4 0005DF04 7C 7F 1B 78 */ mr r31, r3 /* 80060FA4 0005DF04 7C 7F 1B 78 */ mr r31, r3
/* 80060FA8 0005DF08 3B A0 00 00 */ li r29, 0 /* 80060FA8 0005DF08 3B A0 00 00 */ li r29, 0
/* 80060FAC 0005DF0C 48 00 00 90 */ b lbl_8006103C /* 80060FAC 0005DF0C 48 00 00 90 */ b lbl_8006103C
@ -3948,7 +3948,7 @@ lbl_80060FB0:
/* 80060FC0 0005DF20 80 1B 00 04 */ lwz r0, 4(r27) /* 80060FC0 0005DF20 80 1B 00 04 */ lwz r0, 4(r27)
/* 80060FC4 0005DF24 93 A1 00 30 */ stw r29, 0x30(r1) /* 80060FC4 0005DF24 93 A1 00 30 */ stw r29, 0x30(r1)
/* 80060FC8 0005DF28 90 01 00 28 */ stw r0, 0x28(r1) /* 80060FC8 0005DF28 90 01 00 28 */ stw r0, 0x28(r1)
/* 80060FCC 0005DF2C 48 1D 32 A5 */ bl IsLayerActive__16CWorldLayerStateFii /* 80060FCC 0005DF2C 48 1D 32 A5 */ bl IsLayerActive__16CWorldLayerStateFRC7TAreaIdRCi
/* 80060FD0 0005DF30 54 60 06 3F */ clrlwi. r0, r3, 0x18 /* 80060FD0 0005DF30 54 60 06 3F */ clrlwi. r0, r3, 0x18
/* 80060FD4 0005DF34 41 82 00 64 */ beq lbl_80061038 /* 80060FD4 0005DF34 41 82 00 64 */ beq lbl_80061038
/* 80060FD8 0005DF38 7F A0 EB 78 */ mr r0, r29 /* 80060FD8 0005DF38 7F A0 EB 78 */ mr r0, r29
@ -6085,7 +6085,7 @@ lbl_80062DD0:
/* 80062DE0 0005FD40 80 1A 00 04 */ lwz r0, 4(r26) /* 80062DE0 0005FD40 80 1A 00 04 */ lwz r0, 4(r26)
/* 80062DE4 0005FD44 93 A1 00 08 */ stw r29, 8(r1) /* 80062DE4 0005FD44 93 A1 00 08 */ stw r29, 8(r1)
/* 80062DE8 0005FD48 90 01 00 10 */ stw r0, 0x10(r1) /* 80062DE8 0005FD48 90 01 00 10 */ stw r0, 0x10(r1)
/* 80062DEC 0005FD4C 48 1D 14 85 */ bl IsLayerActive__16CWorldLayerStateFii /* 80062DEC 0005FD4C 48 1D 14 85 */ bl IsLayerActive__16CWorldLayerStateFRC7TAreaIdRCi
/* 80062DF0 0005FD50 54 60 06 3F */ clrlwi. r0, r3, 0x18 /* 80062DF0 0005FD50 54 60 06 3F */ clrlwi. r0, r3, 0x18
/* 80062DF4 0005FD54 41 82 00 D8 */ beq lbl_80062ECC /* 80062DF4 0005FD54 41 82 00 D8 */ beq lbl_80062ECC
/* 80062DF8 0005FD58 80 1A 00 C0 */ lwz r0, 0xc0(r26) /* 80062DF8 0005FD58 80 1A 00 C0 */ lwz r0, 0xc0(r26)

View File

@ -4185,7 +4185,7 @@ lbl_8005942C:
/* 80059448 000563A8 38 A1 00 24 */ addi r5, r1, 0x24 /* 80059448 000563A8 38 A1 00 24 */ addi r5, r1, 0x24
/* 8005944C 000563AC 38 C1 00 20 */ addi r6, r1, 0x20 /* 8005944C 000563AC 38 C1 00 20 */ addi r6, r1, 0x20
/* 80059450 000563B0 80 63 00 00 */ lwz r3, 0(r3) /* 80059450 000563B0 80 63 00 00 */ lwz r3, 0(r3)
/* 80059454 000563B4 48 1D AB 75 */ bl "InitializeWorldLayers__16CWorldLayerStateFQ24rstl6vector<Q2CWorldLayers4Area>" /* 80059454 000563B4 48 1D AB 75 */ bl "InitializeWorldLayers__16CWorldLayerStateFRCQ24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>"
/* 80059458 000563B8 38 61 00 20 */ addi r3, r1, 0x20 /* 80059458 000563B8 38 61 00 20 */ addi r3, r1, 0x20
/* 8005945C 000563BC 48 00 0A 09 */ bl sub_80059e64 /* 8005945C 000563BC 48 00 0A 09 */ bl sub_80059e64
/* 80059460 000563C0 38 61 00 24 */ addi r3, r1, 0x24 /* 80059460 000563C0 38 61 00 24 */ addi r3, r1, 0x24
@ -4263,7 +4263,7 @@ sub_80059520:
/* 80059550 000564B0 7C 7C 1B 78 */ mr r28, r3 /* 80059550 000564B0 7C 7C 1B 78 */ mr r28, r3
/* 80059554 000564B4 7F 23 CB 78 */ mr r3, r25 /* 80059554 000564B4 7F 23 CB 78 */ mr r3, r25
/* 80059558 000564B8 7F 84 E3 78 */ mr r4, r28 /* 80059558 000564B8 7F 84 E3 78 */ mr r4, r28
/* 8005955C 000564BC 48 00 05 59 */ bl sub_80059ab4 /* 8005955C 000564BC 48 00 05 59 */ bl "reserve__Q24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>Fi"
/* 80059560 000564C0 3B 60 00 00 */ li r27, 0 /* 80059560 000564C0 3B 60 00 00 */ li r27, 0
/* 80059564 000564C4 48 00 00 78 */ b lbl_800595DC /* 80059564 000564C4 48 00 00 78 */ b lbl_800595DC
lbl_80059568: lbl_80059568:
@ -4284,7 +4284,7 @@ lbl_80059568:
/* 800595A0 00056500 41 82 00 08 */ beq lbl_800595A8 /* 800595A0 00056500 41 82 00 08 */ beq lbl_800595A8
/* 800595A4 00056504 54 A4 08 3C */ slwi r4, r5, 1 /* 800595A4 00056504 54 A4 08 3C */ slwi r4, r5, 1
lbl_800595A8: lbl_800595A8:
/* 800595A8 00056508 48 00 05 0D */ bl sub_80059ab4 /* 800595A8 00056508 48 00 05 0D */ bl "reserve__Q24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>Fi"
lbl_800595AC: lbl_800595AC:
/* 800595AC 0005650C 80 19 00 04 */ lwz r0, 4(r25) /* 800595AC 0005650C 80 19 00 04 */ lwz r0, 4(r25)
/* 800595B0 00056510 80 79 00 0C */ lwz r3, 0xc(r25) /* 800595B0 00056510 80 79 00 0C */ lwz r3, 0xc(r25)
@ -4664,8 +4664,8 @@ lbl_80059AA0:
/* 80059AAC 00056A0C 38 21 00 30 */ addi r1, r1, 0x30 /* 80059AAC 00056A0C 38 21 00 30 */ addi r1, r1, 0x30
/* 80059AB0 00056A10 4E 80 00 20 */ blr /* 80059AB0 00056A10 4E 80 00 20 */ blr
.global sub_80059ab4 .global "reserve__Q24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>Fi"
sub_80059ab4: "reserve__Q24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>Fi":
/* 80059AB4 00056A14 94 21 FF D0 */ stwu r1, -0x30(r1) /* 80059AB4 00056A14 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 80059AB8 00056A18 7C 08 02 A6 */ mflr r0 /* 80059AB8 00056A18 7C 08 02 A6 */ mflr r0
/* 80059ABC 00056A1C 90 01 00 34 */ stw r0, 0x34(r1) /* 80059ABC 00056A1C 90 01 00 34 */ stw r0, 0x34(r1)

View File

@ -968,7 +968,7 @@ lbl_801D4468:
/* 801D44B8 001D1418 90 07 00 04 */ stw r0, 4(r7) /* 801D44B8 001D1418 90 07 00 04 */ stw r0, 4(r7)
/* 801D44BC 001D141C 80 61 00 10 */ lwz r3, 0x10(r1) /* 801D44BC 001D141C 80 61 00 10 */ lwz r3, 0x10(r1)
/* 801D44C0 001D1420 80 63 00 00 */ lwz r3, 0(r3) /* 801D44C0 001D1420 80 63 00 00 */ lwz r3, 0(r3)
/* 801D44C4 001D1424 48 05 FB 05 */ bl "InitializeWorldLayers__16CWorldLayerStateFQ24rstl6vector<Q2CWorldLayers4Area>" /* 801D44C4 001D1424 48 05 FB 05 */ bl "InitializeWorldLayers__16CWorldLayerStateFRCQ24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>"
/* 801D44C8 001D1428 38 61 00 08 */ addi r3, r1, 8 /* 801D44C8 001D1428 38 61 00 08 */ addi r3, r1, 8
/* 801D44CC 001D142C 4B E8 59 99 */ bl sub_80059e64 /* 801D44CC 001D142C 4B E8 59 99 */ bl sub_80059e64
/* 801D44D0 001D1430 38 61 00 0C */ addi r3, r1, 0xc /* 801D44D0 001D1430 38 61 00 0C */ addi r3, r1, 0xc

View File

@ -26,18 +26,16 @@ lbl_805A8200:
nullsub_5: nullsub_5:
/* 80233FB0 00230F10 4E 80 00 20 */ blr /* 80233FB0 00230F10 4E 80 00 20 */ blr
.global GetAreaLayerCount__16CWorldLayerStateFi .global GetAreaLayerCount__16CWorldLayerStateFRC7TAreaId
GetAreaLayerCount__16CWorldLayerStateFi: GetAreaLayerCount__16CWorldLayerStateFRC7TAreaId:
/* 80233FB4 00230F14 80 04 00 00 */ lwz r0, 0(r4) /* 80233FB4 00230F14 80 04 00 00 */ lwz r0, 0(r4)
/* 80233FB8 00230F18 80 63 00 0C */ lwz r3, 0xc(r3) /* 80233FB8 00230F18 80 63 00 0C */ lwz r3, 0xc(r3)
/* 80233FBC 00230F1C 54 00 20 36 */ slwi r0, r0, 4 /* 80233FBC 00230F1C 54 00 20 36 */ slwi r0, r0, 4
/* 80233FC0 00230F20 7C 63 00 2E */ lwzx r3, r3, r0 /* 80233FC0 00230F20 7C 63 00 2E */ lwzx r3, r3, r0
.global lbl_80233FC4
lbl_80233FC4:
/* 80233FC4 00230F24 4E 80 00 20 */ blr /* 80233FC4 00230F24 4E 80 00 20 */ blr
.global "InitializeWorldLayers__16CWorldLayerStateFQ24rstl6vector<Q2CWorldLayers4Area>" .global "InitializeWorldLayers__16CWorldLayerStateFRCQ24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>"
"InitializeWorldLayers__16CWorldLayerStateFQ24rstl6vector<Q2CWorldLayers4Area>": "InitializeWorldLayers__16CWorldLayerStateFRCQ24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>":
/* 80233FC8 00230F28 94 21 FF 90 */ stwu r1, -0x70(r1) /* 80233FC8 00230F28 94 21 FF 90 */ stwu r1, -0x70(r1)
/* 80233FCC 00230F2C 7C 08 02 A6 */ mflr r0 /* 80233FCC 00230F2C 7C 08 02 A6 */ mflr r0
/* 80233FD0 00230F30 90 01 00 74 */ stw r0, 0x74(r1) /* 80233FD0 00230F30 90 01 00 74 */ stw r0, 0x74(r1)
@ -46,7 +44,7 @@ lbl_80233FC4:
/* 80233FDC 00230F3C 80 03 00 04 */ lwz r0, 4(r3) /* 80233FDC 00230F3C 80 03 00 04 */ lwz r0, 4(r3)
/* 80233FE0 00230F40 2C 00 00 00 */ cmpwi r0, 0 /* 80233FE0 00230F40 2C 00 00 00 */ cmpwi r0, 0
/* 80233FE4 00230F44 40 82 01 34 */ bne lbl_80234118 /* 80233FE4 00230F44 40 82 01 34 */ bne lbl_80234118
/* 80233FE8 00230F48 48 00 01 85 */ bl sub_8023416c /* 80233FE8 00230F48 48 00 01 85 */ bl "__as__Q24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>FRCQ24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>"
/* 80233FEC 00230F4C 80 1A 00 10 */ lwz r0, 0x10(r26) /* 80233FEC 00230F4C 80 1A 00 10 */ lwz r0, 0x10(r26)
/* 80233FF0 00230F50 2C 00 00 00 */ cmpwi r0, 0 /* 80233FF0 00230F50 2C 00 00 00 */ cmpwi r0, 0
/* 80233FF4 00230F54 41 82 01 24 */ beq lbl_80234118 /* 80233FF4 00230F54 41 82 01 24 */ beq lbl_80234118
@ -59,7 +57,7 @@ lbl_80234008:
/* 8023400C 00230F6C 7F 43 D3 78 */ mr r3, r26 /* 8023400C 00230F6C 7F 43 D3 78 */ mr r3, r26
/* 80234010 00230F70 38 81 00 34 */ addi r4, r1, 0x34 /* 80234010 00230F70 38 81 00 34 */ addi r4, r1, 0x34
/* 80234014 00230F74 93 81 00 34 */ stw r28, 0x34(r1) /* 80234014 00230F74 93 81 00 34 */ stw r28, 0x34(r1)
/* 80234018 00230F78 4B FF FF 9D */ bl GetAreaLayerCount__16CWorldLayerStateFi /* 80234018 00230F78 4B FF FF 9D */ bl GetAreaLayerCount__16CWorldLayerStateFRC7TAreaId
/* 8023401C 00230F7C 93 81 00 28 */ stw r28, 0x28(r1) /* 8023401C 00230F7C 93 81 00 28 */ stw r28, 0x28(r1)
/* 80234020 00230F80 7C 7F 1B 78 */ mr r31, r3 /* 80234020 00230F80 7C 7F 1B 78 */ mr r31, r3
/* 80234024 00230F84 3B 60 00 01 */ li r27, 1 /* 80234024 00230F84 3B 60 00 01 */ li r27, 1
@ -93,7 +91,7 @@ lbl_8023402C:
/* 80234090 00230FF0 3B BD 00 01 */ addi r29, r29, 1 /* 80234090 00230FF0 3B BD 00 01 */ addi r29, r29, 1
/* 80234094 00230FF4 93 61 00 24 */ stw r27, 0x24(r1) /* 80234094 00230FF4 93 61 00 24 */ stw r27, 0x24(r1)
/* 80234098 00230FF8 93 81 00 2C */ stw r28, 0x2c(r1) /* 80234098 00230FF8 93 81 00 2C */ stw r28, 0x2c(r1)
/* 8023409C 00230FFC 48 00 02 25 */ bl SetLayerActive__16CWorldLayerStateFiib /* 8023409C 00230FFC 48 00 02 25 */ bl SetLayerActive__16CWorldLayerStateFRC7TAreaIdRCib
/* 802340A0 00231000 3B 7B 00 01 */ addi r27, r27, 1 /* 802340A0 00231000 3B 7B 00 01 */ addi r27, r27, 1
lbl_802340A4: lbl_802340A4:
/* 802340A4 00231004 7C 1B F8 00 */ cmpw r27, r31 /* 802340A4 00231004 7C 1B F8 00 */ cmpw r27, r31
@ -109,7 +107,7 @@ lbl_802340B0:
/* 802340C8 00231028 90 01 00 48 */ stw r0, 0x48(r1) /* 802340C8 00231028 90 01 00 48 */ stw r0, 0x48(r1)
/* 802340CC 0023102C 90 01 00 4C */ stw r0, 0x4c(r1) /* 802340CC 0023102C 90 01 00 4C */ stw r0, 0x4c(r1)
/* 802340D0 00231030 90 01 00 50 */ stw r0, 0x50(r1) /* 802340D0 00231030 90 01 00 50 */ stw r0, 0x50(r1)
/* 802340D4 00231034 48 00 00 59 */ bl sub_8023412c /* 802340D4 00231034 48 00 00 59 */ bl __as__10WordBitmapFRC10WordBitmap
/* 802340D8 00231038 80 01 00 48 */ lwz r0, 0x48(r1) /* 802340D8 00231038 80 01 00 48 */ lwz r0, 0x48(r1)
/* 802340DC 0023103C 80 61 00 50 */ lwz r3, 0x50(r1) /* 802340DC 0023103C 80 61 00 50 */ lwz r3, 0x50(r1)
/* 802340E0 00231040 54 00 10 3A */ slwi r0, r0, 2 /* 802340E0 00231040 54 00 10 3A */ slwi r0, r0, 2
@ -135,8 +133,8 @@ lbl_80234118:
/* 80234124 00231084 38 21 00 70 */ addi r1, r1, 0x70 /* 80234124 00231084 38 21 00 70 */ addi r1, r1, 0x70
/* 80234128 00231088 4E 80 00 20 */ blr /* 80234128 00231088 4E 80 00 20 */ blr
.global sub_8023412c .global __as__10WordBitmapFRC10WordBitmap
sub_8023412c: __as__10WordBitmapFRC10WordBitmap:
/* 8023412C 0023108C 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8023412C 0023108C 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 80234130 00231090 7C 08 02 A6 */ mflr r0 /* 80234130 00231090 7C 08 02 A6 */ mflr r0
/* 80234134 00231094 90 01 00 14 */ stw r0, 0x14(r1) /* 80234134 00231094 90 01 00 14 */ stw r0, 0x14(r1)
@ -154,8 +152,8 @@ sub_8023412c:
/* 80234164 002310C4 38 21 00 10 */ addi r1, r1, 0x10 /* 80234164 002310C4 38 21 00 10 */ addi r1, r1, 0x10
/* 80234168 002310C8 4E 80 00 20 */ blr /* 80234168 002310C8 4E 80 00 20 */ blr
.global sub_8023416c .global "__as__Q24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>FRCQ24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>"
sub_8023416c: "__as__Q24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>FRCQ24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>":
/* 8023416C 002310CC 94 21 FF E0 */ stwu r1, -0x20(r1) /* 8023416C 002310CC 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 80234170 002310D0 7C 08 02 A6 */ mflr r0 /* 80234170 002310D0 7C 08 02 A6 */ mflr r0
/* 80234174 002310D4 90 01 00 24 */ stw r0, 0x24(r1) /* 80234174 002310D4 90 01 00 24 */ stw r0, 0x24(r1)
@ -198,7 +196,7 @@ lbl_802341E8:
/* 802341F8 00231158 48 00 00 5C */ b lbl_80234254 /* 802341F8 00231158 48 00 00 5C */ b lbl_80234254
lbl_802341FC: lbl_802341FC:
/* 802341FC 0023115C 7F C3 F3 78 */ mr r3, r30 /* 802341FC 0023115C 7F C3 F3 78 */ mr r3, r30
/* 80234200 00231160 4B E2 58 B5 */ bl sub_80059ab4 /* 80234200 00231160 4B E2 58 B5 */ bl "reserve__Q24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>Fi"
/* 80234204 00231164 80 1F 00 04 */ lwz r0, 4(r31) /* 80234204 00231164 80 1F 00 04 */ lwz r0, 4(r31)
/* 80234208 00231168 80 DF 00 0C */ lwz r6, 0xc(r31) /* 80234208 00231168 80 DF 00 0C */ lwz r6, 0xc(r31)
/* 8023420C 0023116C 54 00 20 36 */ slwi r0, r0, 4 /* 8023420C 0023116C 54 00 20 36 */ slwi r0, r0, 4
@ -232,8 +230,8 @@ lbl_80234258:
/* 80234268 002311C8 38 21 00 20 */ addi r1, r1, 0x20 /* 80234268 002311C8 38 21 00 20 */ addi r1, r1, 0x20
/* 8023426C 002311CC 4E 80 00 20 */ blr /* 8023426C 002311CC 4E 80 00 20 */ blr
.global IsLayerActive__16CWorldLayerStateFii .global IsLayerActive__16CWorldLayerStateFRC7TAreaIdRCi
IsLayerActive__16CWorldLayerStateFii: IsLayerActive__16CWorldLayerStateFRC7TAreaIdRCi:
/* 80234270 002311D0 80 E4 00 00 */ lwz r7, 0(r4) /* 80234270 002311D0 80 E4 00 00 */ lwz r7, 0(r4)
/* 80234274 002311D4 38 C0 00 01 */ li r6, 1 /* 80234274 002311D4 38 C0 00 01 */ li r6, 1
/* 80234278 002311D8 80 05 00 00 */ lwz r0, 0(r5) /* 80234278 002311D8 80 05 00 00 */ lwz r0, 0(r5)
@ -255,8 +253,8 @@ IsLayerActive__16CWorldLayerStateFii:
/* 802342B8 00231218 7C 60 19 10 */ subfe r3, r0, r3 /* 802342B8 00231218 7C 60 19 10 */ subfe r3, r0, r3
/* 802342BC 0023121C 4E 80 00 20 */ blr /* 802342BC 0023121C 4E 80 00 20 */ blr
.global SetLayerActive__16CWorldLayerStateFiib .global SetLayerActive__16CWorldLayerStateFRC7TAreaIdRCib
SetLayerActive__16CWorldLayerStateFiib: SetLayerActive__16CWorldLayerStateFRC7TAreaIdRCib:
/* 802342C0 00231220 54 C0 06 3F */ clrlwi. r0, r6, 0x18 /* 802342C0 00231220 54 C0 06 3F */ clrlwi. r0, r6, 0x18
/* 802342C4 00231224 80 84 00 00 */ lwz r4, 0(r4) /* 802342C4 00231224 80 84 00 00 */ lwz r4, 0(r4)
/* 802342C8 00231228 80 63 00 0C */ lwz r3, 0xc(r3) /* 802342C8 00231228 80 63 00 0C */ lwz r3, 0xc(r3)
@ -304,7 +302,7 @@ lbl_80234358:
/* 8023435C 002312BC 7F 43 D3 78 */ mr r3, r26 /* 8023435C 002312BC 7F 43 D3 78 */ mr r3, r26
/* 80234360 002312C0 38 81 00 24 */ addi r4, r1, 0x24 /* 80234360 002312C0 38 81 00 24 */ addi r4, r1, 0x24
/* 80234364 002312C4 93 A1 00 24 */ stw r29, 0x24(r1) /* 80234364 002312C4 93 A1 00 24 */ stw r29, 0x24(r1)
/* 80234368 002312C8 4B FF FC 4D */ bl GetAreaLayerCount__16CWorldLayerStateFi /* 80234368 002312C8 4B FF FC 4D */ bl GetAreaLayerCount__16CWorldLayerStateFRC7TAreaId
/* 8023436C 002312CC 7F E3 FA 14 */ add r31, r3, r31 /* 8023436C 002312CC 7F E3 FA 14 */ add r31, r3, r31
/* 80234370 002312D0 3B BD 00 01 */ addi r29, r29, 1 /* 80234370 002312D0 3B BD 00 01 */ addi r29, r29, 1
/* 80234374 002312D4 3B FF FF FF */ addi r31, r31, -1 /* 80234374 002312D4 3B FF FF FF */ addi r31, r31, -1
@ -322,7 +320,7 @@ lbl_80234398:
/* 8023439C 002312FC 7F 43 D3 78 */ mr r3, r26 /* 8023439C 002312FC 7F 43 D3 78 */ mr r3, r26
/* 802343A0 00231300 38 81 00 1C */ addi r4, r1, 0x1c /* 802343A0 00231300 38 81 00 1C */ addi r4, r1, 0x1c
/* 802343A4 00231304 93 A1 00 1C */ stw r29, 0x1c(r1) /* 802343A4 00231304 93 A1 00 1C */ stw r29, 0x1c(r1)
/* 802343A8 00231308 4B FF FC 0D */ bl GetAreaLayerCount__16CWorldLayerStateFi /* 802343A8 00231308 4B FF FC 0D */ bl GetAreaLayerCount__16CWorldLayerStateFRC7TAreaId
/* 802343AC 0023130C 93 A1 00 10 */ stw r29, 0x10(r1) /* 802343AC 0023130C 93 A1 00 10 */ stw r29, 0x10(r1)
/* 802343B0 00231310 7C 7F 1B 78 */ mr r31, r3 /* 802343B0 00231310 7C 7F 1B 78 */ mr r31, r3
/* 802343B4 00231314 3B 80 00 01 */ li r28, 1 /* 802343B4 00231314 3B 80 00 01 */ li r28, 1
@ -334,7 +332,7 @@ lbl_802343BC:
/* 802343C8 00231328 38 A1 00 0C */ addi r5, r1, 0xc /* 802343C8 00231328 38 A1 00 0C */ addi r5, r1, 0xc
/* 802343CC 0023132C 93 81 00 0C */ stw r28, 0xc(r1) /* 802343CC 0023132C 93 81 00 0C */ stw r28, 0xc(r1)
/* 802343D0 00231330 93 A1 00 14 */ stw r29, 0x14(r1) /* 802343D0 00231330 93 A1 00 14 */ stw r29, 0x14(r1)
/* 802343D4 00231334 4B FF FE 9D */ bl IsLayerActive__16CWorldLayerStateFii /* 802343D4 00231334 4B FF FE 9D */ bl IsLayerActive__16CWorldLayerStateFRC7TAreaIdRCi
/* 802343D8 00231338 54 64 06 3E */ clrlwi r4, r3, 0x18 /* 802343D8 00231338 54 64 06 3E */ clrlwi r4, r3, 0x18
/* 802343DC 0023133C 7F 63 DB 78 */ mr r3, r27 /* 802343DC 0023133C 7F 63 DB 78 */ mr r3, r27
/* 802343E0 00231340 7C 04 00 D0 */ neg r0, r4 /* 802343E0 00231340 7C 04 00 D0 */ neg r0, r4

View File

@ -322,7 +322,7 @@ lbl_802491F8:
/* 80249200 00246160 4B E1 A4 FD */ bl "clear__Q24rstl37vector<Ui,Q24rstl17rmemory_allocator>Fv" /* 80249200 00246160 4B E1 A4 FD */ bl "clear__Q24rstl37vector<Ui,Q24rstl17rmemory_allocator>Fv"
/* 80249204 00246164 38 7F 00 1C */ addi r3, r31, 0x1c /* 80249204 00246164 38 7F 00 1C */ addi r3, r31, 0x1c
/* 80249208 00246168 38 9D 00 1C */ addi r4, r29, 0x1c /* 80249208 00246168 38 9D 00 1C */ addi r4, r29, 0x1c
/* 8024920C 0024616C 4B FE AF 61 */ bl sub_8023416c /* 8024920C 0024616C 4B FE AF 61 */ bl "__as__Q24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>FRCQ24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>"
/* 80249210 00246170 80 9D 00 38 */ lwz r4, 0x38(r29) /* 80249210 00246170 80 9D 00 38 */ lwz r4, 0x38(r29)
/* 80249214 00246174 38 78 00 20 */ addi r3, r24, 0x20 /* 80249214 00246174 38 78 00 20 */ addi r3, r24, 0x20
/* 80249218 00246178 83 C4 00 08 */ lwz r30, 8(r4) /* 80249218 00246178 83 C4 00 08 */ lwz r30, 8(r4)
@ -853,7 +853,7 @@ lbl_8024991C:
/* 80249950 002468B0 4B FE A6 61 */ bl nullsub_5 /* 80249950 002468B0 4B FE A6 61 */ bl nullsub_5
/* 80249954 002468B4 7C 64 1B 78 */ mr r4, r3 /* 80249954 002468B4 7C 64 1B 78 */ mr r4, r3
/* 80249958 002468B8 38 7F 00 1C */ addi r3, r31, 0x1c /* 80249958 002468B8 38 7F 00 1C */ addi r3, r31, 0x1c
/* 8024995C 002468BC 4B FE A8 11 */ bl sub_8023416c /* 8024995C 002468BC 4B FE A8 11 */ bl "__as__Q24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>FRCQ24rstl56vector<Q212CWorldLayers4Area,Q24rstl17rmemory_allocator>"
/* 80249960 002468C0 80 7F 00 08 */ lwz r3, 8(r31) /* 80249960 002468C0 80 7F 00 08 */ lwz r3, 8(r31)
/* 80249964 002468C4 3C 03 00 01 */ addis r0, r3, 1 /* 80249964 002468C4 3C 03 00 01 */ addis r0, r3, 1
/* 80249968 002468C8 28 00 FF FF */ cmplwi r0, 0xffff /* 80249968 002468C8 28 00 FF FF */ cmplwi r0, 0xffff

View File

@ -3668,7 +3668,7 @@ lbl_801522F0:
/* 80152314 0014F274 38 A1 00 3C */ addi r5, r1, 0x3c /* 80152314 0014F274 38 A1 00 3C */ addi r5, r1, 0x3c
/* 80152318 0014F278 90 E1 00 3C */ stw r7, 0x3c(r1) /* 80152318 0014F278 90 E1 00 3C */ stw r7, 0x3c(r1)
/* 8015231C 0014F27C 90 01 00 40 */ stw r0, 0x40(r1) /* 8015231C 0014F27C 90 01 00 40 */ stw r0, 0x40(r1)
/* 80152320 0014F280 48 0E 1F A1 */ bl SetLayerActive__16CWorldLayerStateFiib /* 80152320 0014F280 48 0E 1F A1 */ bl SetLayerActive__16CWorldLayerStateFRC7TAreaIdRCib
lbl_80152324: lbl_80152324:
/* 80152324 0014F284 2C 1C 00 13 */ cmpwi r28, 0x13 /* 80152324 0014F284 2C 1C 00 13 */ cmpwi r28, 0x13
/* 80152328 0014F288 40 82 05 78 */ bne lbl_801528A0 /* 80152328 0014F288 40 82 05 78 */ bne lbl_801528A0

View File

@ -334,7 +334,7 @@ LIBS = [
"MetroidPrime/Weapons/CShockWave", "MetroidPrime/Weapons/CShockWave",
"MetroidPrime/Enemies/CRipperControlledPlatform", "MetroidPrime/Enemies/CRipperControlledPlatform",
"MetroidPrime/Enemies/CKnockBackController", "MetroidPrime/Enemies/CKnockBackController",
"MetroidPrime/Player/CWorldLayerState", ["MetroidPrime/Player/CWorldLayerState", False],
"MetroidPrime/Enemies/CMagdolite", "MetroidPrime/Enemies/CMagdolite",
"MetroidPrime/Enemies/CTeamAiMgr", "MetroidPrime/Enemies/CTeamAiMgr",
"MetroidPrime/Enemies/CSnakeWeedSwarm", "MetroidPrime/Enemies/CSnakeWeedSwarm",

View File

@ -0,0 +1,68 @@
#ifndef _CWORLDLAYERSTATE
#define _CWORLDLAYERSTATE
#include "MetroidPrime/TGameTypes.hpp"
#include "rstl/vector.hpp"
class CBitStreamReader;
class CWorldSaveGameInfo;
class CMemoryStreamOut;
class CWorldLayers {
public:
class Area {
public:
int m_startNameIdx;
int m_layerCount;
// u64 m_layerBits;
uint m_layerBitsHi;
uint m_layerBitsLo;
};
};
class WordBitmap {
public:
WordBitmap() : bitCount(0) {}
int GetBitCount() const { return bitCount; }
bool GetBit(int idx) const {
int wordIdx = idx / 32;
if (wordIdx >= words.size()) {
return false;
}
int wordCur = idx % 32;
return ((words[wordIdx] >> wordCur) & 0x1) != 0u;
}
void operator=(const WordBitmap&);
void Clear() {
words.clear();
bitCount = 0;
}
private:
int bitCount;
rstl::vector< uint > words;
};
class CWorldLayerState {
public:
CWorldLayerState(CBitStreamReader&, const CWorldSaveGameInfo&);
void PutTo(CMemoryStreamOut&);
void SetLayerActive(const TAreaId& areaIdx, const int& layerIdx, bool active);
bool IsLayerActive(const TAreaId& areaIdx, const int& layerIdx);
void InitializeWorldLayers(const rstl::vector< CWorldLayers::Area >&);
int GetAreaLayerCount(const TAreaId&);
private:
rstl::vector< CWorldLayers::Area > x0_areaLayers;
WordBitmap x10_saveLayers;
};
#endif // _CWORLDLAYERSTATE

View File

@ -0,0 +1,78 @@
#include "MetroidPrime/Player/CWorldLayerState.hpp"
#include "Kyoto/Streams/CMemoryStreamOut.hpp"
CWorldLayerState::CWorldLayerState(CBitStreamReader&, const CWorldSaveGameInfo&) {}
void CWorldLayerState::PutTo(CMemoryStreamOut& out) {
u32 totalLayerCount = 0;
for (int i = 0; i < x0_areaLayers.size(); ++i) {
TAreaId areaId(i);
totalLayerCount += GetAreaLayerCount(areaId) - 1;
}
out.WriteBits(totalLayerCount, 10);
for (int i = 0; i < x0_areaLayers.size(); ++i) {
TAreaId areaId(i);
int count = GetAreaLayerCount(areaId);
for (int l = 1; l < count; ++l) {
out.WriteBits(static_cast<uint>(IsLayerActive(areaId, l)), 1);
}
}
}
void CWorldLayerState::SetLayerActive(const TAreaId& areaIdx, const int& layerIdx, bool active) {
CWorldLayers::Area& area = x0_areaLayers[areaIdx.Value()];
int layerId = layerIdx;
if (active) {
u32 flag = 1 << layerId;
// area.m_layerBits = area.m_layerBits | flag;
area.m_layerBitsLo = area.m_layerBitsLo | flag;
area.m_layerBitsHi = area.m_layerBitsHi | (flag >> 0x1f);
} else {
u32 flag = ~(1 << layerId);
// area.m_layerBits = area.m_layerBits & flag;
area.m_layerBitsLo = area.m_layerBitsLo & flag;
area.m_layerBitsHi = area.m_layerBitsHi & (flag >> 0x1f);
}
}
bool CWorldLayerState::IsLayerActive(const TAreaId& areaIdx, const int& layerIdx) {
const uint* layerBits = &x0_areaLayers[areaIdx.Value()].m_layerBitsHi;
u32 flag = 1 << layerIdx;
return ((layerBits[1] & flag) | (layerBits[0] >> 0x1f)) != 0;
}
void WordBitmap::operator=(const WordBitmap& other) {
bitCount = other.bitCount;
words = other.words;
}
void CWorldLayerState::InitializeWorldLayers(const rstl::vector< CWorldLayers::Area >& layers) {
if (!x0_areaLayers.empty()) {
return;
}
x0_areaLayers = layers;
if (x10_saveLayers.GetBitCount() == 0) {
return;
}
uint a = 0;
uint b = 0;
for (int i = 0; i < x0_areaLayers.size(); ++i) {
TAreaId areaId(i);
int layerCount = GetAreaLayerCount(areaId);
for (uint l = 1; l < layerCount; ++l) {
SetLayerActive(areaId, l, x10_saveLayers.GetBit(b++));
}
++a;
}
x10_saveLayers = WordBitmap();
}
int CWorldLayerState::GetAreaLayerCount(const TAreaId& areaId) {
return x0_areaLayers[areaId.Value()].m_startNameIdx;
}