sm64

A Super Mario 64 decompilation
Log | Files | Refs | README | LICENSE

paintings.h (3773B)


      1 #ifndef PAINTINGS_H
      2 #define PAINTINGS_H
      3 
      4 #include <PR/ultratypes.h>
      5 #include <PR/gbi.h>
      6 
      7 #include "macros.h"
      8 #include "types.h"
      9 
     10 /// Use to properly set a GraphNodeGenerated's parameter to point to the right painting
     11 #define PAINTING_ID(id, grp) id | (grp << 8)
     12 
     13 /// The default painting side length
     14 #define PAINTING_SIZE 614.0
     15 
     16 #define PAINTING_ID_DDD 7
     17 
     18 #define BOARD_BOWSERS_SUB (1 << 0)
     19 
     20 #define BOWSERS_SUB_BEATEN 0x2
     21 #define DDD_BACK 0x1
     22 
     23 #define PAINTING_IDLE 0
     24 #define PAINTING_RIPPLE 1
     25 #define PAINTING_ENTERED 2
     26 
     27 #define RIPPLE_TRIGGER_PROXIMITY 10
     28 #define RIPPLE_TRIGGER_CONTINUOUS 20
     29 
     30 /// Painting that uses 1 or more images as a texture
     31 #define PAINTING_IMAGE 0
     32 /// Painting that has one texture used for an environment map effect
     33 #define PAINTING_ENV_MAP 1
     34 
     35 struct Painting {
     36     s16 id;
     37     /// How many images should be drawn when the painting is rippling.
     38     s8 imageCount;
     39     /// Either PAINTING_IMAGE or PAINTING_ENV_MAP
     40     s8 textureType;
     41 
     42     /// The floor Mario was on last frame
     43     s8 lastFloor;
     44     /// The floor Mario is currently on
     45     s8 currFloor;
     46     /// The floor Mario just entered
     47     s8 floorEntered;
     48 
     49     /// The painting's state, see top of paintings.c
     50     s8 state;
     51 
     52     /// The painting's rotation
     53     f32 pitch;
     54     f32 yaw;
     55 
     56     /// The painting's position
     57     f32 posX;
     58     f32 posY;
     59     f32 posZ;
     60 
     61     /// Controls how high the peaks of the ripple are.
     62     f32 currRippleMag;
     63     f32 passiveRippleMag;
     64     f32 entryRippleMag;
     65 
     66     /// Multiplier that controls how fast the ripple regresses to the IDLE state.
     67     f32 rippleDecay;
     68     f32 passiveRippleDecay;
     69     f32 entryRippleDecay;
     70 
     71     /// Controls the ripple's frequency
     72     f32 currRippleRate;
     73     f32 passiveRippleRate;
     74     f32 entryRippleRate;
     75 
     76     /// The rate at which the magnitude of the ripple decreases as you move farther from the central
     77     /// point of the ripple
     78     f32 dispersionFactor;
     79     f32 passiveDispersionFactor;
     80     f32 entryDispersionFactor;
     81 
     82     /// How far the ripple has spread
     83     f32 rippleTimer;
     84 
     85     /// The x and y origin of the ripple
     86     f32 rippleX;
     87     f32 rippleY;
     88 
     89     /// Display list used when the painting is normal.
     90     const Gfx *normalDisplayList;
     91     /// Data used to map the texture to the mesh
     92     const s16 *const *textureMaps;
     93 
     94     // Texture data
     95     const Texture *const *textureArray;
     96     s16 textureWidth;
     97     s16 textureHeight;
     98 
     99     /// Display list used when the painting is rippling.
    100     const Gfx *rippleDisplayList;
    101     /// Controls when a passive ripple starts. RIPPLE_TRIGGER_CONTINUOUS or RIPPLE_TRIGGER_PROXIMITY.
    102     s8 rippleTrigger;
    103 
    104     /// The painting's transparency. Determines what layer the painting is in.
    105     u8 alpha;
    106 
    107     /// True if Mario was under the painting's y coordinate last frame
    108     s8 marioWasUnder;
    109     /// True if Mario is currently under the painting's y coordinate
    110     s8 marioIsUnder;
    111     /// True if Mario just went under the painting's y coordinate on this frame
    112     s8 marioWentUnder;
    113 
    114     /// Uniformly scales the painting to a multiple of PAINTING_SIZE.
    115     /// By default a painting is 614.0 x 614.0
    116     f32 size;
    117 };
    118 
    119 /**
    120  * Contains the position and normal of a vertex in the painting's generated mesh.
    121  */
    122 struct PaintingMeshVertex {
    123     /*0x00*/ s16 pos[3];
    124     /*0x06*/ s8 norm[3];
    125 };
    126 
    127 extern s16 gPaintingMarioFloorType;
    128 extern f32 gPaintingMarioXPos;
    129 extern f32 gPaintingMarioYPos;
    130 extern f32 gPaintingMarioZPos;
    131 
    132 extern struct PaintingMeshVertex *gPaintingMesh;
    133 extern Vec3f *gPaintingTriNorms;
    134 extern struct Painting *gRipplingPainting;
    135 extern s8 gDDDPaintingStatus;
    136 
    137 Gfx *geo_painting_draw(s32 callContext, struct GraphNode *node, UNUSED void *context);
    138 Gfx *geo_painting_update(s32 callContext, UNUSED struct GraphNode *node, UNUSED Mat4 c);
    139 
    140 #endif // PAINTINGS_H