fix(gx): reflect OG behavior better in Screen

This commit is contained in:
phaneron 2024-09-10 20:30:24 -04:00
parent c90a7e2ad8
commit 1721e09741

View file

@ -14,7 +14,7 @@ float Screen::s_elapsedSec = 0.0f;
int32_t Screen::s_presentDisable = 0; int32_t Screen::s_presentDisable = 0;
static HOBJECT s_stockObjects[SCRNSTOCKOBJECTS]; static HOBJECT s_stockObjects[SCRNSTOCKOBJECTS];
static float s_stockObjectHeights[SCRNSTOCKOBJECTS] = { 0.01953125f, 0.01953125f }; static float s_stockObjectHeights[SCRNSTOCKOBJECTS] = { 0.01953125f, 0.01953125f };
static STORM_EXPLICIT_LIST(CILayer, zorderlink) s_zOrderList; static STORM_EXPLICIT_LIST(CILayer, zorderlink) s_zorderlist;
int32_t OnIdle(const EVENT_DATA_IDLE* data, void* a2) { int32_t OnIdle(const EVENT_DATA_IDLE* data, void* a2) {
Screen::s_elapsedSec = data->elapsedSec + Screen::s_elapsedSec; Screen::s_elapsedSec = data->elapsedSec + Screen::s_elapsedSec;
@ -38,7 +38,7 @@ int32_t OnPaint(const void* a1, void* a2) {
SRgnCombineRectf(rgn.m_handle, &baseRect, nullptr, 2); SRgnCombineRectf(rgn.m_handle, &baseRect, nullptr, 2);
// Walk the layer list backward (highest z-order to lowest) to establish visibility rects // Walk the layer list backward (highest z-order to lowest) to establish visibility rects
for (auto layer = s_zOrderList.Tail(); layer; layer = layer->zorderlink.Prev()) { for (auto layer = s_zorderlist.Tail(); layer; layer = layer->zorderlink.Prev()) {
SRgnGetBoundingRectf(rgn.m_handle, &layer->visible); SRgnGetBoundingRectf(rgn.m_handle, &layer->visible);
layer->visible.left = std::max(layer->visible.left, layer->rect.left); layer->visible.left = std::max(layer->visible.left, layer->rect.left);
@ -58,7 +58,7 @@ int32_t OnPaint(const void* a1, void* a2) {
GxXformViewport(minX, maxX, minY, maxY, minZ, maxZ); GxXformViewport(minX, maxX, minY, maxY, minZ, maxZ);
// Walk the layer list forward (lowest z-order to highest) to paint visible layers // Walk the layer list forward (lowest z-order to highest) to paint visible layers
for (auto layer = s_zOrderList.Head(); layer; layer = layer->zorderlink.Next()) { for (auto layer = s_zorderlist.Head(); layer; layer = layer->zorderlink.Next()) {
if (layer->visible.right > layer->visible.left && layer->visible.top > layer->visible.bottom) { if (layer->visible.right > layer->visible.left && layer->visible.top > layer->visible.bottom) {
if (layer->flags & 0x4) { if (layer->flags & 0x4) {
GxXformSetViewport( GxXformSetViewport(
@ -82,8 +82,6 @@ int32_t OnPaint(const void* a1, void* a2) {
if (layer->flags & 0x2) { if (layer->flags & 0x2) {
C44Matrix identity; C44Matrix identity;
GxXformSetView(identity);
C44Matrix orthoProj; C44Matrix orthoProj;
GxuXformCreateOrtho( GxuXformCreateOrtho(
layer->visible.left, layer->visible.left,
@ -94,6 +92,7 @@ int32_t OnPaint(const void* a1, void* a2) {
500.0f, 500.0f,
orthoProj orthoProj
); );
GxXformSetView(identity);
GxXformSetProjection(orthoProj); GxXformSetProjection(orthoProj);
} }
@ -182,13 +181,13 @@ void ScrnLayerCreate(const RECTF* rect, float zOrder, uint32_t flags, void* para
layer->param = param; layer->param = param;
layer->paintfunc = paintFunc; layer->paintfunc = paintFunc;
auto node = s_zOrderList.Head(); auto node = s_zorderlist.Head();
while (node && zOrder < node->zorder) { while (node && zOrder < node->zorder) {
node = node->zorderlink.Next(); node = node->zorderlink.Next();
} }
s_zOrderList.LinkNode(layer, 1, node); s_zorderlist.LinkNode(layer, 1, node);
*layerPtr = HandleCreate(layer); *layerPtr = HandleCreate(layer);
} }