summaryrefslogtreecommitdiff
path: root/src/f_op/f_op_camera.cpp
blob: c2d94d0a76de3f17240dd58d7050bf5ae669c93a (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
/**
 * f_op_camera.cpp
 * Camera Process Framework
 */

#include "f_op/f_op_camera.h"
#include "f_op/f_op_camera_mng.h"
#include "f_ap/f_ap_game.h"
#include "d/d_com_inf_game.h"
#include "d/d_s_play.h"
#include "f_op/f_op_draw_tag.h"

static s32 fopCam_Draw(camera_class* i_this) {
    s32 ret = 1;
    #if DEBUG
    fapGm_HIO_c::startCpuTimer();
    #endif

    if (!dComIfGp_isPauseFlag()) {
        ret = fpcLf_DrawMethod(i_this->submethod, i_this);
    }

    #if DEBUG
    fapGm_HIO_c::stopCpuTimer("カメラ(描画処理)"); // Camera (rendering process)
    #endif

    return ret;
}

static int fopCam_Execute(camera_class* i_this) {
    int ret;
    #if DEBUG
    fapGm_HIO_c::startCpuTimer();
    #endif

    if (!dComIfGp_isPauseFlag() && !dScnPly_c::isPause()) {
        ret = fpcMtd_Execute((process_method_class*)i_this->submethod, i_this);
    }

    #if DEBUG
    fapGm_HIO_c::stopCpuTimer("カメラ(計算処理)"); // Camera (computational processing)
    #endif

    return ret;
}

int fopCam_IsDelete(camera_class* i_this) {
    int ret = fpcMtd_IsDelete((process_method_class*)i_this->submethod, i_this);
    if (ret == 1) {
        fopDwTg_DrawQTo(&i_this->create_tag);
    }

    return ret;
}

int fopCam_Delete(camera_class* i_this) {
    int ret = 0;
    ret = fpcMtd_Delete((process_method_class*)i_this->submethod, i_this);
    if (ret == 1) {
        fopDwTg_DrawQTo(&i_this->create_tag);
    }

    return ret;
}

static int fopCam_Create(void* i_this) {
    camera_class* a_this = (camera_class*)i_this;
    int ret;

    if (fpcM_IsFirstCreating(i_this)) {
        camera_process_profile_definition* profile = (camera_process_profile_definition*)fpcM_GetProfile(i_this);
        a_this->submethod = profile->sub_method;

        fopDwTg_Init(&a_this->create_tag, a_this);
        u32* append = (u32*)fpcM_GetAppend(a_this);

        if (append != NULL) {
            fpcM_SetParam(a_this, *append);
        }
    }

    ret = fpcMtd_Create(&a_this->submethod->base, a_this);
    if (ret == cPhs_COMPLEATE_e) {
        fopDwTg_ToDrawQ(&a_this->create_tag, fpcM_DrawPriority(a_this));
    }

    return ret;
}

leafdraw_method_class g_fopCam_Method = {
    (process_method_func)fopCam_Create,  (process_method_func)fopCam_Delete,
    (process_method_func)fopCam_Execute, (process_method_func)fopCam_IsDelete,
    (process_method_func)fopCam_Draw,
};