Merge pull request #217 from SethBarberee/gravity_funcs
Some checks are pending
build / build (push) Waiting to run

Decomp gravity funcs
This commit is contained in:
AnonymousRandomPerson 2025-11-29 22:49:52 -06:00 committed by GitHub
commit e5fa07c676
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 67 additions and 105 deletions

View File

@ -1,22 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_0233836C.inc"
.text
arm_func_start ResetGravity
ResetGravity: ; 0x0233836C
ldr r0, _02338388 ; =DUNGEON_PTR
ldr ip, _0233838C ; =MemZero
ldr r0, [r0]
mov r1, #2
#ifdef JAPAN
add r0, r0, #0x258
#else
add r0, r0, #0x2fc
#endif
add r0, r0, #0x12800
bx ip
.align 2, 0
_02338388: .word DUNGEON_PTR
_0233838C: .word MemZero
arm_func_end ResetGravity

View File

@ -3,68 +3,6 @@
.text
arm_func_start ov29_023383A8
ov29_023383A8: ; 0x023383A8
ldr ip, _023383B4 ; =LogMessageByIdWithPopupCheckUser
ldr r1, _023383B8 ; =0x00000D8D
bx ip
.align 2, 0
_023383B4: .word LogMessageByIdWithPopupCheckUser
#ifdef JAPAN
_023383B8: .word 0x00000ACD
#else
_023383B8: .word 0x00000D8D
#endif
arm_func_end ov29_023383A8
arm_func_start TryActivateGravity
TryActivateGravity: ; 0x023383BC
stmdb sp!, {r4, lr}
mov r4, r0
bl EntityIsValid__02337CA8
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r4, pc}
ldr r0, _02338424 ; =DUNGEON_PTR
ldr r0, [r0]
add r2, r0, #0x12000
#ifdef JAPAN
ldrb r0, [r2, #0xa58]
#else
ldrb r0, [r2, #0xafc]
#endif
cmp r0, #0
beq _02338400
ldr r1, _02338428 ; =0x00000C06
mov r0, r4
bl LogMessageByIdWithPopupCheckUser
mov r0, #0
ldmia sp!, {r4, pc}
_02338400:
ldr r1, _0233842C ; =0x00000C05
mov r3, #1
mov r0, r4
#ifdef JAPAN
strb r3, [r2, #0xa58]
#else
strb r3, [r2, #0xafc]
#endif
bl LogMessageByIdWithPopupCheckUser
mov r0, r4
bl ov29_02306D54
mov r0, #1
ldmia sp!, {r4, pc}
.align 2, 0
_02338424: .word DUNGEON_PTR
#ifdef JAPAN
_02338428: .word 0x00000945
_0233842C: .word 0x00000944
#else
_02338428: .word 0x00000C06
_0233842C: .word 0x00000C05
#endif
arm_func_end TryActivateGravity
arm_func_start RevealAttackedTile
RevealAttackedTile: ; 0x02338430
stmdb sp!, {r4, lr}

View File

@ -0,0 +1,12 @@
#ifndef PMDSKY_OVERLAY_29_0233836C_H
#define PMDSKY_OVERLAY_29_0233836C_H
#include "util.h"
#include "dungeon_mode.h"
void ResetGravity(void);
bool8 GravityIsActive(void);
void ov29_023383A8(struct entity *monster);
bool8 TryActivateGravity(struct entity *monster);
#endif /* ifndef PMDSKY_OVERLAY_29_0233836C_H */

View File

@ -1,8 +0,0 @@
#ifndef PMDSKY_OVERLAY_29_02338390_H
#define PMDSKY_OVERLAY_29_02338390_H
#include "util.h"
bool8 GravityIsActive();
#endif //PMDSKY_OVERLAY_29_02338390_H

View File

@ -630,8 +630,7 @@ Overlay OVY_29
Object src/dungeon_map_access_1.o
Object asm/overlay_29_02337EC0.o
Object src/overlay_29_02338350.o
Object asm/overlay_29_0233836C.o
Object src/overlay_29_02338390.o
Object src/overlay_29_0233836C.o
Object asm/overlay_29_023383A8.o
Object src/overlay_29_02338548.o
Object asm/overlay_29_02338560.o

View File

@ -1,7 +1,7 @@
#include "dungeon_logic_3.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util_static.h"
#include "overlay_29_02338390.h"
#include "overlay_29_0233836C.h"
bool8 LevitateIsActive(struct entity* entity)
{

View File

@ -11,7 +11,7 @@
#include "math.h"
#include "moves_3.h"
#include "number_util.h"
#include "overlay_29_02338390.h"
#include "overlay_29_0233836C.h"
#include "run_dungeon_1.h"
#include "tileset.h"
#include "trap.h"

View File

@ -1,7 +1,7 @@
#include "overlay_29_02318A4C.h"
#include "dungeon_util_static.h"
#include "overlay_29_02315118.h"
#include "overlay_29_02338390.h"
#include "overlay_29_0233836C.h"
bool8 IsFloating(struct entity *entity)
{

50
src/overlay_29_0233836C.c Normal file
View File

@ -0,0 +1,50 @@
#include "overlay_29_0233836C.h"
#include "dungeon.h"
#include "main_0200330C.h"
#include "overlay_29_02337CA8.h"
extern void LogMessageByIdWithPopupCheckUser(struct entity *user, u32 message_id);
extern void ov29_02306D54(struct entity *);
void ResetGravity(void)
{
MemZero(&DUNGEON_PTR[0]->gravity, 2);
}
bool8 GravityIsActive()
{
return DUNGEON_PTR[0]->gravity;
}
void ov29_023383A8(struct entity *monster)
{
#ifndef JAPAN
LogMessageByIdWithPopupCheckUser(monster, 0xD8D);
#else
LogMessageByIdWithPopupCheckUser(monster, 0xACD);
#endif
}
bool8 TryActivateGravity(struct entity *monster)
{
if (!EntityIsValid__02337CA8(monster)) {
return FALSE;
}
if (DUNGEON_PTR[0]->gravity) {
#ifndef JAPAN
LogMessageByIdWithPopupCheckUser(monster, 0xC06);
#else
LogMessageByIdWithPopupCheckUser(monster, 0x945);
#endif
return FALSE;
}
DUNGEON_PTR[0]->gravity = TRUE;
#ifndef JAPAN
LogMessageByIdWithPopupCheckUser(monster, 0xC05);
#else
LogMessageByIdWithPopupCheckUser(monster, 0x944);
#endif
ov29_02306D54(monster);
return TRUE;
}

View File

@ -1,7 +0,0 @@
#include "overlay_29_02338390.h"
#include "dungeon.h"
bool8 GravityIsActive()
{
return DUNGEON_PTR[0]->gravity;
}

View File

@ -2,7 +2,7 @@
#include "dungeon_util_static.h"
#include "overlay_29_0230A994.h"
#include "overlay_29_02318A4C.h"
#include "overlay_29_02338390.h"
#include "overlay_29_0233836C.h"
#include "type_matchup_table.h"
s16 GetTypeMatchup(struct entity *attacker, struct entity *defender, s16 target_type_idx, enum type_id attack_type)