summaryrefslogtreecommitdiff
path: root/mm/2s2h/resource/type/Array.h
blob: 23d0b7e53ed37745335fa19d930d76ee0d71c77c (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
#pragma once

#include <ship/resource/Resource.h>

namespace Fast {
union F3DVtx;
}

namespace SOH {
typedef union ScalarData {
    uint8_t u8;
    int8_t s8;
    uint16_t u16;
    int16_t s16;
    uint32_t u32;
    int32_t s32;
    uint64_t u64;
    int64_t s64;
    float f32;
    double f64;
} ScalarData;

enum class ScalarType {
    ZSCALAR_NONE,
    ZSCALAR_S8,
    ZSCALAR_U8,
    ZSCALAR_X8,
    ZSCALAR_S16,
    ZSCALAR_U16,
    ZSCALAR_X16,
    ZSCALAR_S32,
    ZSCALAR_U32,
    ZSCALAR_X32,
    ZSCALAR_S64,
    ZSCALAR_U64,
    ZSCALAR_X64,
    ZSCALAR_F32,
    ZSCALAR_F64
};

// OTRTODO: Replace this with something that can be shared between the exporter and importer...
enum class ArrayResourceType {
    Error,
    Animation,
    Array,
    AltHeader,
    Background,
    Blob,
    CollisionHeader,
    Cutscene,
    DisplayList,
    Limb,
    LimbTable,
    Mtx,
    Path,
    PlayerAnimationData,
    Room,
    RoomCommand,
    Scalar,
    Scene,
    Skeleton,
    String,
    Symbol,
    Texture,
    TextureAnimation,
    TextureAnimationParams,
    Vector,
    Vertex,
    Audio
};

class Array : public Ship::Resource<void> {
  public:
    using Resource::Resource;

    Array();

    void* GetPointer() override;
    size_t GetPointerSize() override;

    ArrayResourceType ArrayType;
    ScalarType ArrayScalarType;
    size_t ArrayCount;
    // OTRTODO: Should be a vector of resource pointers...
    std::vector<ScalarData> Scalars;
    std::vector<Fast::F3DVtx> Vertices;
};
} // namespace SOH