NewPaletteEntry

This commit is contained in:
krystalgamer 2024-09-23 17:36:52 +02:00
parent 29b38fb70c
commit 9e3c7c97ff
3 changed files with 25 additions and 6 deletions

View File

@ -7,6 +7,7 @@
#include "ob.h"
EXPORT extern u32* gCommandPointRelated[1];
EXPORT void Crate_Destroy(CItem *);
#endif

24
pal.cpp
View File

@ -51,7 +51,8 @@ INLINE i32 GetFree16Slot(void)
return freeSlot;
}
// @SMALLTODO
// @Ok
// @Matching
INLINE i32 GetFree256Slot(void)
{
i32 freeSlot;
@ -68,10 +69,22 @@ INLINE i32 GetFree256Slot(void)
return freeSlot;
}
// @SMALLTODO
void NewPaletteEntry(u32)
// @Ok
tag_S_Pal* NewPaletteEntry(u32 checksum)
{
printf("NewPaletteEntry(u32)");
print_if_false(gPalArray != 0, "Run out of palettes");
tag_S_Pal* result = gPalArray;
gPalArray = gPalArray->pNext;
result->pNext = pPaletteList;
pPaletteList = result;
result->Checksum = checksum;
result->InVRAM = 0;
result->Usage = 0;
return result;
}
// @SMALLTODO
@ -181,5 +194,8 @@ void validate_tag_S_Pal(void)
VALIDATE(tag_S_Pal, flags, 0x3);
VALIDATE(tag_S_Pal, Usage, 0x4);
VALIDATE(tag_S_Pal, InVRAM, 0x6);
VALIDATE(tag_S_Pal, Checksum, 0x8);
VALIDATE(tag_S_Pal, pNext, 0xC);
}

6
pal.h
View File

@ -12,7 +12,9 @@ struct tag_S_Pal
u8 slot;
u8 flags;
u16 Usage;
u8 padAfter4[6];
u8 InVRAM;
u8 padAfterInVRAM;
u32 Checksum;
tag_S_Pal* pNext;
u8 padBottom[0x18-0xC-4];
@ -21,7 +23,7 @@ struct tag_S_Pal
EXPORT void Free16Slot(u16);
EXPORT i32 GetFree16Slot(void);
EXPORT i32 GetFree256Slot(void);
EXPORT void NewPaletteEntry(u32);
EXPORT tag_S_Pal* NewPaletteEntry(u32);
EXPORT void Pal_FindPaletteEntry(u32);
EXPORT void Pal_Init(void);
EXPORT void Pal_LoadPalette(u32,u32 *,u8);