Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some harmless or completely superseded PRs have been left alone, as there is not much benefit in attempting to undo them. Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136, #1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179, #1180, #1181, #1182 and #1183.
This commit is contained in:
+63
-55
@@ -34,8 +34,8 @@ struct BgConfig2
|
||||
u32 unk_3:18;
|
||||
|
||||
void* tilemap;
|
||||
s32 bg_x; // Maybe unsigned, but game treats it as if it is signed a LOT.
|
||||
s32 bg_y; // Same for this variable.
|
||||
s32 bg_x;
|
||||
s32 bg_y;
|
||||
};
|
||||
|
||||
static struct BgControl sGpuBgConfigs;
|
||||
@@ -621,15 +621,17 @@ s32 GetBgX(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg32(bg))
|
||||
return -1;
|
||||
if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
return -1;
|
||||
return sGpuBgConfigs2[bg].bg_x;
|
||||
else
|
||||
return sGpuBgConfigs2[bg].bg_x;
|
||||
}
|
||||
|
||||
s32 ChangeBgY(u8 bg, s32 value, u8 op)
|
||||
{
|
||||
u8 mode;
|
||||
u16 temp1, temp2;
|
||||
u16 temp1;
|
||||
u16 temp2;
|
||||
|
||||
if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
{
|
||||
@@ -698,7 +700,8 @@ s32 ChangeBgY(u8 bg, s32 value, u8 op)
|
||||
s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
|
||||
{
|
||||
u8 mode;
|
||||
u16 temp1, temp2;
|
||||
u16 temp1;
|
||||
u16 temp2;
|
||||
|
||||
if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
{
|
||||
@@ -769,9 +772,10 @@ s32 GetBgY(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg32(bg))
|
||||
return -1;
|
||||
if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
return -1;
|
||||
return sGpuBgConfigs2[bg].bg_y;
|
||||
else
|
||||
return sGpuBgConfigs2[bg].bg_y;
|
||||
}
|
||||
|
||||
void SetBgAffine(u8 bg, s32 srcCenterX, s32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle)
|
||||
@@ -870,77 +874,81 @@ void* GetBgTilemapBuffer(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg32(bg))
|
||||
return NULL;
|
||||
if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
return NULL;
|
||||
return sGpuBgConfigs2[bg].tilemap;
|
||||
else
|
||||
return sGpuBgConfigs2[bg].tilemap;
|
||||
}
|
||||
|
||||
void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset)
|
||||
{
|
||||
if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg))
|
||||
return;
|
||||
if (mode != 0)
|
||||
CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode);
|
||||
else
|
||||
LZ77UnCompWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)));
|
||||
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||
{
|
||||
if (mode != 0)
|
||||
CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode);
|
||||
else
|
||||
LZ77UnCompWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)));
|
||||
}
|
||||
}
|
||||
|
||||
void CopyBgTilemapBufferToVram(u8 bg)
|
||||
{
|
||||
u16 sizeToLoad;
|
||||
|
||||
if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg))
|
||||
return;
|
||||
|
||||
switch (GetBgType(bg))
|
||||
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||
{
|
||||
case 0:
|
||||
sizeToLoad = GetBgMetricTextMode(bg, 0) * 0x800;
|
||||
break;
|
||||
case 1:
|
||||
sizeToLoad = GetBgMetricAffineMode(bg, 0) * 0x100;
|
||||
break;
|
||||
default:
|
||||
sizeToLoad = 0;
|
||||
break;
|
||||
switch (GetBgType(bg))
|
||||
{
|
||||
case 0:
|
||||
sizeToLoad = GetBgMetricTextMode(bg, 0) * 0x800;
|
||||
break;
|
||||
case 1:
|
||||
sizeToLoad = GetBgMetricAffineMode(bg, 0) * 0x100;
|
||||
break;
|
||||
default:
|
||||
sizeToLoad = 0;
|
||||
break;
|
||||
}
|
||||
LoadBgVram(bg, sGpuBgConfigs2[bg].tilemap, sizeToLoad, 0, 2);
|
||||
}
|
||||
LoadBgVram(bg, sGpuBgConfigs2[bg].tilemap, sizeToLoad, 0, 2);
|
||||
}
|
||||
|
||||
void CopyToBgTilemapBufferRect(u8 bg, const void *src, u8 destX, u8 destY, u8 width, u8 height)
|
||||
void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height)
|
||||
{
|
||||
u16 destX16, destY16;
|
||||
u16 destX16;
|
||||
u16 destY16;
|
||||
u16 mode;
|
||||
|
||||
if (IsInvalidBg32(bg) || IsTileMapOutsideWram(bg))
|
||||
return;
|
||||
switch (GetBgType(bg))
|
||||
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
const u16 *srcCopy = src;
|
||||
for (destY16 = destY; destY16 < (destY + height); destY16++)
|
||||
switch (GetBgType(bg))
|
||||
{
|
||||
for (destX16 = destX; destX16 < (destX + width); destX16++)
|
||||
{
|
||||
((u16 *)sGpuBgConfigs2[bg].tilemap)[((destY16 * 0x20) + destX16)] = *srcCopy++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
const u8 *srcCopy = src;
|
||||
mode = GetBgMetricAffineMode(bg, 0x1);
|
||||
for (destY16 = destY; destY16 < (destY + height); destY16++)
|
||||
case 0:
|
||||
{
|
||||
for (destX16 = destX; destX16 < (destX + width); destX16++)
|
||||
const u16 * srcCopy = src;
|
||||
for (destY16 = destY; destY16 < (destY + height); destY16++)
|
||||
{
|
||||
((u8 *)sGpuBgConfigs2[bg].tilemap)[((destY16 * mode) + destX16)] = *srcCopy++;
|
||||
for (destX16 = destX; destX16 < (destX + width); destX16++)
|
||||
{
|
||||
((u16*)sGpuBgConfigs2[bg].tilemap)[((destY16 * 0x20) + destX16)] = *srcCopy++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
const u8 * srcCopy = src;
|
||||
mode = GetBgMetricAffineMode(bg, 0x1);
|
||||
for (destY16 = destY; destY16 < (destY + height); destY16++)
|
||||
{
|
||||
for (destX16 = destX; destX16 < (destX + width); destX16++)
|
||||
{
|
||||
((u8*)sGpuBgConfigs2[bg].tilemap)[((destY16 * mode) + destX16)] = *srcCopy++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+820
-106
File diff suppressed because it is too large
Load Diff
+7
-14
@@ -269,20 +269,13 @@
|
||||
|
||||
#define TEXT_SPEED_FF 0xFF
|
||||
|
||||
enum
|
||||
{
|
||||
COLOR_FOREGROUND,
|
||||
COLOR_SHADOW,
|
||||
COLOR_BACKGROUND
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FONTATTR_MAX_LETTER_WIDTH,
|
||||
FONTATTR_MAX_LETTER_HEIGHT,
|
||||
FONTATTR_LETTER_SPACING,
|
||||
FONTATTR_LINE_SPACING,
|
||||
FONTATTR_STYLE,
|
||||
FONTATTR_UNKNOWN, // dunno what this is yet
|
||||
FONTATTR_COLOR_FOREGROUND,
|
||||
FONTATTR_COLOR_BACKGROUND,
|
||||
FONTATTR_COLOR_SHADOW
|
||||
@@ -310,7 +303,7 @@ struct TextPrinterTemplate
|
||||
u8 currentY;
|
||||
u8 letterSpacing;
|
||||
u8 lineSpacing;
|
||||
u8 style:4; // 0xC
|
||||
u8 unk:4; // 0xC
|
||||
u8 fgColor:4;
|
||||
u8 bgColor:4;
|
||||
u8 shadowColor:4;
|
||||
@@ -329,7 +322,7 @@ struct TextPrinter
|
||||
u8 delayCounter;
|
||||
u8 scrollDistance;
|
||||
u8 minLetterSpacing; // 0x20
|
||||
bool8 japanese;
|
||||
u8 japanese;
|
||||
};
|
||||
|
||||
struct FontInfo
|
||||
@@ -339,7 +332,7 @@ struct FontInfo
|
||||
u8 maxLetterHeight;
|
||||
u8 letterSpacing;
|
||||
u8 lineSpacing;
|
||||
u8 style:4; //unused
|
||||
u8 unk:4;
|
||||
u8 fgColor:4;
|
||||
u8 bgColor:4;
|
||||
u8 shadowColor:4;
|
||||
@@ -373,13 +366,13 @@ struct Struct_03002F90
|
||||
u32 unk20[8];
|
||||
u32 unk40[8];
|
||||
u32 unk60[8];
|
||||
u8 width;
|
||||
u8 height;
|
||||
u8 unk80;
|
||||
u8 unk81;
|
||||
};
|
||||
|
||||
extern TextFlags gTextFlags;
|
||||
|
||||
extern bool8 gUnknown_03002F84;
|
||||
extern u8 gUnknown_03002F84;
|
||||
extern struct Struct_03002F90 gUnknown_03002F90;
|
||||
|
||||
void SetFontsPointer(const struct FontInfo *fonts);
|
||||
|
||||
+22
-16
@@ -30,18 +30,21 @@ static void nullsub_8(void)
|
||||
|
||||
bool16 InitWindows(const struct WindowTemplate *templates)
|
||||
{
|
||||
int i, j;
|
||||
u8* allocatedTilemapBuffer;
|
||||
u16 attrib;
|
||||
int allocatedBaseBlock;
|
||||
int i;
|
||||
void *bgTilemapBuffer;
|
||||
int j;
|
||||
u8 bgLayer;
|
||||
u16 attrib;
|
||||
u8* allocatedTilemapBuffer;
|
||||
int allocatedBaseBlock;
|
||||
|
||||
for (i = 0; i < 0x4; ++i)
|
||||
{
|
||||
if (GetBgTilemapBuffer(i) != NULL)
|
||||
bgTilemapBuffer = GetBgTilemapBuffer(i);
|
||||
if (bgTilemapBuffer != NULL)
|
||||
gUnknown_03002F70[i] = nullsub_8;
|
||||
else
|
||||
gUnknown_03002F70[i] = NULL;
|
||||
gUnknown_03002F70[i] = bgTilemapBuffer;
|
||||
}
|
||||
|
||||
for (i = 0; i < 0x20; ++i)
|
||||
@@ -564,19 +567,19 @@ u32 GetWindowAttribute(u8 windowId, u8 attributeId)
|
||||
switch (attributeId)
|
||||
{
|
||||
case WINDOW_BG:
|
||||
return (u32)gWindows[windowId].window.bg;
|
||||
return gWindows[windowId].window.bg;
|
||||
case WINDOW_TILEMAP_LEFT:
|
||||
return (u32)gWindows[windowId].window.tilemapLeft;
|
||||
return gWindows[windowId].window.tilemapLeft;
|
||||
case WINDOW_TILEMAP_TOP:
|
||||
return (u32)gWindows[windowId].window.tilemapTop;
|
||||
return gWindows[windowId].window.tilemapTop;
|
||||
case WINDOW_WIDTH:
|
||||
return (u32)gWindows[windowId].window.width;
|
||||
return gWindows[windowId].window.width;
|
||||
case WINDOW_HEIGHT:
|
||||
return (u32)gWindows[windowId].window.height;
|
||||
return gWindows[windowId].window.height;
|
||||
case WINDOW_PALETTE_NUM:
|
||||
return (u32)gWindows[windowId].window.paletteNum;
|
||||
return gWindows[windowId].window.paletteNum;
|
||||
case WINDOW_BASE_BLOCK:
|
||||
return (u32)gWindows[windowId].window.baseBlock;
|
||||
return gWindows[windowId].window.baseBlock;
|
||||
case WINDOW_TILE_DATA:
|
||||
return (u32)(gWindows[windowId].tileData);
|
||||
default:
|
||||
@@ -640,9 +643,12 @@ u16 AddWindow8Bit(const struct WindowTemplate *template)
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
gWindows[windowId].tileData = memAddress;
|
||||
gWindows[windowId].window = *template;
|
||||
return windowId;
|
||||
else
|
||||
{
|
||||
gWindows[windowId].tileData = memAddress;
|
||||
gWindows[windowId].window = *template;
|
||||
return windowId;
|
||||
}
|
||||
}
|
||||
|
||||
void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue)
|
||||
|
||||
Reference in New Issue
Block a user