sm64coopdx/src/game/paintings.h

142 lines
3.7 KiB
C
Raw Normal View History

2019-10-05 19:08:05 +00:00
#ifndef PAINTINGS_H
#define PAINTINGS_H
2019-08-25 04:46:40 +00:00
2020-06-02 16:44:34 +00:00
#include <PR/ultratypes.h>
#include <PR/gbi.h>
2020-03-02 03:42:52 +00:00
2020-06-02 16:44:34 +00:00
#include "macros.h"
#include "types.h"
2020-03-02 03:42:52 +00:00
/// Use to properly set a GraphNodeGenerated's parameter to point to the right painting
#define PAINTING_ID(id, grp) id | (grp << 8)
/// The default painting side length
#define PAINTING_SIZE 614.0
2019-08-25 04:46:40 +00:00
#define PAINTING_ID_DDD 7
#define BOARD_BOWSERS_SUB 1
#define BOWSERS_SUB_BEATEN 0x2
#define DDD_BACK 0x1
2020-03-02 03:42:52 +00:00
#define PAINTING_IDLE 0
#define PAINTING_RIPPLE 1
#define PAINTING_ENTERED 2
2019-08-25 04:46:40 +00:00
#define RIPPLE_TRIGGER_PROXIMITY 10
#define RIPPLE_TRIGGER_CONTINUOUS 20
2020-03-02 03:42:52 +00:00
/// Painting that uses 1 or more images as a texture
#define PAINTING_IMAGE 0
/// Painting that has one texture used for an environment map effect
#define PAINTING_ENV_MAP 1
2019-08-25 04:46:40 +00:00
2019-11-03 19:36:27 +00:00
struct Painting
2019-08-25 04:46:40 +00:00
{
s16 id;
2020-03-02 03:42:52 +00:00
/// How many images should be drawn when the painting is rippling.
s8 imageCount;
/// Either PAINTING_IMAGE or PAINTING_ENV_MAP
s8 textureType;
2019-11-03 19:36:27 +00:00
2020-06-02 16:44:34 +00:00
/// The floor Mario was on last frame
2019-08-25 04:46:40 +00:00
s8 lastFloor;
2020-06-02 16:44:34 +00:00
/// The floor Mario is currently on
2019-08-25 04:46:40 +00:00
s8 currFloor;
2020-06-02 16:44:34 +00:00
/// The floor Mario just entered
2019-08-25 04:46:40 +00:00
s8 floorEntered;
2019-11-03 19:36:27 +00:00
2020-03-02 03:42:52 +00:00
/// The painting's state, see top of paintings.c
s8 state;
2019-11-03 19:36:27 +00:00
2020-03-02 03:42:52 +00:00
/// The painting's rotation
f32 pitch;
f32 yaw;
2019-11-03 19:36:27 +00:00
2020-03-02 03:42:52 +00:00
/// The painting's position
f32 posX;
f32 posY;
f32 posZ;
2019-11-03 19:36:27 +00:00
2020-03-02 03:42:52 +00:00
/// Controls how high the peaks of the ripple are.
f32 currRippleMag;
f32 passiveRippleMag;
f32 entryRippleMag;
2019-11-03 19:36:27 +00:00
2020-03-02 03:42:52 +00:00
/// Multiplier that controls how fast the ripple regresses to the IDLE state.
f32 rippleDecay;
f32 passiveRippleDecay;
f32 entryRippleDecay;
2019-11-03 19:36:27 +00:00
2020-03-02 03:42:52 +00:00
/// Controls the ripple's frequency
f32 currRippleRate;
f32 passiveRippleRate;
f32 entryRippleRate;
2019-11-03 19:36:27 +00:00
2020-03-02 03:42:52 +00:00
/// The rate at which the magnitude of the ripple decreases as you move farther from the central
/// point of the ripple
f32 dispersionFactor;
f32 passiveDispersionFactor;
f32 entryDispersionFactor;
2019-11-03 19:36:27 +00:00
2020-03-02 03:42:52 +00:00
/// How far the ripple has spread
f32 rippleTimer;
2019-11-03 19:36:27 +00:00
2020-03-02 03:42:52 +00:00
/// The x and y origin of the ripple
f32 rippleX;
f32 rippleY;
2019-11-03 19:36:27 +00:00
2020-03-02 03:42:52 +00:00
/// Display list used when the painting is normal.
const Gfx *normalDisplayList;
/// Data used to map the texture to the mesh
const s16 *const *textureMaps;
// Texture data
2019-11-03 19:36:27 +00:00
const u8 *const *textureArray;
2019-08-25 04:46:40 +00:00
s16 textureWidth;
s16 textureHeight;
2020-03-02 03:42:52 +00:00
/// Display list used when the painting is rippling.
const Gfx *rippleDisplayList;
/// Controls when a passive ripple starts. RIPPLE_TRIGGER_CONTINUOUS or RIPPLE_TRIGGER_PROXIMITY.
2019-08-25 04:46:40 +00:00
s8 rippleTrigger;
2020-03-02 03:42:52 +00:00
/// The painting's transparency. Determines what layer the painting is in.
u8 alpha;
2020-06-02 16:44:34 +00:00
/// True if Mario was under the painting's y coordinate last frame
2020-03-02 03:42:52 +00:00
s8 marioWasUnder;
2020-06-02 16:44:34 +00:00
/// True if Mario is currently under the painting's y coordinate
2020-03-02 03:42:52 +00:00
s8 marioIsUnder;
2020-06-02 16:44:34 +00:00
/// True if Mario just went under the painting's y coordinate on this frame
2020-03-02 03:42:52 +00:00
s8 marioWentUnder;
/// Uniformly scales the painting to a multiple of PAINTING_SIZE.
/// By default a painting is 614.0 x 614.0
f32 size;
2019-08-25 04:46:40 +00:00
};
2020-03-02 03:42:52 +00:00
/**
* Contains the position and normal of a vertex in the painting's generated mesh.
*/
struct PaintingMeshVertex {
/*0x00*/ s16 pos[3];
/*0x06*/ s8 norm[3];
2019-08-25 04:46:40 +00:00
};
2020-06-02 16:44:34 +00:00
extern s16 gPaintingMarioFloorType;
extern f32 gPaintingMarioXPos;
extern f32 gPaintingMarioYPos;
extern f32 gPaintingMarioZPos;
2020-03-02 03:42:52 +00:00
extern struct PaintingMeshVertex *gPaintingMesh;
extern Vec3f *gPaintingTriNorms;
extern struct Painting *gRipplingPainting;
extern s8 gDddPaintingStatus;
2019-08-25 04:46:40 +00:00
2020-06-02 16:44:34 +00:00
Gfx *geo_painting_draw(s32 callContext, struct GraphNode *node, UNUSED void *context);
Gfx *geo_painting_update(s32 callContext, UNUSED struct GraphNode *node, UNUSED Mat4 c);
2019-11-03 19:36:27 +00:00
2020-06-02 16:44:34 +00:00
#endif // PAINTINGS_H