Merge branch 'master' into doc-frontierpass2
This commit is contained in:
+24
-32
@@ -55,7 +55,7 @@ void ResetBgs(void)
|
||||
|
||||
static void SetBgModeInternal(u8 bgMode)
|
||||
{
|
||||
sGpuBgConfigs.bgVisibilityAndMode &= 0xFFF8;
|
||||
sGpuBgConfigs.bgVisibilityAndMode &= ~0x7;
|
||||
sGpuBgConfigs.bgVisibilityAndMode |= bgMode;
|
||||
}
|
||||
|
||||
@@ -66,13 +66,11 @@ u8 GetBgMode(void)
|
||||
|
||||
void ResetBgControlStructs(void)
|
||||
{
|
||||
struct BgConfig* bgConfigs = &sGpuBgConfigs.configs[0];
|
||||
struct BgConfig zeroedConfig = sZeroedBgControlStruct;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_BACKGROUNDS; i++)
|
||||
{
|
||||
bgConfigs[i] = zeroedConfig;
|
||||
sGpuBgConfigs.configs[i] = sZeroedBgControlStruct;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,36 +173,30 @@ u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode)
|
||||
u16 offset;
|
||||
s8 cursor;
|
||||
|
||||
if (!IsInvalidBg(bg) && sGpuBgConfigs.configs[bg].visible)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 0x1:
|
||||
offset = sGpuBgConfigs.configs[bg].charBaseIndex * BG_CHAR_SIZE;
|
||||
break;
|
||||
case 0x2:
|
||||
offset = sGpuBgConfigs.configs[bg].mapBaseIndex * BG_SCREEN_SIZE;
|
||||
break;
|
||||
default:
|
||||
cursor = -1;
|
||||
goto end;
|
||||
}
|
||||
if (IsInvalidBg(bg) || !sGpuBgConfigs.configs[bg].visible)
|
||||
return -1;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 0x1:
|
||||
offset = sGpuBgConfigs.configs[bg].charBaseIndex * BG_CHAR_SIZE;
|
||||
offset = destOffset + offset;
|
||||
|
||||
cursor = RequestDma3Copy(src, (void*)(offset + BG_VRAM), size, 0);
|
||||
|
||||
if (cursor == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
break;
|
||||
case 0x2:
|
||||
offset = sGpuBgConfigs.configs[bg].mapBaseIndex * BG_SCREEN_SIZE;
|
||||
offset = destOffset + offset;
|
||||
cursor = RequestDma3Copy(src, (void*)(offset + BG_VRAM), size, 0);
|
||||
if (cursor == -1)
|
||||
return -1;
|
||||
break;
|
||||
default:
|
||||
cursor = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
end:
|
||||
return cursor;
|
||||
}
|
||||
|
||||
@@ -254,17 +246,17 @@ static void SetBgAffineInternal(u8 bg, s32 srcCenterX, s32 srcCenterY, s16 dispC
|
||||
|
||||
switch (sGpuBgConfigs.bgVisibilityAndMode & 0x7)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
if (bg != 2)
|
||||
return;
|
||||
break;
|
||||
case 2:
|
||||
if (bg < 2 || bg >= NUM_BACKGROUNDS)
|
||||
if (bg != 2 && bg != 3)
|
||||
return;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
src.texX = srcCenterX;
|
||||
@@ -697,7 +689,7 @@ s32 ChangeBgY(u8 bg, s32 value, u8 op)
|
||||
return sGpuBgConfigs2[bg].bg_y;
|
||||
}
|
||||
|
||||
s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
|
||||
s32 ChangeBgY_ScreenOff(u8 bg, s32 value, u8 op)
|
||||
{
|
||||
u8 mode;
|
||||
u16 temp1;
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ u16 GetBgAttribute(u8 bg, u8 attributeId);
|
||||
s32 ChangeBgX(u8 bg, s32 value, u8 op);
|
||||
s32 GetBgX(u8 bg);
|
||||
s32 ChangeBgY(u8 bg, s32 value, u8 op);
|
||||
s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op);
|
||||
s32 ChangeBgY_ScreenOff(u8 bg, s32 value, u8 op);
|
||||
s32 GetBgY(u8 bg);
|
||||
void SetBgAffine(u8 bg, s32 srcCenterX, s32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle);
|
||||
u8 Unused_AdjustBgMosaic(u8 a1, u8 a2);
|
||||
|
||||
+15
-12
@@ -164,8 +164,8 @@ static const struct Sprite sDummySprite =
|
||||
.template = &gDummySpriteTemplate,
|
||||
.subspriteTables = NULL,
|
||||
.callback = SpriteCallbackDummy,
|
||||
.pos1 = { 304, 160 },
|
||||
.pos2 = { 0, 0 },
|
||||
.x = 304, .y = 160,
|
||||
.x2 = 0, .y2 = 0,
|
||||
.centerToCornerVecX = 0,
|
||||
.centerToCornerVecY = 0,
|
||||
.animNum = 0,
|
||||
@@ -375,13 +375,13 @@ void UpdateOamCoords(void)
|
||||
{
|
||||
if (sprite->coordOffsetEnabled)
|
||||
{
|
||||
sprite->oam.x = sprite->pos1.x + sprite->pos2.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX;
|
||||
sprite->oam.y = sprite->pos1.y + sprite->pos2.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY;
|
||||
sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX + gSpriteCoordOffsetX;
|
||||
sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY + gSpriteCoordOffsetY;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->oam.x = sprite->pos1.x + sprite->pos2.x + sprite->centerToCornerVecX;
|
||||
sprite->oam.y = sprite->pos1.y + sprite->pos2.y + sprite->centerToCornerVecY;
|
||||
sprite->oam.x = sprite->x + sprite->x2 + sprite->centerToCornerVecX;
|
||||
sprite->oam.y = sprite->y + sprite->y2 + sprite->centerToCornerVecY;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -452,6 +452,10 @@ void SortSprites(void)
|
||||
// Although this doesn't result in a bug in the ROM,
|
||||
// the behavior is undefined.
|
||||
j--;
|
||||
#ifdef UBFIX
|
||||
if (j == 0)
|
||||
break;
|
||||
#endif
|
||||
|
||||
sprite1 = &gSprites[sSpriteOrder[j - 1]];
|
||||
sprite2 = &gSprites[sSpriteOrder[j]];
|
||||
@@ -579,8 +583,8 @@ u8 CreateSpriteAt(u8 index, const struct SpriteTemplate *template, s16 x, s16 y,
|
||||
sprite->affineAnims = template->affineAnims;
|
||||
sprite->template = template;
|
||||
sprite->callback = template->callback;
|
||||
sprite->pos1.x = x;
|
||||
sprite->pos1.y = y;
|
||||
sprite->x = x;
|
||||
sprite->y = y;
|
||||
|
||||
CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode);
|
||||
|
||||
@@ -661,8 +665,7 @@ void ResetOamRange(u8 a, u8 b)
|
||||
|
||||
for (i = a; i < b; i++)
|
||||
{
|
||||
struct OamData *oamBuffer = gMain.oamBuffer;
|
||||
oamBuffer[i] = *(struct OamData *)&gDummyOamData;
|
||||
gMain.oamBuffer[i] = *(struct OamData *)&gDummyOamData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1245,14 +1248,14 @@ void obj_update_pos2(struct Sprite *sprite, s32 a1, s32 a2)
|
||||
var0 = sOamDimensions32[sprite->oam.shape][sprite->oam.size].width;
|
||||
var1 = var0 << 8;
|
||||
var2 = (var0 << 16) / gOamMatrices[matrixNum].a;
|
||||
sprite->pos2.x = sub_8007E28(var1, var2, a1);
|
||||
sprite->x2 = sub_8007E28(var1, var2, a1);
|
||||
}
|
||||
if (a2 != 0x800)
|
||||
{
|
||||
var0 = sOamDimensions32[sprite->oam.shape][sprite->oam.size].height;
|
||||
var1 = var0 << 8;
|
||||
var2 = (var0 << 16) / gOamMatrices[matrixNum].d;
|
||||
sprite->pos2.y = sub_8007E28(var1, var2, a2);
|
||||
sprite->y2 = sub_8007E28(var1, var2, a2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -197,8 +197,8 @@ struct Sprite
|
||||
/*0x18*/ const struct SubspriteTable *subspriteTables;
|
||||
/*0x1C*/ SpriteCallback callback;
|
||||
|
||||
/*0x20*/ struct Coords16 pos1;
|
||||
/*0x24*/ struct Coords16 pos2;
|
||||
/*0x20*/ s16 x, y;
|
||||
/*0x24*/ s16 x2, y2;
|
||||
/*0x28*/ s8 centerToCornerVecX;
|
||||
/*0x29*/ s8 centerToCornerVecY;
|
||||
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
#ifndef GUARD_STRING_UTIL_H
|
||||
#define GUARD_STRING_UTIL_H
|
||||
|
||||
extern u8 gStringVar1[];
|
||||
extern u8 gStringVar2[];
|
||||
extern u8 gStringVar3[];
|
||||
extern u8 gStringVar4[];
|
||||
extern u8 gStringVar1[0x100];
|
||||
extern u8 gStringVar2[0x100];
|
||||
extern u8 gStringVar3[0x100];
|
||||
extern u8 gStringVar4[0x3E8];
|
||||
|
||||
enum StringConvertMode
|
||||
{
|
||||
|
||||
+5
-8
@@ -1398,8 +1398,7 @@ s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
|
||||
|
||||
if (lineWidth > width)
|
||||
return lineWidth;
|
||||
else
|
||||
return width;
|
||||
return width;
|
||||
}
|
||||
|
||||
u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str)
|
||||
@@ -1417,9 +1416,9 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str)
|
||||
|
||||
fgColor = TEXT_COLOR_WHITE;
|
||||
bgColor = TEXT_COLOR_TRANSPARENT;
|
||||
shadowColor = TEXT_COLOR_LIGHT_GREY;
|
||||
shadowColor = TEXT_COLOR_LIGHT_GRAY;
|
||||
|
||||
GenerateFontHalfRowLookupTable(TEXT_COLOR_WHITE, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_LIGHT_GREY);
|
||||
GenerateFontHalfRowLookupTable(TEXT_COLOR_WHITE, TEXT_COLOR_TRANSPARENT, TEXT_COLOR_LIGHT_GRAY);
|
||||
strLocal = str;
|
||||
strPos = 0;
|
||||
|
||||
@@ -1633,8 +1632,7 @@ void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese)
|
||||
|
||||
if (isJapanese == TRUE)
|
||||
{
|
||||
int eff;
|
||||
glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now
|
||||
glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId % 0x10));
|
||||
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||
DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom);
|
||||
gCurGlyph.width = 8;
|
||||
@@ -1762,8 +1760,7 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese)
|
||||
|
||||
if (isJapanese == TRUE)
|
||||
{
|
||||
int eff;
|
||||
glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now
|
||||
glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId % 0x10));
|
||||
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||
DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom);
|
||||
gCurGlyph.width = 8;
|
||||
|
||||
+3
-3
@@ -71,7 +71,7 @@
|
||||
//
|
||||
#define CHAR_i_ACUTE 0x6F
|
||||
//
|
||||
#define CHAR_UNK_SPACER 0x77
|
||||
#define CHAR_GENDERLESS 0x77 // Empty space for lack of gender icon
|
||||
//
|
||||
#define CHAR_UP_ARROW 0x79
|
||||
#define CHAR_DOWN_ARROW 0x7A
|
||||
@@ -233,8 +233,8 @@
|
||||
|
||||
#define TEXT_COLOR_TRANSPARENT 0x0
|
||||
#define TEXT_COLOR_WHITE 0x1
|
||||
#define TEXT_COLOR_DARK_GREY 0x2
|
||||
#define TEXT_COLOR_LIGHT_GREY 0x3
|
||||
#define TEXT_COLOR_DARK_GRAY 0x2
|
||||
#define TEXT_COLOR_LIGHT_GRAY 0x3
|
||||
#define TEXT_COLOR_RED 0x4
|
||||
#define TEXT_COLOR_LIGHT_RED 0x5
|
||||
#define TEXT_COLOR_GREEN 0x6
|
||||
|
||||
Reference in New Issue
Block a user