mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-05 02:37:50 -04:00
Update aurora & use new frame buffer API
This commit is contained in:
+43
-1
@@ -14,6 +14,14 @@
|
||||
#include "m_Do/m_Do_lib.h"
|
||||
#include <cstring>
|
||||
|
||||
#ifdef TARGET_PC
|
||||
constexpr u16 kMapResolutionMultiplier = 4;
|
||||
// Line widths are relative to the framebuffer size. Since we're rendering to a separate
|
||||
// framebuffer, we have to scale them accordingly. The original game used about half of the
|
||||
// EFB for the map rendering, so this is a reasonable approximation.
|
||||
constexpr u8 kMapLineWidthMultiplier = 2;
|
||||
#endif
|
||||
|
||||
void dMpath_n::dTexObjAggregate_c::create() {
|
||||
static int const data[7] = {
|
||||
79, 80, 77, 78, 76, 81, 82,
|
||||
@@ -234,7 +242,11 @@ void dDrawPath_c::rendering(dDrawPath_c::line_class const* p_line) {
|
||||
int width = getLineWidth(p_line->field_0x1);
|
||||
|
||||
if (width > 0 && p_line->mDataNum >= 2) {
|
||||
GXSetLineWidth(width, GX_TO_ZERO);
|
||||
#ifdef TARGET_PC
|
||||
GXSetLineWidth(width * kMapLineWidthMultiplier, GX_TO_ZERO);
|
||||
#else
|
||||
GXSetLineWidth(width * 2, GX_TO_ZERO);
|
||||
#endif
|
||||
GXSetTevColor(GX_TEVREG0, *getLineColor(p_line->field_0x0 & 0x3F, p_line->field_0x1));
|
||||
GXBegin(GX_LINESTRIP, GX_VTXFMT0, p_line->mDataNum);
|
||||
|
||||
@@ -333,8 +345,14 @@ void dRenderingMap_c::makeResTIMG(ResTIMG* p_image, u16 width, u16 height, u8* p
|
||||
u8* p_palette, u16 param_5) const {
|
||||
p_image->format = GX_TF_C8;
|
||||
p_image->alphaEnabled = 2;
|
||||
#ifdef TARGET_PC
|
||||
// Increase map render resolution
|
||||
p_image->width = width * kMapResolutionMultiplier;
|
||||
p_image->height = height * kMapResolutionMultiplier;
|
||||
#else
|
||||
p_image->width = width;
|
||||
p_image->height = height;
|
||||
#endif
|
||||
p_image->wrapS = GX_CLAMP;
|
||||
p_image->wrapT = GX_CLAMP;
|
||||
p_image->indexTexture = true;
|
||||
@@ -412,8 +430,17 @@ void dRenderingFDAmap_c::drawBack() const {
|
||||
}
|
||||
|
||||
void dRenderingFDAmap_c::preRenderingMap() {
|
||||
#ifdef TARGET_PC
|
||||
// Increase map render resolution
|
||||
const u16 w = mTexWidth * kMapResolutionMultiplier;
|
||||
const u16 h = mTexHeight * kMapResolutionMultiplier;
|
||||
GXCreateFrameBuffer(w, h);
|
||||
GXSetViewport(0.0f, 0.0f, w, h, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, w, h);
|
||||
#else
|
||||
GXSetViewport(0.0f, 0.0f, mTexWidth, mTexHeight, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, mTexWidth, mTexHeight);
|
||||
#endif
|
||||
GXSetNumChans(1);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE,
|
||||
@@ -440,9 +467,19 @@ void dRenderingFDAmap_c::preRenderingMap() {
|
||||
|
||||
void dRenderingFDAmap_c::postRenderingMap() {
|
||||
GXSetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL);
|
||||
#ifdef TARGET_PC
|
||||
// Increase map render resolution
|
||||
const u16 w = mTexWidth * kMapResolutionMultiplier;
|
||||
const u16 h = mTexHeight * kMapResolutionMultiplier;
|
||||
GXSetTexCopySrc(0, 0, w, h);
|
||||
GXSetTexCopyDst(w, h, GX_CTF_R8, GX_FALSE);
|
||||
GXCopyTex(field_0x4, GX_TRUE);
|
||||
GXRestoreFrameBuffer();
|
||||
#else
|
||||
GXSetTexCopySrc(0, 0, mTexWidth, mTexHeight);
|
||||
GXSetTexCopyDst(mTexWidth, mTexHeight, GX_CTF_R8, GX_FALSE);
|
||||
GXCopyTex(field_0x4, GX_TRUE);
|
||||
#endif
|
||||
GXPixModeSync();
|
||||
GXSetClipMode(GX_CLIP_ENABLE);
|
||||
GXSetDither(GX_TRUE);
|
||||
@@ -474,8 +511,13 @@ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_li
|
||||
|
||||
BE(u16)* data_p = p_line->mpData;
|
||||
s32 data_num = p_line->mDataNum;
|
||||
#ifdef TARGET_PC
|
||||
GXSetLineWidth(width * kMapLineWidthMultiplier, GX_TO_ZERO);
|
||||
GXSetPointSize(width * kMapLineWidthMultiplier, GX_TO_ONE);
|
||||
#else
|
||||
GXSetLineWidth(width, GX_TO_ONE);
|
||||
GXSetPointSize(width, GX_TO_ONE);
|
||||
#endif
|
||||
GXColor lineColor = *getDecoLineColor(p_line->field_0x0 & 0x3f, p_line->field_0x1);
|
||||
GXSetTevColor(GX_TEVREG0, lineColor);
|
||||
lineColor.r = lineColor.r - 4;
|
||||
|
||||
Reference in New Issue
Block a user