Start of sprite_data.c

This commit is contained in:
YohannDR 2022-09-20 22:43:27 +02:00
parent 1e97db6f94
commit 997aa015b2
5 changed files with 62 additions and 10 deletions

View File

@ -38,10 +38,6 @@ extern u8 blob_0x823a5bc_0x82b0cab[485104];
/* sprite_stats.c */
extern u8 sRandomTable0_F[56];
extern i16 dessgeega_sidehopper_in_block_yVelocity[16];
extern i16 sSpritesFallingCeilingSpeed[16];
extern i16 sSpritesFallingSpeed[40];
extern i16 worker_robot_sleeping_falling_speed[10];
extern u16 sPrimarySpriteStats[206][9];
extern u16 sSecondarySpriteStats[77][9];

View File

@ -1,3 +1,6 @@
#ifndef BLOCK_DATA_C
#define BLOCK_DATA_C
#include "../block.h"
#include "../clipdata.h"
#include "../connection.h"
@ -669,4 +672,6 @@ static const u8 sHatchRelated_345cee[4][2] = {
static const u16 sMotherBrainGlassBreakingBaseTilemapValues[5] = {
0x170, 0x177, 0x1C0, 0x1C7, 0x210
};
};
#endif

51
src/data/sprite_data.c Normal file
View File

@ -0,0 +1,51 @@
#ifndef SPRITE_DATA_C
#define SPRITE_DATA_C
#include "../types.h"
// 2b0c94
static const u8 sOamXFlipOffsets[3][4] = {
{ 1, 2, 4, 8 },
{ 2, 4, 4, 8 },
{ 1, 1, 2, 4 }
};
static const u8 sOamYFlipOffsets[3][4] = {
{ 1, 2, 4, 8 },
{ 1, 1, 2, 4 },
{ 2, 4, 4, 8 }
};
static const u8 sSpriteRandomNumberTable[56] = {
13, 2, 6, 8, 7, 9, 14, 10, 2, 4, 14, 4, 12,
15, 13, 12, 11, 1, 3, 15, 0, 6, 7, 8, 11, 5,
0, 3, 5, 1, 9, 10, 10, 0, 3, 0, 1, 0, 10, 0,
6, 0, 3, 0, 10, 0, 8, 0, 1, 0, 10, 0, 9, 0, 8, 0
};
static const i16 sSpritesFallingCeilingSpeed[16] = {
-4, -4, -4, -4, -4, -4, -8, -8, -8, -12,
-12, -12, -12, -12, -16, SHORT_MAX
};
static const i16 sSpritesFallingSpeed[16] = {
4, 4, 4, 4, 8, 8, 8, 8, 12, 12, 12,
16, 16, 16, 20, SHORT_MAX
};
static const i16 sSpritesFallingSpeed_Unused[8] = {
4, 6, 8, 10, 12,
14, 16, SHORT_MAX,
};
static const i16 sSpritesFallingSpeed_Unused2[16] = {
1, 1, 2, 2, 3, 3, 4, 4, 5, 5,
6, 6, 7, 7, 8, SHORT_MAX
};
static const i16 sWorkerRobotSleepingFallingSpeed[10] = {
4, 8, 8, 12, 12, 16, 16, 20, 24, SHORT_MAX
};
#endif

View File

@ -34,7 +34,7 @@ void SpriteUpdate(void)
if (gSpriteData[count].status & SPRITE_STATUS_EXISTS)
{
dma_set(3, &gSpriteData[count], &gCurrentSprite, 0x8000001c); // Transfer sprite to current
gSpriteRNG = sRandomTable0_F[(rngParam1 + count + rngParam2 + pCurrent->xPosition + pCurrent->yPosition) & 0x1F];
gSpriteRNG = sSpriteRandomNumberTable[(rngParam1 + count + rngParam2 + pCurrent->xPosition + pCurrent->yPosition) & 0x1F];
SpriteUtilUpdateStunTimer(pCurrent);
if (pCurrent->properties & SP_SECONDARY_SPRITE) // Call AI
sSecondarySpritesAIPointers[pCurrent->spriteID]();
@ -62,7 +62,7 @@ void SpriteUpdate(void)
if (gSpriteData[count].pose == 0x0 || gSpriteData[count].properties & SP_ALWAYS_ACTIVE)
{
dma_set(3, &gSpriteData[count], &gCurrentSprite, 0x8000001c); // Incorrect ldr
gSpriteRNG = sRandomTable0_F[(rngParam1 + count + rngParam2 + pCurrent->xPosition + pCurrent->yPosition) & 0x1F];
gSpriteRNG = sSpriteRandomNumberTable[(rngParam1 + count + rngParam2 + pCurrent->xPosition + pCurrent->yPosition) & 0x1F];
SpriteUtilUpdateStunTimer(pCurrent);
if (pCurrent->properties & SP_SECONDARY_SPRITE) // Call AI
sSecondarySpritesAIPointers[pCurrent->spriteID]();
@ -95,7 +95,7 @@ void SpriteUpdate(void)
if (gSpriteData[count].status & SPRITE_STATUS_EXISTS)
{
dma_set(3, &gSpriteData[count], &gCurrentSprite, 0x8000001c);
gSpriteRNG = sRandomTable0_F[(rngParam1 + count + rngParam2 + pCurrent->xPosition + pCurrent->yPosition) & 0x1F];
gSpriteRNG = sSpriteRandomNumberTable[(rngParam1 + count + rngParam2 + pCurrent->xPosition + pCurrent->yPosition) & 0x1F];
SpriteUtilUpdateStunTimer(pCurrent);
if (pCurrent->properties & SP_SECONDARY_SPRITE)
sSecondarySpritesAIPointers[pCurrent->spriteID]();
@ -123,7 +123,7 @@ void SpriteUpdate(void)
if (gSpriteData[count].status & SPRITE_STATUS_EXISTS)
{
dma_set(3, &gSpriteData[count], &gCurrentSprite, 0x8000001c);
gSpriteRNG = sRandomTable0_F[(rngParam1 + count + rngParam2 + pCurrent->xPosition + pCurrent->yPosition) & 0x1F];
gSpriteRNG = sSpriteRandomNumberTable[(rngParam1 + count + rngParam2 + pCurrent->xPosition + pCurrent->yPosition) & 0x1F];
if (pCurrent->pose == 0x0)
{

View File

@ -17,7 +17,7 @@ def Func():
result = ""
for x in range(1, size + 1):
result += str(sign(int.from_bytes(file.read(1), "little")))
result += str(sign(int.from_bytes(file.read(2), "little")))
if x % 3 == 0 and x != 0:
result += ",\n"