mirror of
https://github.com/YohannDR/mzm.git
synced 2025-01-21 04:34:28 +00:00
OAM, Particle effect
This commit is contained in:
parent
5232975f53
commit
32846bce0b
31
src/oam.h
31
src/oam.h
@ -1,11 +1,34 @@
|
||||
#ifndef GBA_GFX_H
|
||||
#define GBA_GFX_H
|
||||
#ifndef OAM_H
|
||||
#define OAM_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
struct oam_data {
|
||||
u16 oam0;
|
||||
u16 oam1;
|
||||
u16 oam2;
|
||||
};
|
||||
|
||||
struct oam_frame {
|
||||
u16 part_count;
|
||||
struct oam_data data[0]; // "dynamic array" -> [part_count]
|
||||
};
|
||||
|
||||
struct frame_data {
|
||||
void* oam_frame_ptr;
|
||||
struct oam_frame* oam_frame_ptr;
|
||||
u32 timer;
|
||||
};
|
||||
|
||||
#endif /* GBA_GFX_H */
|
||||
struct oam_part {
|
||||
u8 sub1;
|
||||
u8 sub2;
|
||||
};
|
||||
|
||||
struct raw_oam_data {
|
||||
struct oam_part part1;
|
||||
struct oam_part part2;
|
||||
struct oam_part part3;
|
||||
struct oam_part part4;
|
||||
};
|
||||
|
||||
#endif /* OAM_H */
|
101
src/particle.h
Normal file
101
src/particle.h
Normal file
@ -0,0 +1,101 @@
|
||||
#ifndef PARTICLE_H
|
||||
#define PARTICLE_H
|
||||
|
||||
#include "types.h"
|
||||
#include "oam.h"
|
||||
|
||||
enum __attribute__ ((packed)) particle_effect_id {
|
||||
PE_SPRITE_SPLASH_WAER_SMALL = 0x0,
|
||||
PE_SPRITE_SPLASH_WATER_BIG = 0x1,
|
||||
PE_SPRITE_SPLASH_WATER_HUGE = 0x2,
|
||||
PE_SPRITE_SPLASH_LAVA_SMALL = 0x3,
|
||||
PE_SPRITE_SPLASH_LAVA_BIG = 0x4,
|
||||
PE_SPRITE_SPLASH_LAVA_HUGE = 0x5,
|
||||
PE_SPRITE_SPLASH_ACID_SMALL = 0x6,
|
||||
PE_SPRITE_SPLASH_ACID_BIG = 0x7,
|
||||
PE_SPRITE_SPLASH_ACID_HUGE = 0x8,
|
||||
PE_SHOOTING_BEAM_LEFT = 0x9,
|
||||
PE_SHOOTING_BEAM_DIAG_UP_LEFT = 0xA,
|
||||
PE_SHOOTING_BEAM_DIAG_DOWN_LEFT = 0xB,
|
||||
PE_SHOOTING_BEAM_UP_LEFT = 0xC,
|
||||
PE_SHOOTING_BEAM_DOWN_LEFT = 0xD,
|
||||
PE_SHOOTING_BEAM_RIGHT = 0xE,
|
||||
PE_SHOOTING_BEAM_DIAG_UP_RIGHT = 0xF,
|
||||
PE_SHOOTING_BEAM_DIAG_DOWN_RIGHT = 0x10,
|
||||
PE_SHOOTING_BEAM_UP_RIGHT = 0x11,
|
||||
PE_SHOOTING_BEAM_DOWN_RIGHT = 0x12,
|
||||
PE_BOMB = 0x13,
|
||||
PE_MISSILE_TRAIL = 0x14,
|
||||
PE_SUPER_MISSILE_TRAIL = 0x15,
|
||||
PE_BEAM_TRAILING_RIGHT = 0x16,
|
||||
PE_BEAM_TRAILING_LEFT = 0x17,
|
||||
PE_CHARGED_LONG_BEAM_TRAIL = 0x18,
|
||||
PE_CHARGED_ICE_BEAM_TRAIL = 0x19,
|
||||
PE_CHARGED_WAVE_BEAM_TRAIL = 0x1A,
|
||||
PE_CHARGED_PLASMA_BEAM_TRAIL = 0x1B,
|
||||
PE_CHARGED_FULL_BEAM_TRAIL = 0x1C,
|
||||
PE_CHARGED_PISTOL_TRAIL = 0x1D,
|
||||
PE_SPRITE_EXPLOSION_HUGE = 0x1E,
|
||||
PE_SPRITE_EXPLOSION_SMALL = 0x1F,
|
||||
PE_SPRITE_EXPLOSION_MEDIUM = 0x20,
|
||||
PE_SPRITE_EXPLOSION_BIG = 0x21,
|
||||
PE_SPRITE_EXPLOSION_SINGLE_THEN_BIG = 0x22,
|
||||
PE_SCREW_ATTACK_DESTROYED = 0x23,
|
||||
PE_SHINESPARK_DESTROYED = 0x24,
|
||||
PE_SUDO_SCREW_DESTROYED = 0x25,
|
||||
PE_SPEEDBOOSTER_DESTROYED = 0x26,
|
||||
PE_MAIN_BOSS_DEATH = 0x27,
|
||||
PE_FREEZING_SPRITE_WITH_ICE = 0x28,
|
||||
PE_FREEZING_SPRITE_WITH_CHARGED_ICE = 0x29,
|
||||
PE_HTTING_SOMETHING_WITH_BASE = 0x2A,
|
||||
PE_HTTING_SOMETHING_WITH_LONG = 0x2B,
|
||||
PE_HTTING_SOMETHING_WITH_ICE_BEAM = 0x2C,
|
||||
PE_HTTING_SOMETHING_WITH_WAVE_BEAM = 0x2D,
|
||||
PE_HTTING_SOMETHING_WITH_PLASMA_BEAM = 0x2E,
|
||||
PE_HTTING_SOMETHING_INVINCIBLE = 0x2F,
|
||||
PE_HTTING_SOMETHING_WITH_MISSILE = 0x30,
|
||||
PE_HTTING_SOMETHING_WITH_SUPER_MISSILE = 0x31,
|
||||
PE_HTTING_SOMETHING_WITH_FULL_BEAM_NO_PLASMA = 0x32,
|
||||
PE_HTTING_SOMETHING_WITH_FULL_BEAM = 0x33,
|
||||
PE_SMALL_DUST = 0x34,
|
||||
PE_MEDIUM_DUST = 0x35,
|
||||
PE_TWO_MEDIUM_DUST = 0x36,
|
||||
PE_SECOND_SMALL_DUST = 0x37,
|
||||
PE_SECOND_MEDIUM_DUST = 0x38,
|
||||
PE_SECOND_TWO_MEDIUM_DUST = 0x39,
|
||||
PE_SAMUS_REFLECTION = 0x3A,
|
||||
PE_CHARCHING_BEAM = 0x3B,
|
||||
PE_ESCAPE = 0x3C,
|
||||
};
|
||||
|
||||
struct particle_effect {
|
||||
u8 status;
|
||||
u8 anim_frame_counter;
|
||||
enum particle_effect_id effect;
|
||||
u8 stage;
|
||||
u8 frame_counter;
|
||||
u16 anim_state;
|
||||
u16 y_position;
|
||||
u16 x_position;
|
||||
};
|
||||
|
||||
void particle_check_on_screen(struct particle_effect* ptr);
|
||||
void particle_draw(struct particle_effect* ptr);
|
||||
void particle_process_all(void);
|
||||
void particle_set(u16 y_position, u16 x_position, enum particle_effect_id effect);
|
||||
u32 particle_update_animation(struct particle_effect* ptr, struct frame_data* oam_ptr);
|
||||
void particle_set_current_oam_frame_pointer(struct particle_effect* ptr, struct frame_data* oam_ptr);
|
||||
void particle_sprite_splash_water_small(struct particle_effect* ptr);
|
||||
void particle_sprite_splash_water_big(struct particle_effect* ptr);
|
||||
void particle_sprite_splash_water_huge(struct particle_effect* ptr);
|
||||
void particle_sprite_splash_lava_small(struct particle_effect* ptr);
|
||||
void particle_sprite_splash_lava_big(struct particle_effect* ptr);
|
||||
void particle_sprite_splash_lava_huge(struct particle_effect* ptr);
|
||||
void particle_sprite_splash_acid_small(struct particle_effect* ptr);
|
||||
void particle_sprite_splash_acid_big(struct particle_effect* ptr);
|
||||
void particle_sprite_splash_acid_huge(struct particle_effect* ptr);
|
||||
void particle_shooting_beam_left(struct particle_effect* ptr);
|
||||
void particle_shooting_beam_right(struct particle_effect* ptr);
|
||||
void particle_
|
||||
|
||||
#endif /* PARTICLE_H */
|
36
src/sprite.c
36
src/sprite.c
@ -33,46 +33,56 @@ void sprite_draw_all_2(void)
|
||||
void sprite_draw_all(void)
|
||||
{
|
||||
struct sprite_data* ptr;
|
||||
enum sprite_status status_flag;
|
||||
enum sprite_status status_check;
|
||||
u8* draw_order;
|
||||
u8* g_draw_order;
|
||||
u8 ram_slot;
|
||||
u32 ram_slot;
|
||||
int i;
|
||||
u8 unk;
|
||||
u8 unk2;
|
||||
u32 unk;
|
||||
i32 unk2;
|
||||
u8 zero;
|
||||
|
||||
status_flag = SPRITE_STATUS_EXISTS | SPRITE_STATUS_ONSCREEN | SPRITE_STATUS_NOT_DRAWN | SPRITE_STATUS_UNKNOWN;
|
||||
status_check = SPRITE_STATUS_EXISTS | SPRITE_STATUS_ONSCREEN;
|
||||
sprite_debris_draw_all();
|
||||
ptr = sprite_data;
|
||||
zero = 0x0;
|
||||
g_draw_order = sprite_draw_order;
|
||||
draw_order = &sprite_data[0].draw_order;
|
||||
//ram_slot = 0x17;
|
||||
|
||||
for (i = 0x17; -0x1 < i; i--)
|
||||
for (i = 0x17; i >= 0x0; i--)
|
||||
{
|
||||
if (((ptr->status & (SPRITE_STATUS_EXISTS | SPRITE_STATUS_ONSCREEN | SPRITE_STATUS_NOT_DRAWN | SPRITE_STATUS_UNKNOWN)) == (SPRITE_STATUS_EXISTS | SPRITE_STATUS_ONSCREEN)) && (*g_draw_order < 0x9))
|
||||
if ((ptr->status & status_flag) == status_check && *draw_order < 0x9)
|
||||
*g_draw_order = *draw_order;
|
||||
else
|
||||
*g_draw_order = 0x0;
|
||||
*g_draw_order = zero;
|
||||
g_draw_order += 0x1;
|
||||
draw_order += 0x38;
|
||||
ptr += 0x38;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
unk = 0x1;
|
||||
while (unk2 < 0x9)
|
||||
|
||||
do
|
||||
{
|
||||
ram_slot = 0x0;
|
||||
ptr = sprite_data;
|
||||
unk2 = unk + 0x1;
|
||||
|
||||
while (ptr < sprite_data + 24)
|
||||
do
|
||||
{
|
||||
if (sprite_draw_order[ram_slot] == unk)
|
||||
{
|
||||
sprite_draw(ptr, ram_slot);
|
||||
ram_slot += 0x1;
|
||||
ptr += 0x1;
|
||||
}
|
||||
|
||||
}
|
||||
ram_slot++;
|
||||
ptr++;
|
||||
} while ((u32)ptr < 0x30006ec);
|
||||
unk = unk2;
|
||||
}
|
||||
} while (unk2 < 0x9);
|
||||
}
|
||||
|
||||
void sprite_draw_all_3(void)
|
||||
|
@ -360,7 +360,7 @@ struct __attribute__ ((packed)) enemy_room_data {
|
||||
u8 y_position;
|
||||
u8 x_position;
|
||||
u8 spriteset_slot;
|
||||
}
|
||||
};
|
||||
|
||||
struct sprite_data {
|
||||
enum sprite_status status;
|
||||
|
Loading…
x
Reference in New Issue
Block a user