summaryrefslogtreecommitdiff
path: root/src/d/lyt/d_lyt_map_capture.cpp
blob: 209368658b29e81c558f67c365da2ceae3d14770 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "d/lyt/d_lyt_map_capture.h"
#include "common.h"
#include "d/d_stage.h"
#include "d/lyt/d_lyt_map_global.h"

STATE_DEFINE(dLytMapCapture_c, RenderingWait);
STATE_DEFINE(dLytMapCapture_c, RenderingWaitStep2);

void dLytMapCapture_c::initializeState_RenderingWait() {}
void dLytMapCapture_c::executeState_RenderingWait() {
    if (mRenderRequest && !mIsBusyRendering) {
        fn_8012D6F0();
        mRenderRequest = false;
        mIsBusyRendering = true;
        mStateMgr.changeState(StateID_RenderingWaitStep2);
    }
}
void dLytMapCapture_c::finalizeState_RenderingWait() {}

void dLytMapCapture_c::initializeState_RenderingWaitStep2() {}
void dLytMapCapture_c::executeState_RenderingWaitStep2() {
    if (mIsBusyRendering && dStage_c::GetInstance() != nullptr && !dStage_c::GetInstance()->getMapRelated()->getField_0x1EE()) {
        mIsBusyRendering = false;
        if (mRenderRequest) {
            fn_8012D6F0();
            mRenderRequest = false;
            mIsBusyRendering = true;
        } else {
            mStateMgr.changeState(StateID_RenderingWait);
        }
    }
}
void dLytMapCapture_c::finalizeState_RenderingWaitStep2() {}

bool dLytMapCapture_c::isBusyRendering() const{
    return mIsBusyRendering;
}

void dLytMapCapture_c::execute() {
    mStateMgr.executeState();
}

void dLytMapCapture_c::fn_8012D6D0(mVec3_c *out) {
    *out = dStage_c::GetInstance()->getMapRelated()->field_0x0FC;
}

void dLytMapCapture_c::fn_8012D610(mVec3_c *out){
    dStage_c::GetInstance()->getMapRelated()->fn_801B50C0(0);
    *out = dStage_c::GetInstance()->getMapRelated()->fn_801B4CB0();
}

void dLytMapCapture_c::fn_8012D670(mVec3_c *out){
    dStage_c::GetInstance()->getMapRelated()->fn_801B50C0(0);
    *out = dStage_c::GetInstance()->getMapRelated()->fn_801B4C90();
}


void dLytMapCapture_c::fn_8012D800(nw4r::lyt::Pane *param_2, const GXTexObj *param_3) {
    if (param_3 != nullptr && dStage_c::GetInstance() != nullptr && dStage_c::GetInstance()->getMapRelated()->fn_801B5970(param_3)) {
        field_0x070.width = GXGetTexObjWidth(param_3);
        field_0x070.height = GXGetTexObjHeight(param_3);
        param_2->SetSize(field_0x070);
        param_2->GetMaterial()->GetTexMapAry()->ReplaceImage(*param_3);
    }
}


void dLytMapCapture_c::fn_8012D6F0(){
 
    dStage_c * pStage = dStage_c::GetInstance();
    
    if (pStage != nullptr) {
        dLytMapGlobal_c* pLytMap = dLytMapGlobal_c::GetInstance();

        f32 zoom = pLytMap->getZoomFrame();
        f32 inv = 1.0f / pLytMap->getField_0x44();
        s32 floor = pLytMap->getFloor();

        mVec3_c v(field_0x064 * inv, 1, field_0x06C * inv);

        pStage->getMapRelated()->fn_801B50C0(floor);
 
        pStage->getMapRelated()->field_0x108 = pLytMap->getMapScroll();
        pStage->getMapRelated()->field_0x114 = v;
         
        pStage->getMapRelated()->field_0x120 =  pLytMap->getMapRotationCenter(); 
        
        
        pStage->getMapRelated()->field_0x1E6 = (u16)(-pLytMap->getMapRotation());
        pStage->getMapRelated()->field_0x12C = zoom;
        pStage->getMapRelated()->field_0x1EE = 1;
    }
    return;
}