├── .gitattributes ├── .gitignore ├── clean.bat ├── include ├── game.h ├── ball.h ├── object.h ├── plane.h ├── common.h ├── camera.h ├── level.h ├── paddle.h ├── brick.h ├── graphics.h ├── easing.h ├── collision.h └── vector.h ├── README.md ├── src ├── easing.c ├── plane.c ├── main.c ├── brick.c ├── paddle.c ├── graphics.c ├── collision.c ├── camera.c ├── level.c └── game.c ├── data ├── levels │ └── stage0.h └── models │ ├── stage.h │ ├── stage_opa.h │ ├── paddle.h │ ├── ball.h │ └── brick.h ├── spec └── Makefile /.gitattributes: -------------------------------------------------------------------------------- 1 | *.h linguist-language=C 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | run.sh 3 | build 4 | *.o 5 | *.nvf 6 | *.out 7 | *.n64 8 | -------------------------------------------------------------------------------- /clean.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | del build\*.o >nul 2>&1 3 | del build\*.n64 >nul 2>&1 4 | del build\*.out >nul 2>&1 5 | del build\*.nvf >nul 2>&1 6 | -------------------------------------------------------------------------------- /include/game.h: -------------------------------------------------------------------------------- 1 | #ifndef STAGES_H 2 | #define STAGES_H 3 | 4 | void game_init(); 5 | void game_update(double dt); 6 | void game_draw(); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Homebrew 3D brick-breaker game for the N64. 2 | 3 | Needs the N64 developer kit to compile. 4 | Assuming everything is in its standard location, run `build.bat` to build the ROM. 5 | 6 | ![Gameplay screenshot](https://i.imgur.com/2W9EL6T.png) 7 | -------------------------------------------------------------------------------- /include/ball.h: -------------------------------------------------------------------------------- 1 | #ifndef BALL_H 2 | #define BALL_H 3 | 4 | // Ball width 5 | #define BALL_W 100.0 6 | 7 | // Ball radius 8 | #define BALL_R (BALL_W / 2) 9 | 10 | // Base movement speed 11 | #define BALL_BASE_VELOCITY (200.0 * 5) 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /include/object.h: -------------------------------------------------------------------------------- 1 | #ifndef OBJECT_H 2 | #define OBJECT_H 3 | 4 | #include 5 | #include "vector.h" 6 | 7 | typedef struct { 8 | Vec3f pos; 9 | Vec3f rot; 10 | Vec3f vel; 11 | float scale; 12 | Mtx transform; 13 | } Object; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/easing.c: -------------------------------------------------------------------------------- 1 | float easing_linear_f(double x, float min, float max) { 2 | return max - ((max - min) - (max - min) * x); 3 | } 4 | 5 | double easing_linear_d(double x, double min, double max) { 6 | return max - ((max - min) - (max - min) * x); 7 | } 8 | 9 | int easing_linear_i(double x, int min, int max) { 10 | return max - ((max - min) - (max - min) * x); 11 | } 12 | -------------------------------------------------------------------------------- /include/plane.h: -------------------------------------------------------------------------------- 1 | #ifndef PLANE_H 2 | #define PLANE_H 3 | 4 | #include "vector.h" 5 | 6 | typedef struct { 7 | Vec3f n; // Unit normal 8 | float d; // Distance from the plane to the origin 9 | } Plane; 10 | 11 | // Construct a plane from 3 points on the plane 12 | Plane plane_from_points(Vec3f p1, Vec3f p2, Vec3f p3); 13 | 14 | // Find the closest distance from a plane to a point 15 | #define plane_distance_to_point(plane, p) (vec3f_dot((plane).n, (p)) + (plane).d) 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /data/levels/stage0.h: -------------------------------------------------------------------------------- 1 | LevelData stage0 = { 2 | 2.0, // start_vel 3 | 5, // width 4 | 5, // height 5 | 3, // depth 6 | { // bricks 7 | // Front layer 8 | 0, 0, 0, 0, 0, 9 | 0, 0, 0, 0, 0, 10 | 0, 0, 1, 0, 0, 11 | 0, 0, 0, 0, 0, 12 | 0, 0, 0, 0, 0, 13 | // Middle layer 14 | 2, 2, 2, 2, 2, 15 | 2, 0, 0, 0, 2, 16 | 2, 0, 0, 0, 2, 17 | 2, 0, 0, 0, 2, 18 | 2, 2, 2, 2, 2, 19 | // Back layer 20 | 3, 3, 3, 3, 3, 21 | 3, 3, 3, 3, 3, 22 | 3, 3, 3, 3, 3, 23 | 3, 3, 3, 3, 3, 24 | 3, 3, 3, 3, 3 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /include/common.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_H 2 | #define COMMON_H 3 | 4 | #include 5 | #include 6 | 7 | #define EPSILON 0.00001f 8 | 9 | #define DEADZONE 10 10 | 11 | #define UNIT_SIZE 200.0f 12 | 13 | #define radians(d) ((d) * M_PI / 180.0) 14 | #define degrees(r) ((r) * 180.0 / M_PI) 15 | 16 | #define flatten3D(x, y, z, width, height) (((z) * (width) * (height)) + ((y) * (width)) + (x)) 17 | 18 | // Cube sides 19 | enum { 20 | SIDE_LEFT = 0, 21 | SIDE_RIGHT = 1, 22 | SIDE_TOP = 2, 23 | SIDE_BOTTOM = 3, 24 | SIDE_FRONT = 4, 25 | SIDE_BACK = 5 26 | }; 27 | 28 | typedef u32 bool; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /include/camera.h: -------------------------------------------------------------------------------- 1 | #ifndef CAMERA_H 2 | #define CAMERA_H 3 | 4 | #include 5 | #include "vector.h" 6 | #include "graphics.h" 7 | 8 | typedef struct { 9 | float fov; 10 | Vec3f pos; 11 | Vec3f world_up; 12 | Vec3f up; 13 | Vec3f front; 14 | Vec3f right; 15 | Vec3f forward; 16 | float pitch; 17 | float yaw; 18 | Vec3f target; 19 | } Camera; 20 | 21 | extern Camera camera; 22 | 23 | void camera_init(); 24 | void camera_look(MVP* mvpp); 25 | void camera_move(Vec3f velocity); 26 | void camera_move_to(Vec3f pos); 27 | void camera_rotate(Vec2f rot); 28 | void camera_rotate_to(Vec2f rot); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /spec: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | beginseg 4 | name "code" 5 | flags BOOT OBJECT 6 | entry nuBoot 7 | address NU_SPEC_BOOT_ADDR 8 | stack NU_SPEC_BOOT_STACK 9 | include "build/codesegment.o" 10 | include "$(ROOT)/usr/lib/PR/rspboot.o" 11 | include "$(ROOT)/usr/lib/PR/gspF3DEX2.fifo.o" 12 | include "$(ROOT)/usr/lib/PR/gspL3DEX2.fifo.o" 13 | include "$(ROOT)/usr/lib/PR/gspF3DEX2.Rej.fifo.o" 14 | include "$(ROOT)/usr/lib/PR/gspF3DEX2.NoN.fifo.o" 15 | include "$(ROOT)/usr/lib/PR/gspF3DLX2.Rej.fifo.o" 16 | include "$(ROOT)/usr/lib/PR/gspS2DEX2.fifo.o" 17 | endseg 18 | 19 | beginwave 20 | name "demo" 21 | include "code" 22 | endwave 23 | -------------------------------------------------------------------------------- /src/plane.c: -------------------------------------------------------------------------------- 1 | #include "plane.h" 2 | 3 | // Construct a plane from 3 points on the plane 4 | Plane plane_from_points(Vec3f p1, Vec3f p2, Vec3f p3) { 5 | Plane plane; 6 | Vec3f dp1p2, dp1p3; 7 | 8 | // Calculate p2 - p1 9 | dp1p2.x = p2.x - p1.x; 10 | dp1p2.y = p2.y - p1.y; 11 | dp1p2.z = p2.z - p1.z; 12 | 13 | // Calculate p3 - p1 14 | dp1p3.x = p3.x - p1.x; 15 | dp1p3.y = p3.y - p1.y; 16 | dp1p3.z = p3.z - p1.z; 17 | 18 | // Calculate unit normal N 19 | vec3f_cross(plane.n, dp1p2, dp1p3); 20 | vec3f_norm(plane.n); 21 | 22 | // Calculate distance from the origin D 23 | plane.d = -(vec3f_dot(plane.n, p1)); 24 | 25 | return plane; 26 | } 27 | -------------------------------------------------------------------------------- /include/level.h: -------------------------------------------------------------------------------- 1 | #ifndef LEVEL_H 2 | #define LEVEL_H 3 | 4 | #include "common.h" 5 | #include "brick.h" 6 | #include "plane.h" 7 | 8 | #define MAX_BRICKS 125 9 | 10 | typedef struct { 11 | double start_vel; 12 | int width; 13 | int height; 14 | int depth; 15 | u8 bricks[MAX_BRICKS]; 16 | } LevelData; 17 | 18 | typedef struct { 19 | double start_vel; 20 | int width; 21 | int height; 22 | int depth; 23 | int num_bricks; 24 | Plane walls[6]; 25 | float bounds[6]; 26 | Brick* bricks; 27 | } Level; 28 | 29 | // Load a level from the given data 30 | Level level_load(LevelData* data); 31 | 32 | // Destroy a level and free its allocated memory 33 | void level_destroy(Level* level); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "game.h" 3 | 4 | char heap[1024 * 512 * 1]; 5 | 6 | NUContData controller[1]; 7 | 8 | static OSTime last; 9 | 10 | static void vsync_callback(int pending) { 11 | OSTime now; 12 | f32 dt; 13 | 14 | now = osGetTime(); 15 | dt = OS_CYCLES_TO_USEC(now - last) / 1000000.0; 16 | last = now; 17 | 18 | nuContDataGetEx(controller, 0); 19 | 20 | game_update(dt); 21 | 22 | if (pending < 1) { 23 | game_draw(); 24 | } 25 | } 26 | 27 | void mainproc(void* dummy) { 28 | nuGfxInit(); 29 | nuContInit(); 30 | 31 | InitHeap(heap, sizeof(heap)); 32 | 33 | game_init(); 34 | 35 | last = osGetTime(); 36 | nuGfxFuncSet((NUGfxFunc)vsync_callback); 37 | nuGfxDisplayOn(); 38 | 39 | while (1); 40 | } 41 | -------------------------------------------------------------------------------- /include/paddle.h: -------------------------------------------------------------------------------- 1 | #ifndef PADDLE_H 2 | #define PADDLE_H 3 | 4 | #include "common.h" 5 | #include "object.h" 6 | #include "vector.h" 7 | #include "level.h" 8 | 9 | // Paddle width 10 | #define PADDLE_W 400 11 | 12 | // Paddle half width 13 | #define PADDLE_R (PADDLE_W / 2) 14 | 15 | // Base movement speed 16 | #define PADDLE_BASE_VELOCITY (350.0 * 5) 17 | 18 | // Animation parameters 19 | #define PADDLE_HIT_ANIM_DURATION 0.2 20 | #define PADDLE_HIT_ANIM_INTENSITY 20.0f 21 | 22 | typedef struct { 23 | Object obj; 24 | double hit_anim_timer; 25 | Vec3f hit_rot; 26 | bool held; 27 | Vec3f hold_pos; 28 | float min_x, max_x, min_y, max_y; 29 | } Paddle; 30 | 31 | void paddle_init(Paddle* paddle, Level* level); 32 | void paddle_update(Paddle* paddle, Level* level, double dt); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /include/brick.h: -------------------------------------------------------------------------------- 1 | #ifndef BRICK_H 2 | #define BRICK_H 3 | 4 | #include "common.h" 5 | #include "vector.h" 6 | #include "object.h" 7 | 8 | // Length of a side 9 | #define BRICK_W UNIT_SIZE 10 | 11 | // Half length of a side 12 | #define BRICK_R (UNIT_SIZE / 2) 13 | 14 | // Radius of the sphere that circumscribes a brick 15 | #define BRICK_CR (BRICK_W * 1.2247449f) 16 | 17 | // Animation parameters 18 | #define BRICK_DEATH_ANIM_DURATION 0.1 19 | #define BRICK_HIT_ANIM_DURATION 0.1 20 | 21 | typedef struct Brick Brick; 22 | 23 | struct Brick { 24 | Vec3f left[4]; 25 | Vec3f right[4]; 26 | Vec3f top[4]; 27 | Vec3f bottom[4]; 28 | Vec3f front[4]; 29 | Vec3f back[4]; 30 | u8 lives; 31 | Object obj; 32 | double death_anim_timer; 33 | double hit_anim_timer; 34 | Brick* neighbours[6]; 35 | }; 36 | 37 | void brick_update(Brick* brick, double dt); 38 | void brick_kill_contiguous(Brick* brick); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /include/graphics.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHICS_H 2 | #define GRAPHICS_H 3 | 4 | #include 5 | #include "common.h" 6 | #include "object.h" 7 | 8 | #define SCREEN_W 320 9 | #define SCREEN_H 240 10 | 11 | #define MAX_TASKS 3 12 | #define GLIST_LENGTH 2048 13 | 14 | // Model view projection matrices 15 | typedef struct { 16 | Mtx modelview; 17 | Mtx projection; 18 | } MVP; 19 | 20 | extern MVP mvp[MAX_TASKS]; 21 | extern Gfx glist[MAX_TASKS][GLIST_LENGTH]; 22 | extern Gfx* glistp; 23 | extern u32 task_num; 24 | 25 | void graphics_init_RCP(); 26 | void graphics_clear(u8 r, u8 g, u8 b); 27 | void graphics_start_object(Object* object, bool xlu); 28 | void graphics_start_textured_object(Object* object, bool xlu); 29 | void graphics_end_object(); 30 | 31 | #define graphics_draw_object(obj, dl, xlu) { \ 32 | graphics_start_object((obj), (xlu)); \ 33 | gSPDisplayList(glistp++, dl); \ 34 | graphics_end_object(); \ 35 | } 36 | 37 | #define graphics_draw_textured_object(obj, dl, xlu) { \ 38 | graphics_start_textured_object((obj), (xlu)); \ 39 | gSPDisplayList(glistp++, dl); \ 40 | graphics_end_object(); \ 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | N64KITDIR = C:\nintendo\n64kit 2 | 3 | SRCDIR = src 4 | INCDIR = include 5 | OBJDIR = build 6 | DATADIR = data 7 | 8 | TARGET = brick64 9 | 10 | CODEFILES = $(wildcard $(SRCDIR)\*.c) 11 | CODEOBJECTS = $(subst $(SRCDIR),$(OBJDIR),$(CODEFILES:.c=.o)) $(NUOBJ) 12 | 13 | DEBUGSYM = -g 14 | OPTIMIZER = -O0 15 | 16 | NUSYSDIR = $(N64KITDIR)\nusys 17 | NUSYSINC = $(NUSYSDIR)\include 18 | NUSYSLIB = $(NUSYSDIR)\lib 19 | NUSTDDIR = $(N64KITDIR)\nustd 20 | NUSTDINC = $(NUSTDDIR)\include 21 | NUSTDLIB = $(NUSTDDIR)\lib 22 | 23 | NUOBJ = $(NUSYSLIB)\nusys.o 24 | 25 | LCDEFS = -DF3DEX_GBI_2 26 | LCINCS = -I$(INC)\PR -I$(NUSYSINC) -I$(NUSTDINC) -I$(INCDIR) -I$(DATADIR) 27 | LCOPTS = -G 0 $(DEBUGSYM) 28 | LDFLAGS = -L$(ROOT)\usr\lib -L$(ROOT)\usr\lib\PR -L$(NUSYSLIB) -L$(NUSTDLIB) -lnusys_d -lnustd_d -lgultra_d -L$(GCCDIR)\mipse\lib -lkmc 29 | 30 | include $(ROOT)\usr\include\make\PRdefs 31 | 32 | CODESEGMENT = $(OBJDIR)\codesegment.o 33 | SYMBOL = $(OBJDIR)\$(TARGET).out 34 | ROM = $(OBJDIR)\$(TARGET).n64 35 | 36 | default: $(ROM) 37 | 38 | $(OBJDIR)\%.o: $(SRCDIR)\%.c 39 | $(CC) $(CFLAGS) $< -o $@ 40 | 41 | $(CODESEGMENT): $(CODEOBJECTS) 42 | $(LD) -o $(CODESEGMENT) -r $(CODEOBJECTS) $(LDFLAGS) 43 | 44 | $(ROM): $(CODESEGMENT) 45 | $(MAKEROM) spec -I$(NUSYSINC) -r $(ROM) -e $(SYMBOL) 46 | -------------------------------------------------------------------------------- /src/brick.c: -------------------------------------------------------------------------------- 1 | #include "brick.h" 2 | 3 | void brick_update(Brick* brick, double dt) { 4 | // Tick down death animation timer if it's running 5 | if (brick->lives == 0 && brick->death_anim_timer > 0) { 6 | brick->death_anim_timer -= dt; 7 | 8 | if (brick->death_anim_timer < 0) { 9 | brick->death_anim_timer = 0; 10 | } 11 | 12 | brick->obj.scale = (brick->death_anim_timer / BRICK_DEATH_ANIM_DURATION); 13 | } 14 | 15 | // Tick down hit animation timer if it's running 16 | if (brick->hit_anim_timer > 0) { 17 | brick->hit_anim_timer -= dt; 18 | 19 | if (brick->hit_anim_timer < 0) { 20 | brick->hit_anim_timer = 0; 21 | } 22 | 23 | vec3f_set( 24 | brick->obj.rot, 25 | sin(2 * M_PI * ((BRICK_HIT_ANIM_DURATION - brick->hit_anim_timer) / BRICK_HIT_ANIM_DURATION)) * 10.0, 26 | 0, 27 | sin(4 * M_PI * ((BRICK_HIT_ANIM_DURATION - brick->hit_anim_timer) / BRICK_HIT_ANIM_DURATION)) * 6.0 28 | ); 29 | } 30 | } 31 | 32 | // Kill a brick and all contiguous bricks that are on their last life 33 | void brick_kill_contiguous(Brick* brick) { 34 | int i; 35 | 36 | if (brick == NULL || brick->lives != 1) { 37 | return; 38 | } 39 | 40 | brick->lives = 0; 41 | 42 | for (i = 0; i < 6; i++) { 43 | brick_kill_contiguous(brick->neighbours[i]); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /include/easing.h: -------------------------------------------------------------------------------- 1 | #ifndef EASING_H 2 | #define EASING_H 3 | 4 | typedef struct { 5 | double timer; 6 | double duration; 7 | float min; 8 | float max; 9 | float val; 10 | float (*func)(double x, float min, float max); 11 | } EasingF; 12 | 13 | typedef struct { 14 | double timer; 15 | double duration; 16 | double min; 17 | double max; 18 | double val; 19 | double (*func)(double x, double min, double max); 20 | } EasingD; 21 | 22 | typedef struct { 23 | double timer; 24 | double duration; 25 | int min; 26 | int max; 27 | int val; 28 | int (*func)(double x, int min, int max); 29 | } EasingI; 30 | 31 | // Initialize an Easing struct 32 | #define easing_init(easing, _duration, _min, _max, _func) { \ 33 | (easing).timer = 0; \ 34 | (easing).duration = (_duration); \ 35 | (easing).min = (_min); \ 36 | (easing).max = (_max); \ 37 | (easing).val = (_min); \ 38 | (easing).func = (_func); \ 39 | } 40 | 41 | #define easing_reset(easing) { \ 42 | (easing).timer = 0; \ 43 | (easing).val = (easing).min; 44 | } 45 | 46 | // Update an Easing struct with float values 47 | #define easing_update(easing, dt) { \ 48 | (easing).timer += (dt); \ 49 | (easing).timer = (easing).timer > (easing).duration ? (easing).duration : (easing).timer; \ 50 | (easing).val = (easing).func((easing).timer / (easing).duration, (easing).min, (easing).max); \ 51 | } 52 | 53 | // Linear interpolation between two floats 54 | float easing_linear_f(double x, float min, float max); 55 | 56 | // Linear interpolation between two doubles 57 | double easing_linear_d(double x, double min, double max); 58 | 59 | // Linear interpolation between two ints 60 | int easing_linear_i(double x, int min, int max); 61 | 62 | #maxif 63 | -------------------------------------------------------------------------------- /include/collision.h: -------------------------------------------------------------------------------- 1 | #ifndef COLLISION_H 2 | #define COLLISION_H 3 | 4 | #include "common.h" 5 | #include "vector.h" 6 | #include "plane.h" 7 | 8 | // Get barycentric coordinates of P with respect to triangle ABC 9 | // p - Point to convert 10 | // a - Triangle vertex A 11 | // b - Triangle vertex B 12 | // c - Triangle vertex C 13 | // u - Output coordinate U 14 | // v - Output coordinate V 15 | // w - Output coordinate W 16 | void get_barycentric_coords(Vec3f p, Vec3f a, Vec3f b, Vec3f c, float* u, float* v, float* w); 17 | 18 | // Determine whether a 3D point lies within a 3D triangle 19 | // p - Point to test 20 | // v1 - Vertex 1 of the triangle 21 | // v2 - Vertex 2 of the triangle 22 | // v3 - Vertex 3 of the triangle 23 | bool point_in_triangle(Vec3f p, Vec3f v1, Vec3f v2, Vec3f v3); 24 | 25 | // Determine whether a moving sphere intersects with a plane 26 | // If so, calculate the point of intersection and the normalized time of intersection 27 | // r - Sphere radius 28 | // pos1 - Current position of the sphere 29 | // pos2 - Next position of the sphere 30 | // plane - Plane to test the sphere against 31 | // hit - Point of collision output (pass NULL if irrelevant) 32 | // time - Normalized time of collision output (pass NULL if irrelevant) 33 | bool moving_sphere_plane_intersect(float r, Vec3f pos1, Vec3f pos2, Plane plane, Vec3f* hit, float* time); 34 | 35 | // Determine whether a moving sphere intersects with a quad 36 | // If so, calculate the point of intersection and the normalized time of intersection 37 | // r - Sphere radius 38 | // pos1 - Current position of the sphere 39 | // pos2 - Next position of the sphere 40 | // p1 - Top left vertex of the quad 41 | // p2 - Top right vertex of the quad 42 | // p3 - Bottom left vertex of the quad 43 | // p4 - Bottom right vertex of the quad 44 | // hit - Point of collision output (pass NULL if irrelevant) 45 | // time - Normalized time of collision output (pass NULL if irrelevant) 46 | bool moving_sphere_quad_intersect(float r, Vec3f pos1, Vec3f pos2, Vec3f p1, Vec3f p2, Vec3f p3, Vec3f p4, Vec3f* hit, float* time); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/paddle.c: -------------------------------------------------------------------------------- 1 | #include "paddle.h" 2 | 3 | extern NUContData controller[1]; 4 | 5 | void paddle_init(Paddle* paddle, Level* level) { 6 | vec3f_set(paddle->obj.pos, 0, 0, level->bounds[SIDE_FRONT]); 7 | vec3f_set(paddle->obj.rot, 0, 0, 0); 8 | vec3f_set(paddle->obj.vel, 0, 0, 0); 9 | paddle->obj.scale = 2; 10 | paddle->hit_anim_timer = 0; 11 | paddle->held = FALSE; 12 | paddle->min_x = -(level->width * BRICK_W / 2) - (PADDLE_W / 4); 13 | paddle->max_x = (level->width * BRICK_W / 2) + (PADDLE_W / 4); 14 | paddle->min_y = -(level->width * BRICK_W / 2) - (PADDLE_W / 4); 15 | paddle->max_y = (level->width * BRICK_W / 2) + (PADDLE_W / 4); 16 | } 17 | 18 | void paddle_update(Paddle* paddle, Level* level, double dt) { 19 | Vec3f velocity; 20 | vec3f_set(velocity, 0, 0, 0); 21 | 22 | if (controller[0].stick_y > DEADZONE || controller[0].stick_y < -DEADZONE) { 23 | velocity.y = controller[0].stick_y; 24 | } 25 | if (controller[0].stick_x > DEADZONE || controller[0].stick_x < -DEADZONE) { 26 | velocity.x = controller[0].stick_x; 27 | } 28 | 29 | if (fabs(velocity.x) > EPSILON || fabs(velocity.y) > EPSILON || fabs(velocity.z) > EPSILON) { 30 | vec3f_norm(velocity); 31 | vec3f_mag(velocity, PADDLE_BASE_VELOCITY * dt); 32 | vec3f_add(paddle->obj.pos, velocity); 33 | 34 | // Clamp paddle position 35 | if (paddle->obj.pos.x < paddle->min_x) { 36 | paddle->obj.pos.x = paddle->min_x; 37 | } 38 | if (paddle->obj.pos.x > paddle->max_x) { 39 | paddle->obj.pos.x = paddle->max_x; 40 | } 41 | if (paddle->obj.pos.y < paddle->min_y) { 42 | paddle->obj.pos.y = paddle->min_y; 43 | } 44 | if (paddle->obj.pos.y > paddle->max_y) { 45 | paddle->obj.pos.y = paddle->max_y; 46 | } 47 | } 48 | 49 | // Tick down hit animation timer if it's running 50 | if (paddle->hit_anim_timer > 0) { 51 | float x; 52 | paddle->hit_anim_timer -= dt; 53 | 54 | if (paddle->hit_anim_timer < 0) { 55 | paddle->hit_anim_timer = 0; 56 | } 57 | 58 | x = (PADDLE_HIT_ANIM_DURATION - paddle->hit_anim_timer) / PADDLE_HIT_ANIM_DURATION; 59 | 60 | // Send paddle back a bit 61 | vec3f_set( 62 | paddle->obj.pos, 63 | paddle->obj.pos.x, 64 | paddle->obj.pos.y, 65 | sin(M_PI * x) * -(PADDLE_HIT_ANIM_INTENSITY * 5) + (level->bounds[SIDE_FRONT]) 66 | ); 67 | 68 | // Rotate the paddle depending on hit position 69 | vec3f_set( 70 | paddle->obj.rot, 71 | sin(M_PI * x) * paddle->hit_rot.x, 72 | sin(M_PI * x) * paddle->hit_rot.y, 73 | 0 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/graphics.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "graphics.h" 3 | #include "object.h" 4 | 5 | MVP mvp[MAX_TASKS]; 6 | Gfx glist[MAX_TASKS][GLIST_LENGTH]; 7 | Gfx* glistp; 8 | u32 task_num = 0; 9 | 10 | static Vp viewport = { 11 | SCREEN_W * 2, SCREEN_H * 2, G_MAXZ / 2, 0, 12 | SCREEN_W * 2, SCREEN_H * 2, G_MAXZ / 2, 0 13 | }; 14 | 15 | static Gfx rsp_init_dl[] = { 16 | gsSPViewport(&viewport), 17 | gsSPClearGeometryMode(0xFFFFFFFF), 18 | gsSPTexture(0, 0, 0, 0, G_OFF), 19 | gsSPEndDisplayList(), 20 | }; 21 | 22 | static Gfx rdp_init_dl[] = { 23 | gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, SCREEN_W, SCREEN_H), 24 | gsDPSetRenderMode(G_RM_NOOP, G_RM_NOOP2), 25 | gsDPSetColorDither(G_CD_DISABLE), 26 | gsDPSetAlphaDither(G_AD_DISABLE), 27 | gsDPSetTextureFilter(G_TF_AVERAGE), 28 | gsDPSetTextureConvert(G_TC_FILT), 29 | gsDPSetTexturePersp(G_TP_PERSP), 30 | gsDPPipeSync(), 31 | gsSPEndDisplayList(), 32 | }; 33 | 34 | // Initialize RCP 35 | void graphics_init_RCP() { 36 | gSPSegment(glistp++, 0, 0); 37 | gSPDisplayList(glistp++, rsp_init_dl); 38 | gSPDisplayList(glistp++, rdp_init_dl); 39 | } 40 | 41 | void graphics_clear(u8 r, u8 g, u8 b) { 42 | // Clear Z buffer 43 | gDPPipeSync(glistp++); 44 | gDPSetCycleType(glistp++, G_CYC_FILL); 45 | gDPSetDepthImage(glistp++, nuGfxZBuffer); 46 | gDPSetColorImage(glistp++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_W, nuGfxZBuffer); 47 | gDPSetFillColor(glistp++, (GPACK_ZDZ(G_MAXFBZ, 0) << 16 | GPACK_ZDZ(G_MAXFBZ, 0))); 48 | gDPFillRectangle(glistp++, 0, 0, SCREEN_W - 1, SCREEN_H - 1); 49 | 50 | // Clear frame buffer 51 | gDPPipeSync(glistp++); 52 | gDPSetColorImage(glistp++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_W, nuGfxCfb_ptr); 53 | gDPSetFillColor(glistp++, (GPACK_RGBA5551(r, g, b, 1) << 16 | GPACK_RGBA5551(r, g, b, 1))); 54 | gDPFillRectangle(glistp++, 0, 0, SCREEN_W - 1, SCREEN_H - 1); 55 | gDPPipeSync(glistp++); 56 | } 57 | 58 | void graphics_start_object(Object* object, bool xlu) { 59 | gDPSetCycleType(glistp++, G_CYC_1CYCLE); 60 | gSPSetGeometryMode(glistp++, G_SHADE | G_SHADING_SMOOTH | G_LIGHTING | G_CULL_BACK | G_ZBUFFER); 61 | gDPSetCombineMode(glistp++, G_CC_SHADE, G_CC_SHADE); 62 | gDPSetRenderMode( 63 | glistp++, 64 | xlu ? G_RM_AA_ZB_XLU_SURF : G_RM_AA_ZB_OPA_SURF, 65 | xlu ? G_RM_AA_ZB_XLU_SURF2 : G_RM_AA_ZB_OPA_SURF2 66 | ); 67 | guPosition( 68 | &object->transform, 69 | vec3f_unpack(object->rot), 70 | object->scale, 71 | vec3f_unpack(object->pos) 72 | ); 73 | gSPMatrix(glistp++, &object->transform, G_MTX_MODELVIEW | G_MTX_PUSH | G_MTX_MUL); 74 | } 75 | 76 | void graphics_start_textured_object(Object* object, bool xlu) { 77 | gDPSetCombineMode(glistp++, G_CC_DECALRGBA, G_CC_DECALRGBA); 78 | gSPTexture(glistp++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); 79 | gDPSetTextureLOD (glistp++, G_TL_TILE); 80 | gDPSetCycleType(glistp++, G_CYC_1CYCLE); 81 | gSPSetGeometryMode(glistp++, G_SHADE | G_SHADING_SMOOTH | G_LIGHTING | G_CULL_BACK | G_ZBUFFER); 82 | gDPSetRenderMode( 83 | glistp++, 84 | xlu ? G_RM_AA_ZB_XLU_DECAL : G_RM_AA_ZB_OPA_SURF, 85 | xlu ? G_RM_AA_ZB_XLU_DECAL2 : G_RM_AA_ZB_OPA_SURF2 86 | ); 87 | guPosition( 88 | &object->transform, 89 | vec3f_unpack(object->rot), 90 | object->scale, 91 | vec3f_unpack(object->pos) 92 | ); 93 | gSPMatrix(glistp++, &object->transform, G_MTX_MODELVIEW | G_MTX_PUSH | G_MTX_MUL); 94 | } 95 | 96 | void graphics_end_object() { 97 | gDPPipeSync(glistp++); 98 | gSPPopMatrix(glistp++, G_MTX_MODELVIEW); 99 | } 100 | -------------------------------------------------------------------------------- /src/collision.c: -------------------------------------------------------------------------------- 1 | #include "collision.h" 2 | 3 | // Get barycentric coordinates of P with respect to triangle ABC 4 | // p - Point to convert 5 | // a - Triangle vertex A 6 | // b - Triangle vertex B 7 | // c - Triangle vertex C 8 | // u - Output coordinate U 9 | // v - Output coordinate V 10 | // w - Output coordinate W 11 | void get_barycentric_coords(Vec3f p, Vec3f a, Vec3f b, Vec3f c, float* u, float* v, float* w) { 12 | Vec3f v0 = {b.x - a.x, b.y - a.y, b.z - a.z}; 13 | Vec3f v1 = {c.x - a.x, c.y - a.y, c.z - a.z}; 14 | Vec3f v2 = {p.x - a.x, p.y - a.y, p.z - a.z}; 15 | float d00 = vec3f_dot(v0, v0); 16 | float d01 = vec3f_dot(v0, v1); 17 | float d11 = vec3f_dot(v1, v1); 18 | float d20 = vec3f_dot(v2, v0); 19 | float d21 = vec3f_dot(v2, v1); 20 | float denom = d00 * d11 - d01 * d01; 21 | *v = (d11 * d20 - d01 * d21) / denom; 22 | *w = (d00 * d21 - d01 * d20) / denom; 23 | *u = 1.0f - *v - *w; 24 | } 25 | 26 | // Determine whether a 3D point lies within a 3D triangle 27 | // p - Point to test 28 | // v1 - Vertex 1 of the triangle 29 | // v2 - Vertex 2 of the triangle 30 | // v3 - Vertex 3 of the triangle 31 | bool point_in_triangle(Vec3f p, Vec3f v1, Vec3f v2, Vec3f v3) { 32 | float u, v, w; 33 | get_barycentric_coords(p, v1, v2, v3, &u, &v, &w); 34 | return u >= 0 && u <= 1 && 35 | v >= 0 && v <= 1 && 36 | w >= 0 && w <= 1; 37 | } 38 | 39 | // Determine whether a moving sphere intersects with a plane 40 | // If so, calculate the point of intersection and the normalized time of intersection 41 | // r - Sphere radius 42 | // pos1 - Current position of the sphere 43 | // pos2 - Next position of the sphere 44 | // plane - Plane to test the sphere against 45 | // hit - Point of collision output (pass NULL if irrelevant) 46 | // time - Normalized time of collision output (pass NULL if irrelevant) 47 | bool moving_sphere_plane_intersect(float r, Vec3f pos1, Vec3f pos2, Plane plane, Vec3f* hit, float* time) { 48 | float d1, d2; 49 | 50 | d1 = plane_distance_to_point(plane, pos1); 51 | d2 = plane_distance_to_point(plane, pos2); 52 | 53 | // Check if the current position is already intersecting 54 | if (fabs(d1) <= r) { 55 | *time = 0; 56 | *hit = pos1; 57 | return TRUE; 58 | } 59 | 60 | // Check if there will be an intersection during this movement 61 | if (d1 > r && d2 < r) { 62 | *time = (d1 - r) / (d1 - d2); 63 | hit->x = (1 - (*time)) * pos1.x + (*time) * pos2.x; 64 | hit->y = (1 - (*time)) * pos1.y + (*time) * pos2.y; 65 | hit->z = (1 - (*time)) * pos1.z + (*time) * pos2.z; 66 | return TRUE; 67 | } 68 | 69 | return FALSE; 70 | } 71 | 72 | // Determine whether a moving sphere intersects with a quad 73 | // If so, calculate the point of intersection and the normalized time of intersection 74 | // r - Sphere radius 75 | // pos1 - Current position of the sphere 76 | // pos2 - Next position of the sphere 77 | // p1 - Top left vertex of the quad 78 | // p2 - Top right vertex of the quad 79 | // p3 - Bottom left vertex of the quad 80 | // p4 - Bottom right vertex of the quad 81 | // hit - Point of collision output (pass NULL if irrelevant) 82 | // time - Normalized time of collision output (pass NULL if irrelevant) 83 | bool moving_sphere_quad_intersect(float r, Vec3f pos1, Vec3f pos2, Vec3f p1, Vec3f p2, Vec3f p3, Vec3f p4, Vec3f* hit, float* time) { 84 | Plane plane = plane_from_points(p1, p2, p3); 85 | Vec3f plane_hit; 86 | float plane_time; 87 | 88 | if (moving_sphere_plane_intersect(r, pos1, pos2, plane, &plane_hit, &plane_time)) { 89 | if (point_in_triangle(plane_hit, p1, p2, p3) || point_in_triangle(plane_hit, p2, p3, p4)) { 90 | *hit = plane_hit; 91 | *time = plane_time; 92 | return TRUE; 93 | } 94 | } 95 | 96 | return FALSE; 97 | } 98 | -------------------------------------------------------------------------------- /include/vector.h: -------------------------------------------------------------------------------- 1 | #ifndef VECTOR_H 2 | #define VECTOR_H 3 | 4 | #include 5 | 6 | // 2-dimensional vector 7 | typedef struct { 8 | float x, y; 9 | } Vec2f; 10 | 11 | // 3-dimensional vector 12 | typedef struct { 13 | float x, y, z; 14 | } Vec3f; 15 | 16 | // 4-dimensional vector 17 | typedef struct { 18 | float x, y, z, w; 19 | } Vec4f; 20 | 21 | // Set values 22 | #define vec2f_set(dst, nx, ny) { \ 23 | (dst).x = (nx); \ 24 | (dst).y = (ny); \ 25 | } 26 | 27 | // Set values 28 | #define vec3f_set(dst, nx, ny, nz) { \ 29 | (dst).x = (nx); \ 30 | (dst).y = (ny); \ 31 | (dst).z = (nz); \ 32 | } 33 | 34 | // Set values 35 | #define vec4f_set(dst, nx, ny, nz, nw) { \ 36 | (dst).x = (nx); \ 37 | (dst).y = (ny); \ 38 | (dst).z = (nz); \ 39 | (dst).w = (nw); \ 40 | } 41 | 42 | // Copy src to dst 43 | #define vec2f_copy(dst, src) { \ 44 | (dst).x = (src).x; \ 45 | (dst).y = (src).y; \ 46 | } 47 | 48 | // Copy src to dst 49 | #define vec3f_copy(dst, src) { \ 50 | (dst).x = (src).x; \ 51 | (dst).y = (src).y; \ 52 | (dst).z = (src).z; \ 53 | } 54 | 55 | // Copy src to dst 56 | #define vec4f_copy(dst, src) { \ 57 | (dst).x = (src).x; \ 58 | (dst).y = (src).y; \ 59 | (dst).z = (src).z; \ 60 | (dst).w = (src).w; \ 61 | } 62 | 63 | // Add src to dst 64 | #define vec2f_add(dst, src) { \ 65 | (dst).x += (src).x; \ 66 | (dst).y += (src).y; \ 67 | } 68 | 69 | // Add src to dst 70 | #define vec3f_add(dst, src) { \ 71 | (dst).x += (src).x; \ 72 | (dst).y += (src).y; \ 73 | (dst).z += (src).z; \ 74 | } 75 | 76 | // Add src to dst 77 | #define vec4f_add(dst, src) { \ 78 | (dst).x += (src).x; \ 79 | (dst).y += (src).y; \ 80 | (dst).z += (src).z; \ 81 | (dst).w += (src).w; \ 82 | } 83 | 84 | // Multiply dst by src 85 | #define vec2f_mul(dst, src) { \ 86 | (dst).x *= (src).x; \ 87 | (dst).y *= (src).y; \ 88 | } 89 | 90 | // Multiply dst by src 91 | #define vec3f_mul(dst, src) { \ 92 | (dst).x *= (src).x; \ 93 | (dst).y *= (src).y; \ 94 | (dst).z *= (src).z; \ 95 | } 96 | 97 | // Multiply dst by src 98 | #define vec4f_mul(dst, src) { \ 99 | (dst).x *= (src).x; \ 100 | (dst).y *= (src).y; \ 101 | (dst).z *= (src).z; \ 102 | (dst).w *= (src).w; \ 103 | } 104 | 105 | // Multiply dst by a constant 106 | #define vec2f_mag(dst, mag) { \ 107 | (dst).x *= (mag); \ 108 | (dst).y *= (mag); \ 109 | } 110 | 111 | // Multiply dst by a constant 112 | #define vec3f_mag(dst, mag) { \ 113 | (dst).x *= (mag); \ 114 | (dst).y *= (mag); \ 115 | (dst).z *= (mag); \ 116 | } 117 | 118 | // Multiply dst by a constant 119 | #define vec4f_mag(dst, mag) { \ 120 | (dst).x *= (mag); \ 121 | (dst).y *= (mag); \ 122 | (dst).z *= (mag); \ 123 | (dst).w *= (mag); \ 124 | } 125 | 126 | // Calculate the dot product of a and b 127 | #define vec2f_dot(a, b) ((a).x * (b).x + (a).y * (b).y) 128 | #define vec3f_dot(a, b) ((a).x * (b).x + (a).y * (b).y + (a).z * (b).z) 129 | #define vec4f_dot(a, b) ((a).x * (b).x + (a).y * (b).y + (a).z * (b).z + (a).w * (b).w) 130 | 131 | // Set dst to the cross product of a and b 132 | #define vec3f_cross(dst, a, b) { \ 133 | (dst).x = (a).y * (b).z - (a).z * (b).y; \ 134 | (dst).y = (a).z * (b).x - (a).x * (b).z; \ 135 | (dst).z = (a).x * (b).y - (a).y * (b).x; \ 136 | } 137 | 138 | // Normalize dst in place 139 | #define vec3f_norm(dst) { \ 140 | float len = sqrt(((dst).x * (dst).x) + ((dst).y * (dst).y) + ((dst).z * (dst).z)); \ 141 | (dst).x /= len; \ 142 | (dst).y /= len; \ 143 | (dst).z /= len; \ 144 | } 145 | 146 | // Unpack src 147 | #define vec2f_unpack(src) (src).x, (src).y 148 | #define vec3f_unpack(src) (src).x, (src).y, (src).z 149 | #define vec4f_unpack(src) (src).x, (src).y, (src).z, (src).w 150 | 151 | #endif 152 | -------------------------------------------------------------------------------- /src/camera.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "common.h" 3 | #include "vector.h" 4 | #include "camera.h" 5 | #include "graphics.h" 6 | 7 | #define PERSPECTIVE 0.6f 8 | 9 | // Global camera 10 | Camera camera; 11 | 12 | // Recalculate orientation vectors 13 | static void recalc_orientation() { 14 | // Calculate front vector 15 | vec3f_set( 16 | camera.front, 17 | cos(radians(camera.yaw)) * cos(radians(camera.pitch)), 18 | sin(radians(camera.pitch)), 19 | sin(radians(camera.yaw)) * cos(radians(camera.pitch)) 20 | ); 21 | vec3f_norm(camera.front); 22 | 23 | // Calculate forward vector 24 | vec3f_set( 25 | camera.forward, 26 | cos(radians(camera.yaw)), 27 | 0, 28 | sin(radians(camera.yaw)) 29 | ); 30 | vec3f_norm(camera.forward); 31 | 32 | // Calculate right vector 33 | vec3f_cross(camera.right, camera.front, camera.world_up); 34 | vec3f_norm(camera.right); 35 | 36 | // Calculate up vector 37 | vec3f_cross(camera.up, camera.right, camera.front); 38 | vec3f_norm(camera.up); 39 | } 40 | 41 | void camera_init() { 42 | // Initialize field of view 43 | // camera.fov = 60.0f + (PERSPECTIVE * 60.0f); 44 | camera.fov = 90; 45 | // camera.fov = 120; 46 | 47 | // Initialize camera position 48 | // vec3f_set(camera.pos, 0, 0, 1300 + (1.0f - PERSPECTIVE) * 650.0f); 49 | vec3f_set(camera.pos, 0, 0, 1450); 50 | // vec3f_set(camera.pos, 0, 0, 1350); 51 | 52 | // Initialize world_up vector 53 | vec3f_set(camera.world_up, 0, 1, 0); 54 | 55 | // Initialize camera rotation 56 | camera.pitch = 0; 57 | camera.yaw = -90; 58 | 59 | recalc_orientation(); 60 | } 61 | 62 | // Move the camera in a particular direction 63 | void camera_move(Vec3f velocity) { 64 | Vec3f move_forward; 65 | Vec3f move_right; 66 | Vec3f move_up; 67 | 68 | vec3f_copy(move_right, camera.right); 69 | vec3f_mag(move_right, velocity.x); 70 | 71 | vec3f_copy(move_up, camera.world_up); 72 | vec3f_mag(move_up, velocity.y); 73 | 74 | vec3f_copy(move_forward, camera.forward); 75 | vec3f_mag(move_forward, velocity.z); 76 | 77 | vec3f_add(camera.pos, move_right); 78 | vec3f_add(camera.pos, move_up); 79 | vec3f_add(camera.pos, move_forward); 80 | } 81 | 82 | // Move the camera to a given position 83 | void camera_move_to(Vec3f pos) { 84 | vec3f_copy(camera.pos, pos); 85 | } 86 | 87 | // Rotate the camera by a given amount of degrees 88 | void camera_rotate(Vec2f rot) { 89 | camera.yaw += rot.x; 90 | camera.pitch += rot.y; 91 | recalc_orientation(); 92 | } 93 | 94 | void camera_rotate_to(Vec2f rot) { 95 | camera.yaw = rot.x - 90; 96 | camera.pitch = rot.y; 97 | recalc_orientation(); 98 | } 99 | 100 | void camera_look(MVP* mvpp) { 101 | u16 persp_norm; 102 | 103 | // Initialize the projection matrix 104 | guPerspective( 105 | &mvpp->projection, 106 | &persp_norm, 107 | camera.fov, 108 | (float)SCREEN_W / (float)SCREEN_H, 109 | 10, 110 | 10000, 111 | 1.0 112 | ); 113 | gSPPerspNormalize(glistp++, persp_norm); 114 | 115 | // Calculate where to look 116 | vec3f_copy(camera.target, camera.pos); 117 | vec3f_add(camera.target, camera.front); 118 | 119 | // Initialize the model view matrix 120 | guLookAt( 121 | &mvpp->modelview, 122 | vec3f_unpack(camera.pos), 123 | vec3f_unpack(camera.target), 124 | vec3f_unpack(camera.up) 125 | ); 126 | 127 | // Load the projection matrix into the matrix stack 128 | gSPMatrix( 129 | glistp++, 130 | OS_K0_TO_PHYSICAL(&(mvpp->projection)), 131 | G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH 132 | ); 133 | 134 | // Load the model view matrix into the matrix stack 135 | gSPMatrix( 136 | glistp++, 137 | OS_K0_TO_PHYSICAL(&(mvpp->modelview)), 138 | G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH 139 | ); 140 | } 141 | -------------------------------------------------------------------------------- /src/level.c: -------------------------------------------------------------------------------- 1 | #include "level.h" 2 | #include "common.h" 3 | #include "brick.h" 4 | #include 5 | 6 | // Load a level from the given params 7 | Level level_load(LevelData* data) { 8 | Level level; 9 | int x, y, z; 10 | 11 | level.start_vel = data->start_vel; 12 | level.width = data->width; 13 | level.height = data->height; 14 | level.depth = data->depth; 15 | level.num_bricks = level.width * level.height * level.depth; 16 | level.bricks = (Brick*)malloc(sizeof(Brick) * data->width * data->height * data->depth); 17 | 18 | // Initialize bricks 19 | for (z = 0; z < level.depth; z++) { 20 | for (y = 0; y < level.height; y++) { 21 | for (x = 0; x < level.width; x++) { 22 | int i = flatten3D(x, y, z, level.width, level.height); 23 | float left, right, top, bottom, back, front; 24 | 25 | vec3f_set( 26 | level.bricks[i].obj.pos, 27 | -(level.width * BRICK_R - BRICK_R) + x * BRICK_W, 28 | -(level.height * BRICK_R - BRICK_R) + y * BRICK_W, 29 | -(z * BRICK_W) 30 | ); 31 | 32 | vec3f_set(level.bricks[i].obj.rot, 0, 0, 0); 33 | level.bricks[i].obj.scale = 1; 34 | 35 | // Precalculate face quads for easier collision detection 36 | left = level.bricks[i].obj.pos.x - BRICK_R; 37 | right = level.bricks[i].obj.pos.x + BRICK_R; 38 | top = level.bricks[i].obj.pos.y + BRICK_R; 39 | bottom = level.bricks[i].obj.pos.y - BRICK_R; 40 | back = level.bricks[i].obj.pos.z - BRICK_R; 41 | front = level.bricks[i].obj.pos.z + BRICK_R; 42 | 43 | // Left face 44 | vec3f_set(level.bricks[i].left[0], left, top, back); 45 | vec3f_set(level.bricks[i].left[1], left, top, front); 46 | vec3f_set(level.bricks[i].left[2], left, bottom, back); 47 | vec3f_set(level.bricks[i].left[3], left, bottom, front); 48 | 49 | // Right face 50 | vec3f_set(level.bricks[i].right[0], right, top, front); 51 | vec3f_set(level.bricks[i].right[1], right, top, back); 52 | vec3f_set(level.bricks[i].right[2], right, bottom, front); 53 | vec3f_set(level.bricks[i].right[3], right, bottom, back); 54 | 55 | // Top face 56 | vec3f_set(level.bricks[i].top[0], left, top, back); 57 | vec3f_set(level.bricks[i].top[1], right, top, back); 58 | vec3f_set(level.bricks[i].top[2], left, top, front); 59 | vec3f_set(level.bricks[i].top[3], right, top, front); 60 | 61 | // Bottom face 62 | vec3f_set(level.bricks[i].bottom[0], left, bottom, front); 63 | vec3f_set(level.bricks[i].bottom[1], right, bottom, front); 64 | vec3f_set(level.bricks[i].bottom[2], left, bottom, back); 65 | vec3f_set(level.bricks[i].bottom[3], right, bottom, back); 66 | 67 | // Back face 68 | vec3f_set(level.bricks[i].back[0], right, top, back); 69 | vec3f_set(level.bricks[i].back[1], left, top, back); 70 | vec3f_set(level.bricks[i].back[2], right, bottom, back); 71 | vec3f_set(level.bricks[i].back[3], left, bottom, back); 72 | 73 | // Front face 74 | vec3f_set(level.bricks[i].front[0], left, top, front); 75 | vec3f_set(level.bricks[i].front[1], right, top, front); 76 | vec3f_set(level.bricks[i].front[2], left, bottom, front); 77 | vec3f_set(level.bricks[i].front[3], right, bottom, front); 78 | 79 | level.bricks[i].lives = data->bricks[i]; 80 | 81 | if (level.bricks[i].lives > 0) { 82 | level.bricks[i].death_anim_timer = BRICK_DEATH_ANIM_DURATION; 83 | } 84 | 85 | // Store pointers to neighbouring cubes for easier access to them 86 | if (x > 0) { 87 | level.bricks[i].neighbours[SIDE_LEFT] = &level.bricks[flatten3D(x - 1, y, z, level.width, level.height)]; 88 | } else { 89 | level.bricks[i].neighbours[SIDE_LEFT] = NULL; 90 | } 91 | if (x < level.width - 1) { 92 | level.bricks[i].neighbours[SIDE_RIGHT] = &level.bricks[flatten3D(x + 1, y, z, level.width, level.height)]; 93 | } else { 94 | level.bricks[i].neighbours[SIDE_RIGHT] = NULL; 95 | } 96 | if (y > 0) { 97 | level.bricks[i].neighbours[SIDE_BOTTOM] = &level.bricks[flatten3D(x, y - 1, z, level.width, level.height)]; 98 | } else { 99 | level.bricks[i].neighbours[SIDE_BOTTOM] = NULL; 100 | } 101 | if (y < level.height - 1) { 102 | level.bricks[i].neighbours[SIDE_TOP] = &level.bricks[flatten3D(x, y + 1, z, level.width, level.height)]; 103 | } else { 104 | level.bricks[i].neighbours[SIDE_TOP] = NULL; 105 | } 106 | if (z > 0) { 107 | level.bricks[i].neighbours[SIDE_BACK] = &level.bricks[flatten3D(x, y, z - 1, level.width, level.height)]; 108 | } else { 109 | level.bricks[i].neighbours[SIDE_BACK] = NULL; 110 | } 111 | if (z < level.depth - 1) { 112 | level.bricks[i].neighbours[SIDE_FRONT] = &level.bricks[flatten3D(x, y, z + 1, level.width, level.height)]; 113 | } else { 114 | level.bricks[i].neighbours[SIDE_FRONT] = NULL; 115 | } 116 | } 117 | } 118 | } 119 | 120 | // Precalculate level bounds 121 | level.bounds[SIDE_LEFT] = -level.width * BRICK_W / 2; 122 | level.bounds[SIDE_RIGHT] = level.width * BRICK_W / 2; 123 | level.bounds[SIDE_TOP] = level.height * BRICK_W / 2; 124 | level.bounds[SIDE_BOTTOM] = -level.height * BRICK_W / 2; 125 | level.bounds[SIDE_BACK] = -level.width * BRICK_W / 2; 126 | level.bounds[SIDE_FRONT] = level.width * BRICK_W; 127 | 128 | // Precalculate wall planes 129 | { 130 | Vec3f left[] = { 131 | {level.bounds[SIDE_LEFT], level.bounds[SIDE_TOP], level.bounds[SIDE_FRONT]}, 132 | {level.bounds[SIDE_LEFT], level.bounds[SIDE_TOP], level.bounds[SIDE_BACK]}, 133 | {level.bounds[SIDE_LEFT], level.bounds[SIDE_BOTTOM], level.bounds[SIDE_FRONT]} 134 | }; 135 | Vec3f right[] = { 136 | {level.bounds[SIDE_RIGHT], level.bounds[SIDE_TOP], level.bounds[SIDE_BACK]}, 137 | {level.bounds[SIDE_RIGHT], level.bounds[SIDE_TOP], level.bounds[SIDE_FRONT]}, 138 | {level.bounds[SIDE_RIGHT], level.bounds[SIDE_BOTTOM], level.bounds[SIDE_BACK]} 139 | }; 140 | Vec3f top[] = { 141 | {level.bounds[SIDE_LEFT], level.bounds[SIDE_TOP], level.bounds[SIDE_FRONT]}, 142 | {level.bounds[SIDE_RIGHT], level.bounds[SIDE_TOP], level.bounds[SIDE_FRONT]}, 143 | {level.bounds[SIDE_LEFT], level.bounds[SIDE_TOP], level.bounds[SIDE_BACK]} 144 | }; 145 | Vec3f bottom[] = { 146 | {level.bounds[SIDE_LEFT], level.bounds[SIDE_BOTTOM], level.bounds[SIDE_BACK]}, 147 | {level.bounds[SIDE_RIGHT], level.bounds[SIDE_BOTTOM], level.bounds[SIDE_BACK]}, 148 | {level.bounds[SIDE_LEFT], level.bounds[SIDE_BOTTOM], level.bounds[SIDE_FRONT]} 149 | }; 150 | Vec3f front[] = { 151 | {level.bounds[SIDE_RIGHT], level.bounds[SIDE_TOP], level.bounds[SIDE_FRONT]}, 152 | {level.bounds[SIDE_LEFT], level.bounds[SIDE_TOP], level.bounds[SIDE_FRONT]}, 153 | {level.bounds[SIDE_RIGHT], level.bounds[SIDE_BOTTOM], level.bounds[SIDE_FRONT]} 154 | }; 155 | Vec3f back[] = { 156 | {level.bounds[SIDE_LEFT], level.bounds[SIDE_TOP], level.bounds[SIDE_BACK]}, 157 | {level.bounds[SIDE_RIGHT], level.bounds[SIDE_TOP], level.bounds[SIDE_BACK]}, 158 | {level.bounds[SIDE_LEFT], level.bounds[SIDE_BOTTOM], level.bounds[SIDE_BACK]} 159 | }; 160 | 161 | level.walls[SIDE_LEFT] = plane_from_points(left[0], left[1], left[2]); 162 | level.walls[SIDE_RIGHT] = plane_from_points(right[0], right[1], right[2]); 163 | level.walls[SIDE_TOP] = plane_from_points(top[0], top[1], top[2]); 164 | level.walls[SIDE_BOTTOM] = plane_from_points(bottom[0], bottom[1], bottom[2]); 165 | level.walls[SIDE_FRONT] = plane_from_points(front[0], front[1], front[2]); 166 | level.walls[SIDE_BACK] = plane_from_points(back[0], back[1], back[2]); 167 | } 168 | 169 | return level; 170 | } 171 | 172 | // Destroy a level and free its allocated memory 173 | void level_destroy(Level* level) { 174 | free(level->bricks); 175 | } 176 | -------------------------------------------------------------------------------- /data/models/stage.h: -------------------------------------------------------------------------------- 1 | Vtx stage_Cube_mesh_vtx_cull[8] = { 2 | {{{-400, -400, -100},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 3 | {{{-400, -400, 400},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 4 | {{{-400, 400, 400},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 5 | {{{-400, 400, -100},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 6 | {{{400, -400, -100},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 7 | {{{400, -400, 400},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 8 | {{{400, 400, 400},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 9 | {{{400, 400, -100},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 10 | }; 11 | 12 | Vtx stage_Cube_mesh_vtx_0[73] = { 13 | {{{-100, -100, 204},0, {368, 1008},{0x7F, 0x0, 0x0, 0xFF}}}, 14 | {{{-100, -100, -100},0, {368, 752},{0x7F, 0x0, 0x0, 0xFF}}}, 15 | {{{-100, 100, -100},0, {624, 752},{0x7F, 0x0, 0x0, 0xFF}}}, 16 | {{{-100, 100, 204},0, {624, 1008},{0x7F, 0x0, 0x0, 0xFF}}}, 17 | {{{-100, -100, -100},0, {368, 752},{0x0, 0x0, 0x7F, 0xFF}}}, 18 | {{{100, -100, -100},0, {368, 496},{0x0, 0x0, 0x7F, 0xFF}}}, 19 | {{{100, 100, -100},0, {624, 496},{0x0, 0x0, 0x7F, 0xFF}}}, 20 | {{{-100, 100, -100},0, {624, 752},{0x0, 0x0, 0x7F, 0xFF}}}, 21 | {{{100, -100, -100},0, {368, 496},{0x81, 0x0, 0x0, 0xFF}}}, 22 | {{{100, -100, 204},0, {368, 240},{0x81, 0x0, 0x0, 0xFF}}}, 23 | {{{100, 100, 204},0, {624, 240},{0x81, 0x0, 0x0, 0xFF}}}, 24 | {{{100, 100, -100},0, {624, 496},{0x81, 0x0, 0x0, 0xFF}}}, 25 | {{{-100, -100, -100},0, {112, 496},{0x0, 0x7F, 0x0, 0xFF}}}, 26 | {{{-100, -100, 204},0, {112, 240},{0x0, 0x7F, 0x0, 0xFF}}}, 27 | {{{100, -100, 204},0, {368, 240},{0x0, 0x7F, 0x0, 0xFF}}}, 28 | {{{100, -100, -100},0, {368, 496},{0x0, 0x7F, 0x0, 0xFF}}}, 29 | {{{100, 100, -100},0, {624, 496},{0x0, 0x81, 0x0, 0xFF}}}, 30 | {{{100, 100, 204},0, {624, 240},{0x0, 0x81, 0x0, 0xFF}}}, 31 | {{{-100, 100, 204},0, {880, 240},{0x0, 0x81, 0x0, 0xFF}}}, 32 | {{{-100, 100, -100},0, {880, 496},{0x0, 0x81, 0x0, 0xFF}}}, 33 | {{{-100, 100, 204},0, {624, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 34 | {{{-100, -100, 204},0, {368, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 35 | {{{-100, -100, 204},0, {368, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 36 | {{{100, 100, 204},0, {624, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 37 | {{{-100, 100, 204},0, {880, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 38 | {{{-100, 100, 204},0, {880, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 39 | {{{100, -100, 204},0, {368, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 40 | {{{-100, -100, 204},0, {112, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 41 | {{{-100, -100, 204},0, {112, 240},{0x0, 0x46, 0x6A, 0xFF}}}, 42 | {{{-400, -400, 400},0, {112, 240},{0x0, 0x46, 0x6A, 0xFF}}}, 43 | {{{400, -400, 400},0, {368, 240},{0x0, 0x46, 0x6A, 0xFF}}}, 44 | {{{100, -100, 204},0, {368, 240},{0x0, 0x46, 0x6A, 0xFF}}}, 45 | {{{-100, -100, 204},0, {-16, 1008},{0xBA, 0x0, 0x96, 0xFF}}}, 46 | {{{-400, -400, 400},0, {-16, 1008},{0xBA, 0x0, 0x96, 0xFF}}}, 47 | {{{-400, 400, 400},0, {-16, 1008},{0xBA, 0x0, 0x96, 0xFF}}}, 48 | {{{-100, 100, 204},0, {-16, 1008},{0xBA, 0x0, 0x96, 0xFF}}}, 49 | {{{100, -100, 204},0, {-16, 1008},{0x0, 0xBA, 0x96, 0xFF}}}, 50 | {{{400, -400, 400},0, {-16, 1008},{0x0, 0xBA, 0x96, 0xFF}}}, 51 | {{{-400, -400, 400},0, {-16, 1008},{0x0, 0xBA, 0x96, 0xFF}}}, 52 | {{{-100, -100, 204},0, {-16, 1008},{0x0, 0xBA, 0x96, 0xFF}}}, 53 | {{{100, -100, 204},0, {368, 240},{0xBA, 0x0, 0x6A, 0xFF}}}, 54 | {{{400, -400, 400},0, {368, 240},{0xBA, 0x0, 0x6A, 0xFF}}}, 55 | {{{400, 400, 400},0, {624, 240},{0xBA, 0x0, 0x6A, 0xFF}}}, 56 | {{{100, 100, 204},0, {624, 240},{0xBA, 0x0, 0x6A, 0xFF}}}, 57 | {{{-400, 400, 400},0, {624, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 58 | {{{-400, 400, 400},0, {624, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 59 | {{{-400, -400, 400},0, {368, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 60 | {{{-400, -400, 400},0, {112, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 61 | {{{-400, -400, 400},0, {112, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 62 | {{{400, -400, 400},0, {368, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 63 | {{{400, 400, 400},0, {624, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 64 | {{{-400, 400, 400},0, {880, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 65 | {{{-100, 100, 204},0, {624, 1008},{0x46, 0x0, 0x6A, 0xFF}}}, 66 | {{{-400, 400, 400},0, {624, 1008},{0x46, 0x0, 0x6A, 0xFF}}}, 67 | {{{-400, -400, 400},0, {368, 1008},{0x46, 0x0, 0x6A, 0xFF}}}, 68 | {{{-100, -100, 204},0, {368, 1008},{0x46, 0x0, 0x6A, 0xFF}}}, 69 | {{{-100, 100, 204},0, {-16, 1008},{0x0, 0x46, 0x96, 0xFF}}}, 70 | {{{-400, 400, 400},0, {-16, 1008},{0x0, 0x46, 0x96, 0xFF}}}, 71 | {{{400, 400, 400},0, {-16, 1008},{0x0, 0x46, 0x96, 0xFF}}}, 72 | {{{100, 100, 204},0, {-16, 1008},{0x0, 0x46, 0x96, 0xFF}}}, 73 | {{{100, 100, 204},0, {-16, 1008},{0x46, 0x0, 0x96, 0xFF}}}, 74 | {{{400, 400, 400},0, {-16, 1008},{0x46, 0x0, 0x96, 0xFF}}}, 75 | {{{400, -400, 400},0, {-16, 1008},{0x46, 0x0, 0x96, 0xFF}}}, 76 | {{{100, -100, 204},0, {-16, 1008},{0x46, 0x0, 0x96, 0xFF}}}, 77 | {{{100, 100, 204},0, {624, 240},{0x0, 0xBA, 0x6A, 0xFF}}}, 78 | {{{400, 400, 400},0, {624, 240},{0x0, 0xBA, 0x6A, 0xFF}}}, 79 | {{{-400, 400, 400},0, {880, 240},{0x0, 0xBA, 0x6A, 0xFF}}}, 80 | {{{-100, 100, 204},0, {880, 240},{0x0, 0xBA, 0x6A, 0xFF}}}, 81 | {{{-100, -100, 204},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 82 | {{{-100, 100, 204},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 83 | {{{-100, 100, 204},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 84 | {{{100, -100, 204},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 85 | {{{100, 100, 204},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 86 | }; 87 | 88 | Gfx stage_Cube_mesh_tri_0[] = { 89 | gsSPVertex(stage_Cube_mesh_vtx_0 + 0, 32, 0), 90 | gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0), 91 | gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0), 92 | gsSP2Triangles(8, 9, 10, 0, 8, 10, 11, 0), 93 | gsSP2Triangles(12, 13, 14, 0, 12, 14, 15, 0), 94 | gsSP2Triangles(16, 17, 18, 0, 16, 18, 19, 0), 95 | gsSP2Triangles(20, 21, 22, 0, 20, 20, 21, 0), 96 | gsSP2Triangles(20, 21, 21, 0, 20, 20, 21, 0), 97 | gsSP2Triangles(20, 21, 21, 0, 20, 20, 21, 0), 98 | gsSP2Triangles(20, 21, 21, 0, 20, 20, 21, 0), 99 | gsSP2Triangles(23, 24, 25, 0, 23, 23, 24, 0), 100 | gsSP2Triangles(26, 23, 23, 0, 26, 26, 23, 0), 101 | gsSP2Triangles(27, 26, 26, 0, 27, 27, 26, 0), 102 | gsSP2Triangles(27, 26, 26, 0, 27, 27, 26, 0), 103 | gsSP2Triangles(27, 26, 26, 0, 27, 27, 26, 0), 104 | gsSP2Triangles(27, 26, 26, 0, 27, 27, 26, 0), 105 | gsSP2Triangles(26, 26, 23, 0, 26, 23, 23, 0), 106 | gsSP2Triangles(23, 23, 24, 0, 23, 24, 24, 0), 107 | gsSP2Triangles(23, 23, 24, 0, 23, 24, 24, 0), 108 | gsSP2Triangles(23, 23, 24, 0, 23, 24, 24, 0), 109 | gsSP2Triangles(26, 23, 23, 0, 26, 26, 23, 0), 110 | gsSP2Triangles(26, 23, 23, 0, 26, 26, 23, 0), 111 | gsSP2Triangles(28, 29, 30, 0, 28, 30, 31, 0), 112 | gsSPVertex(stage_Cube_mesh_vtx_0 + 32, 32, 0), 113 | gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0), 114 | gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0), 115 | gsSP2Triangles(8, 9, 10, 0, 8, 10, 11, 0), 116 | gsSP2Triangles(12, 13, 14, 0, 12, 14, 14, 0), 117 | gsSP2Triangles(15, 16, 17, 0, 15, 17, 17, 0), 118 | gsSP2Triangles(17, 17, 18, 0, 17, 18, 18, 0), 119 | gsSP2Triangles(18, 18, 19, 0, 18, 19, 19, 0), 120 | gsSP2Triangles(20, 21, 22, 0, 20, 22, 23, 0), 121 | gsSP2Triangles(24, 25, 26, 0, 24, 26, 27, 0), 122 | gsSP2Triangles(28, 29, 30, 0, 28, 30, 31, 0), 123 | gsSPVertex(stage_Cube_mesh_vtx_0 + 64, 9, 0), 124 | gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0), 125 | gsSP2Triangles(4, 5, 6, 0, 4, 4, 5, 0), 126 | gsSP2Triangles(7, 4, 4, 0, 7, 7, 4, 0), 127 | gsSP2Triangles(8, 7, 7, 0, 8, 8, 7, 0), 128 | gsSP2Triangles(5, 8, 8, 0, 5, 5, 8, 0), 129 | gsSP2Triangles(5, 8, 8, 0, 5, 5, 8, 0), 130 | gsSP2Triangles(4, 5, 5, 0, 4, 4, 5, 0), 131 | gsSP2Triangles(7, 4, 4, 0, 7, 7, 4, 0), 132 | gsSP2Triangles(8, 7, 7, 0, 8, 8, 7, 0), 133 | gsSP2Triangles(8, 7, 7, 0, 8, 8, 7, 0), 134 | gsSP2Triangles(5, 8, 8, 0, 5, 5, 8, 0), 135 | gsSP2Triangles(4, 5, 5, 0, 4, 4, 5, 0), 136 | gsSP2Triangles(7, 4, 4, 0, 7, 7, 4, 0), 137 | gsSP2Triangles(7, 4, 4, 0, 7, 7, 4, 0), 138 | gsSP2Triangles(8, 7, 7, 0, 8, 8, 7, 0), 139 | gsSP2Triangles(5, 8, 8, 0, 5, 5, 8, 0), 140 | gsSP2Triangles(4, 5, 5, 0, 4, 4, 5, 0), 141 | gsSPEndDisplayList(), 142 | }; 143 | 144 | 145 | Gfx mat_stage_Material_001_f3d[] = { 146 | gsDPPipeSync(), 147 | gsDPSetCombineLERP(0, 0, 0, 0, 0, 0, 0, ENVIRONMENT, 0, 0, 0, 0, 0, 0, 0, ENVIRONMENT), 148 | gsSPClearGeometryMode(G_SHADE | G_SHADING_SMOOTH), 149 | gsSPTexture(65535, 65535, 0, 0, 1), 150 | gsSPEndDisplayList(), 151 | }; 152 | 153 | Gfx mat_revert_stage_Material_001_f3d[] = { 154 | gsDPPipeSync(), 155 | gsSPSetGeometryMode(G_SHADE | G_SHADING_SMOOTH), 156 | gsSPEndDisplayList(), 157 | }; 158 | 159 | 160 | Gfx stage_Cube_mesh[] = { 161 | gsSPClearGeometryMode(G_LIGHTING), 162 | gsSPVertex(stage_Cube_mesh_vtx_cull + 0, 8, 0), 163 | gsSPSetGeometryMode(G_LIGHTING), 164 | gsSPCullDisplayList(0, 7), 165 | gsSPDisplayList(mat_stage_Material_001_f3d), 166 | gsSPDisplayList(stage_Cube_mesh_tri_0), 167 | gsSPDisplayList(mat_revert_stage_Material_001_f3d), 168 | gsDPPipeSync(), 169 | gsSPSetGeometryMode(G_LIGHTING), 170 | gsSPClearGeometryMode(G_TEXTURE_GEN), 171 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 172 | gsSPTexture(65535, 65535, 0, 0, 0), 173 | gsSPEndDisplayList(), 174 | }; 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /data/models/stage_opa.h: -------------------------------------------------------------------------------- 1 | Lights2 stage_opa_Material_001_f3d_lights = gdSPDefLights2( 2 | 0x2F, 0x2F, 0x2F, 3 | 0xFE, 0xFE, 0xFE, 0xf8, 0x14, 0x0, 4 | 0xFE, 0xFE, 0xFE, 0x13, 0x0, 0x80 5 | ); 6 | 7 | Vtx stage_opa_Cube_mesh_vtx_cull[8] = { 8 | {{{-400, -400, -100},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 9 | {{{-400, -400, 400},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 10 | {{{-400, 400, 400},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 11 | {{{-400, 400, -100},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 12 | {{{400, -400, -100},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 13 | {{{400, -400, 400},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 14 | {{{400, 400, 400},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 15 | {{{400, 400, -100},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 16 | }; 17 | 18 | Vtx stage_opa_Cube_mesh_vtx_0[73] = { 19 | {{{-100, -100, 204},0, {368, 1008},{0x7F, 0x0, 0x0, 0xFF}}}, 20 | {{{-100, -100, -100},0, {368, 752},{0x7F, 0x0, 0x0, 0xFF}}}, 21 | {{{-100, 100, -100},0, {624, 752},{0x7F, 0x0, 0x0, 0xFF}}}, 22 | {{{-100, 100, 204},0, {624, 1008},{0x7F, 0x0, 0x0, 0xFF}}}, 23 | {{{-100, -100, -100},0, {368, 752},{0x0, 0x0, 0x7F, 0xFF}}}, 24 | {{{100, -100, -100},0, {368, 496},{0x0, 0x0, 0x7F, 0xFF}}}, 25 | {{{100, 100, -100},0, {624, 496},{0x0, 0x0, 0x7F, 0xFF}}}, 26 | {{{-100, 100, -100},0, {624, 752},{0x0, 0x0, 0x7F, 0xFF}}}, 27 | {{{100, -100, -100},0, {368, 496},{0x81, 0x0, 0x0, 0xFF}}}, 28 | {{{100, -100, 204},0, {368, 240},{0x81, 0x0, 0x0, 0xFF}}}, 29 | {{{100, 100, 204},0, {624, 240},{0x81, 0x0, 0x0, 0xFF}}}, 30 | {{{100, 100, -100},0, {624, 496},{0x81, 0x0, 0x0, 0xFF}}}, 31 | {{{-100, -100, -100},0, {112, 496},{0x0, 0x7F, 0x0, 0xFF}}}, 32 | {{{-100, -100, 204},0, {112, 240},{0x0, 0x7F, 0x0, 0xFF}}}, 33 | {{{100, -100, 204},0, {368, 240},{0x0, 0x7F, 0x0, 0xFF}}}, 34 | {{{100, -100, -100},0, {368, 496},{0x0, 0x7F, 0x0, 0xFF}}}, 35 | {{{100, 100, -100},0, {624, 496},{0x0, 0x81, 0x0, 0xFF}}}, 36 | {{{100, 100, 204},0, {624, 240},{0x0, 0x81, 0x0, 0xFF}}}, 37 | {{{-100, 100, 204},0, {880, 240},{0x0, 0x81, 0x0, 0xFF}}}, 38 | {{{-100, 100, -100},0, {880, 496},{0x0, 0x81, 0x0, 0xFF}}}, 39 | {{{-100, 100, 204},0, {624, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 40 | {{{-100, -100, 204},0, {368, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 41 | {{{-100, -100, 204},0, {368, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 42 | {{{100, 100, 204},0, {624, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 43 | {{{-100, 100, 204},0, {880, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 44 | {{{-100, 100, 204},0, {880, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 45 | {{{100, -100, 204},0, {368, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 46 | {{{-100, -100, 204},0, {112, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 47 | {{{-100, -100, 204},0, {112, 240},{0x0, 0x46, 0x6A, 0xFF}}}, 48 | {{{-400, -400, 400},0, {112, 240},{0x0, 0x46, 0x6A, 0xFF}}}, 49 | {{{400, -400, 400},0, {368, 240},{0x0, 0x46, 0x6A, 0xFF}}}, 50 | {{{100, -100, 204},0, {368, 240},{0x0, 0x46, 0x6A, 0xFF}}}, 51 | {{{-100, -100, 204},0, {-16, 1008},{0xBA, 0x0, 0x96, 0xFF}}}, 52 | {{{-400, -400, 400},0, {-16, 1008},{0xBA, 0x0, 0x96, 0xFF}}}, 53 | {{{-400, 400, 400},0, {-16, 1008},{0xBA, 0x0, 0x96, 0xFF}}}, 54 | {{{-100, 100, 204},0, {-16, 1008},{0xBA, 0x0, 0x96, 0xFF}}}, 55 | {{{100, -100, 204},0, {-16, 1008},{0x0, 0xBA, 0x96, 0xFF}}}, 56 | {{{400, -400, 400},0, {-16, 1008},{0x0, 0xBA, 0x96, 0xFF}}}, 57 | {{{-400, -400, 400},0, {-16, 1008},{0x0, 0xBA, 0x96, 0xFF}}}, 58 | {{{-100, -100, 204},0, {-16, 1008},{0x0, 0xBA, 0x96, 0xFF}}}, 59 | {{{100, -100, 204},0, {368, 240},{0xBA, 0x0, 0x6A, 0xFF}}}, 60 | {{{400, -400, 400},0, {368, 240},{0xBA, 0x0, 0x6A, 0xFF}}}, 61 | {{{400, 400, 400},0, {624, 240},{0xBA, 0x0, 0x6A, 0xFF}}}, 62 | {{{100, 100, 204},0, {624, 240},{0xBA, 0x0, 0x6A, 0xFF}}}, 63 | {{{-400, 400, 400},0, {624, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 64 | {{{-400, 400, 400},0, {624, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 65 | {{{-400, -400, 400},0, {368, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 66 | {{{-400, -400, 400},0, {112, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 67 | {{{-400, -400, 400},0, {112, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 68 | {{{400, -400, 400},0, {368, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 69 | {{{400, 400, 400},0, {624, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 70 | {{{-400, 400, 400},0, {880, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 71 | {{{-100, 100, 204},0, {624, 1008},{0x46, 0x0, 0x6A, 0xFF}}}, 72 | {{{-400, 400, 400},0, {624, 1008},{0x46, 0x0, 0x6A, 0xFF}}}, 73 | {{{-400, -400, 400},0, {368, 1008},{0x46, 0x0, 0x6A, 0xFF}}}, 74 | {{{-100, -100, 204},0, {368, 1008},{0x46, 0x0, 0x6A, 0xFF}}}, 75 | {{{-100, 100, 204},0, {-16, 1008},{0x0, 0x46, 0x96, 0xFF}}}, 76 | {{{-400, 400, 400},0, {-16, 1008},{0x0, 0x46, 0x96, 0xFF}}}, 77 | {{{400, 400, 400},0, {-16, 1008},{0x0, 0x46, 0x96, 0xFF}}}, 78 | {{{100, 100, 204},0, {-16, 1008},{0x0, 0x46, 0x96, 0xFF}}}, 79 | {{{100, 100, 204},0, {-16, 1008},{0x46, 0x0, 0x96, 0xFF}}}, 80 | {{{400, 400, 400},0, {-16, 1008},{0x46, 0x0, 0x96, 0xFF}}}, 81 | {{{400, -400, 400},0, {-16, 1008},{0x46, 0x0, 0x96, 0xFF}}}, 82 | {{{100, -100, 204},0, {-16, 1008},{0x46, 0x0, 0x96, 0xFF}}}, 83 | {{{100, 100, 204},0, {624, 240},{0x0, 0xBA, 0x6A, 0xFF}}}, 84 | {{{400, 400, 400},0, {624, 240},{0x0, 0xBA, 0x6A, 0xFF}}}, 85 | {{{-400, 400, 400},0, {880, 240},{0x0, 0xBA, 0x6A, 0xFF}}}, 86 | {{{-100, 100, 204},0, {880, 240},{0x0, 0xBA, 0x6A, 0xFF}}}, 87 | {{{-100, -100, 204},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 88 | {{{-100, 100, 204},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 89 | {{{-100, 100, 204},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 90 | {{{100, -100, 204},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 91 | {{{100, 100, 204},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 92 | }; 93 | 94 | Gfx stage_opa_Cube_mesh_tri_0[] = { 95 | gsSPVertex(stage_opa_Cube_mesh_vtx_0 + 0, 32, 0), 96 | gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0), 97 | gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0), 98 | gsSP2Triangles(8, 9, 10, 0, 8, 10, 11, 0), 99 | gsSP2Triangles(12, 13, 14, 0, 12, 14, 15, 0), 100 | gsSP2Triangles(16, 17, 18, 0, 16, 18, 19, 0), 101 | gsSP2Triangles(20, 21, 22, 0, 20, 20, 21, 0), 102 | gsSP2Triangles(20, 21, 21, 0, 20, 20, 21, 0), 103 | gsSP2Triangles(20, 21, 21, 0, 20, 20, 21, 0), 104 | gsSP2Triangles(20, 21, 21, 0, 20, 20, 21, 0), 105 | gsSP2Triangles(23, 24, 25, 0, 23, 23, 24, 0), 106 | gsSP2Triangles(26, 23, 23, 0, 26, 26, 23, 0), 107 | gsSP2Triangles(27, 26, 26, 0, 27, 27, 26, 0), 108 | gsSP2Triangles(27, 26, 26, 0, 27, 27, 26, 0), 109 | gsSP2Triangles(27, 26, 26, 0, 27, 27, 26, 0), 110 | gsSP2Triangles(27, 26, 26, 0, 27, 27, 26, 0), 111 | gsSP2Triangles(26, 26, 23, 0, 26, 23, 23, 0), 112 | gsSP2Triangles(23, 23, 24, 0, 23, 24, 24, 0), 113 | gsSP2Triangles(23, 23, 24, 0, 23, 24, 24, 0), 114 | gsSP2Triangles(23, 23, 24, 0, 23, 24, 24, 0), 115 | gsSP2Triangles(26, 23, 23, 0, 26, 26, 23, 0), 116 | gsSP2Triangles(26, 23, 23, 0, 26, 26, 23, 0), 117 | gsSP2Triangles(28, 29, 30, 0, 28, 30, 31, 0), 118 | gsSPVertex(stage_opa_Cube_mesh_vtx_0 + 32, 32, 0), 119 | gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0), 120 | gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0), 121 | gsSP2Triangles(8, 9, 10, 0, 8, 10, 11, 0), 122 | gsSP2Triangles(12, 13, 14, 0, 12, 14, 14, 0), 123 | gsSP2Triangles(15, 16, 17, 0, 15, 17, 17, 0), 124 | gsSP2Triangles(17, 17, 18, 0, 17, 18, 18, 0), 125 | gsSP2Triangles(18, 18, 19, 0, 18, 19, 19, 0), 126 | gsSP2Triangles(20, 21, 22, 0, 20, 22, 23, 0), 127 | gsSP2Triangles(24, 25, 26, 0, 24, 26, 27, 0), 128 | gsSP2Triangles(28, 29, 30, 0, 28, 30, 31, 0), 129 | gsSPVertex(stage_opa_Cube_mesh_vtx_0 + 64, 9, 0), 130 | gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0), 131 | gsSP2Triangles(4, 5, 6, 0, 4, 4, 5, 0), 132 | gsSP2Triangles(7, 4, 4, 0, 7, 7, 4, 0), 133 | gsSP2Triangles(8, 7, 7, 0, 8, 8, 7, 0), 134 | gsSP2Triangles(5, 8, 8, 0, 5, 5, 8, 0), 135 | gsSP2Triangles(5, 8, 8, 0, 5, 5, 8, 0), 136 | gsSP2Triangles(4, 5, 5, 0, 4, 4, 5, 0), 137 | gsSP2Triangles(7, 4, 4, 0, 7, 7, 4, 0), 138 | gsSP2Triangles(8, 7, 7, 0, 8, 8, 7, 0), 139 | gsSP2Triangles(8, 7, 7, 0, 8, 8, 7, 0), 140 | gsSP2Triangles(5, 8, 8, 0, 5, 5, 8, 0), 141 | gsSP2Triangles(4, 5, 5, 0, 4, 4, 5, 0), 142 | gsSP2Triangles(7, 4, 4, 0, 7, 7, 4, 0), 143 | gsSP2Triangles(7, 4, 4, 0, 7, 7, 4, 0), 144 | gsSP2Triangles(8, 7, 7, 0, 8, 8, 7, 0), 145 | gsSP2Triangles(5, 8, 8, 0, 5, 5, 8, 0), 146 | gsSP2Triangles(4, 5, 5, 0, 4, 4, 5, 0), 147 | gsSPEndDisplayList(), 148 | }; 149 | 150 | 151 | Gfx mat_stage_opa_Material_001_f3d[] = { 152 | gsDPPipeSync(), 153 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 154 | gsSPTexture(65535, 65535, 0, 0, 1), 155 | gsSPSetLights2(stage_opa_Material_001_f3d_lights), 156 | gsSPEndDisplayList(), 157 | }; 158 | 159 | 160 | Gfx stage_opa_Cube_mesh[] = { 161 | gsSPClearGeometryMode(G_LIGHTING), 162 | gsSPVertex(stage_opa_Cube_mesh_vtx_cull + 0, 8, 0), 163 | gsSPSetGeometryMode(G_LIGHTING), 164 | gsSPCullDisplayList(0, 7), 165 | gsSPDisplayList(mat_stage_opa_Material_001_f3d), 166 | gsSPDisplayList(stage_opa_Cube_mesh_tri_0), 167 | gsDPPipeSync(), 168 | gsSPSetGeometryMode(G_LIGHTING), 169 | gsSPClearGeometryMode(G_TEXTURE_GEN), 170 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 171 | gsSPTexture(65535, 65535, 0, 0, 0), 172 | gsSPEndDisplayList(), 173 | }; 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /data/models/paddle.h: -------------------------------------------------------------------------------- 1 | Lights1 paddle_Material_001_f3d_lights = gdSPDefLights1( 2 | 0x0, 0x7F, 0x7F, 3 | 0x0, 0xFE, 0xFE, 0x28, 0x28, 0x28); 4 | 5 | Lights1 paddle_Material_002_f3d_lights = gdSPDefLights1( 6 | 0x7F, 0x7F, 0x7F, 7 | 0xFE, 0xFE, 0xFE, 0x28, 0x28, 0x28); 8 | 9 | Vtx paddle_Cube_mesh_vtx_cull[8] = { 10 | {{{-100, -100, 0},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 11 | {{{-100, -100, 4},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 12 | {{{-100, 100, 4},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 13 | {{{-100, 100, 0},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 14 | {{{100, -100, 0},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 15 | {{{100, -100, 4},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 16 | {{{100, 100, 4},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 17 | {{{100, 100, 0},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 18 | }; 19 | 20 | Vtx paddle_Cube_mesh_vtx_0[63] = { 21 | {{{-100, -100, 0},0, {368, 752},{0x81, 0x0, 0x0, 0xFF}}}, 22 | {{{-100, -100, 4},0, {368, 1008},{0x81, 0x0, 0x0, 0xFF}}}, 23 | {{{-100, -33, 4},0, {453, 1008},{0x81, 0x0, 0x0, 0xFF}}}, 24 | {{{-100, 33, 4},0, {539, 1008},{0x81, 0x0, 0x0, 0xFF}}}, 25 | {{{-100, 100, 0},0, {624, 752},{0x81, 0x0, 0x0, 0xFF}}}, 26 | {{{-100, 100, 4},0, {624, 1008},{0x81, 0x0, 0x0, 0xFF}}}, 27 | {{{-100, -100, 0},0, {368, 752},{0x0, 0x0, 0x81, 0xFF}}}, 28 | {{{-100, 100, 0},0, {624, 752},{0x0, 0x0, 0x81, 0xFF}}}, 29 | {{{100, 100, 0},0, {624, 496},{0x0, 0x0, 0x81, 0xFF}}}, 30 | {{{100, -100, 0},0, {368, 496},{0x0, 0x0, 0x81, 0xFF}}}, 31 | {{{100, -100, 4},0, {368, 240},{0x7F, 0x0, 0x0, 0xFF}}}, 32 | {{{100, -100, 0},0, {368, 496},{0x7F, 0x0, 0x0, 0xFF}}}, 33 | {{{100, 100, 0},0, {624, 496},{0x7F, 0x0, 0x0, 0xFF}}}, 34 | {{{100, 33, 4},0, {539, 240},{0x7F, 0x0, 0x0, 0xFF}}}, 35 | {{{100, 100, 4},0, {624, 240},{0x7F, 0x0, 0x0, 0xFF}}}, 36 | {{{100, -33, 4},0, {453, 240},{0x7F, 0x0, 0x0, 0xFF}}}, 37 | {{{-100, -100, 4},0, {112, 240},{0x0, 0x81, 0x0, 0xFF}}}, 38 | {{{-100, -100, 0},0, {112, 496},{0x0, 0x81, 0x0, 0xFF}}}, 39 | {{{100, -100, 0},0, {368, 496},{0x0, 0x81, 0x0, 0xFF}}}, 40 | {{{-33, -100, 4},0, {197, 240},{0x0, 0x81, 0x0, 0xFF}}}, 41 | {{{33, -100, 4},0, {283, 240},{0x0, 0x81, 0x0, 0xFF}}}, 42 | {{{100, -100, 4},0, {368, 240},{0x0, 0x81, 0x0, 0xFF}}}, 43 | {{{100, 100, 4},0, {624, 240},{0x0, 0x7F, 0x0, 0xFF}}}, 44 | {{{100, 100, 0},0, {624, 496},{0x0, 0x7F, 0x0, 0xFF}}}, 45 | {{{-100, 100, 0},0, {880, 496},{0x0, 0x7F, 0x0, 0xFF}}}, 46 | {{{33, 100, 4},0, {709, 240},{0x0, 0x7F, 0x0, 0xFF}}}, 47 | {{{-33, 100, 4},0, {795, 240},{0x0, 0x7F, 0x0, 0xFF}}}, 48 | {{{-100, 100, 4},0, {880, 240},{0x0, 0x7F, 0x0, 0xFF}}}, 49 | {{{96, 48, 4},0, {581, 667},{0x0, 0x0, 0x7F, 0xFF}}}, 50 | {{{96, 96, 4},0, {667, 667},{0x0, 0x0, 0x7F, 0xFF}}}, 51 | {{{48, 96, 4},0, {667, 581},{0x0, 0x0, 0x7F, 0xFF}}}, 52 | {{{5, 5, 4},0, {581, 581},{0x0, 0x0, 0x7F, 0xFF}}}, 53 | {{{5, 5, 4},0, {581, 581},{0x0, 0x0, 0x7F, 0xFF}}}, 54 | {{{48, 96, 4},0, {667, 581},{0x0, 0x0, 0x7F, 0xFF}}}, 55 | {{{0, 96, 4},0, {667, 496},{0x0, 0x0, 0x7F, 0xFF}}}, 56 | {{{-33, 100, 4},0, {1008, 325},{0x0, 0x0, 0x7F, 0xFF}}}, 57 | {{{33, 100, 4},0, {1008, 667},{0x0, 0x0, 0x7F, 0xFF}}}, 58 | {{{-48, 96, 4},0, {667, 411},{0x0, 0x0, 0x7F, 0xFF}}}, 59 | {{{0, 26, 4},0, {581, 496},{0x0, 0x0, 0x7F, 0xFF}}}, 60 | {{{-5, 5, 4},0, {581, 411},{0x0, 0x0, 0x7F, 0xFF}}}, 61 | {{{-96, 96, 4},0, {667, 325},{0x0, 0x0, 0x7F, 0xFF}}}, 62 | {{{-96, 48, 4},0, {581, 325},{0x0, 0x0, 0x7F, 0xFF}}}, 63 | {{{-26, 0, 4},0, {496, 411},{0x0, 0x0, 0x7F, 0xFF}}}, 64 | {{{-96, 0, 4},0, {496, 325},{0x0, 0x0, 0x7F, 0xFF}}}, 65 | {{{-100, 33, 4},0, {667, -16},{0x0, 0x0, 0x7F, 0xFF}}}, 66 | {{{-100, -33, 4},0, {325, -16},{0x0, 0x0, 0x7F, 0xFF}}}, 67 | {{{-96, -48, 4},0, {411, 325},{0x0, 0x0, 0x7F, 0xFF}}}, 68 | {{{-5, -5, 4},0, {411, 411},{0x0, 0x0, 0x7F, 0xFF}}}, 69 | {{{-48, -96, 4},0, {325, 411},{0x0, 0x0, 0x7F, 0xFF}}}, 70 | {{{-96, -96, 4},0, {325, 325},{0x0, 0x0, 0x7F, 0xFF}}}, 71 | {{{0, -96, 4},0, {325, 496},{0x0, 0x0, 0x7F, 0xFF}}}, 72 | {{{0, -26, 4},0, {411, 496},{0x0, 0x0, 0x7F, 0xFF}}}, 73 | {{{48, -96, 4},0, {325, 581},{0x0, 0x0, 0x7F, 0xFF}}}, 74 | {{{33, -100, 4},0, {-16, 667},{0x0, 0x0, 0x7F, 0xFF}}}, 75 | {{{-33, -100, 4},0, {-16, 325},{0x0, 0x0, 0x7F, 0xFF}}}, 76 | {{{5, -5, 4},0, {411, 581},{0x0, 0x0, 0x7F, 0xFF}}}, 77 | {{{96, -96, 4},0, {325, 667},{0x0, 0x0, 0x7F, 0xFF}}}, 78 | {{{96, -48, 4},0, {411, 667},{0x0, 0x0, 0x7F, 0xFF}}}, 79 | {{{26, 0, 4},0, {496, 581},{0x0, 0x0, 0x7F, 0xFF}}}, 80 | {{{96, 0, 4},0, {496, 667},{0x0, 0x0, 0x7F, 0xFF}}}, 81 | {{{100, 33, 4},0, {667, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 82 | {{{100, -33, 4},0, {325, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, 83 | {{{96, 48, 4},0, {581, 667},{0x0, 0x0, 0x7F, 0xFF}}}, 84 | }; 85 | 86 | Gfx paddle_Cube_mesh_tri_0[] = { 87 | gsSPVertex(paddle_Cube_mesh_vtx_0 + 0, 32, 0), 88 | gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0), 89 | gsSP2Triangles(3, 4, 0, 0, 3, 5, 4, 0), 90 | gsSP2Triangles(6, 7, 8, 0, 6, 8, 9, 0), 91 | gsSP2Triangles(10, 11, 12, 0, 12, 13, 10, 0), 92 | gsSP2Triangles(12, 14, 13, 0, 13, 15, 10, 0), 93 | gsSP2Triangles(16, 17, 18, 0, 19, 16, 18, 0), 94 | gsSP2Triangles(18, 20, 19, 0, 18, 21, 20, 0), 95 | gsSP2Triangles(22, 23, 24, 0, 25, 22, 24, 0), 96 | gsSP2Triangles(24, 26, 25, 0, 24, 27, 26, 0), 97 | gsSP2Triangles(28, 29, 30, 0, 28, 30, 31, 0), 98 | gsSPVertex(paddle_Cube_mesh_vtx_0 + 32, 31, 0), 99 | gsSP2Triangles(0, 1, 2, 0, 3, 2, 1, 0), 100 | gsSP2Triangles(1, 4, 3, 0, 3, 5, 2, 0), 101 | gsSP2Triangles(6, 2, 5, 0, 6, 5, 7, 0), 102 | gsSP2Triangles(7, 5, 8, 0, 7, 8, 9, 0), 103 | gsSP2Triangles(10, 7, 9, 0, 10, 9, 11, 0), 104 | gsSP2Triangles(11, 9, 12, 0, 11, 12, 13, 0), 105 | gsSP2Triangles(13, 14, 11, 0, 15, 11, 14, 0), 106 | gsSP2Triangles(16, 15, 14, 0, 16, 14, 17, 0), 107 | gsSP2Triangles(18, 15, 16, 0, 18, 19, 15, 0), 108 | gsSP2Triangles(20, 19, 18, 0, 21, 20, 18, 0), 109 | gsSP2Triangles(21, 18, 16, 0, 16, 22, 21, 0), 110 | gsSP2Triangles(20, 23, 19, 0, 24, 23, 20, 0), 111 | gsSP2Triangles(24, 25, 23, 0, 25, 26, 23, 0), 112 | gsSP2Triangles(25, 27, 26, 0, 28, 27, 25, 0), 113 | gsSP2Triangles(25, 29, 28, 0, 28, 30, 27, 0), 114 | gsSP2Triangles(27, 30, 0, 0, 27, 0, 26, 0), 115 | gsSP2Triangles(15, 10, 11, 0, 0, 2, 6, 0), 116 | gsSPEndDisplayList(), 117 | };Vtx paddle_Cube_mesh_vtx_1[36] = { 118 | {{{-100, 33, 4},0, {667, -16},{0xFF, 0xFF, 0xFF, 0xFF}}}, 119 | {{{-96, 48, 4},0, {581, 325},{0xFF, 0xFF, 0xFF, 0xFF}}}, 120 | {{{-96, 96, 4},0, {667, 325},{0xFF, 0xFF, 0xFF, 0xFF}}}, 121 | {{{-100, 100, 4},0, {1008, -16},{0xFF, 0xFF, 0xFF, 0xFF}}}, 122 | {{{-33, 100, 4},0, {1008, 325},{0xFF, 0xFF, 0xFF, 0xFF}}}, 123 | {{{-48, 96, 4},0, {667, 411},{0xFF, 0xFF, 0xFF, 0xFF}}}, 124 | {{{-33, -100, 4},0, {-16, 325},{0xFF, 0xFF, 0xFF, 0xFF}}}, 125 | {{{-48, -96, 4},0, {325, 411},{0xFF, 0xFF, 0xFF, 0xFF}}}, 126 | {{{-96, -96, 4},0, {325, 325},{0xFF, 0xFF, 0xFF, 0xFF}}}, 127 | {{{-100, -100, 4},0, {-16, -16},{0xFF, 0xFF, 0xFF, 0xFF}}}, 128 | {{{-100, -33, 4},0, {325, -16},{0xFF, 0xFF, 0xFF, 0xFF}}}, 129 | {{{-96, -48, 4},0, {411, 325},{0xFF, 0xFF, 0xFF, 0xFF}}}, 130 | {{{100, 33, 4},0, {667, 1008},{0xFF, 0xFF, 0xFF, 0xFF}}}, 131 | {{{96, 96, 4},0, {667, 667},{0xFF, 0xFF, 0xFF, 0xFF}}}, 132 | {{{96, 48, 4},0, {581, 667},{0xFF, 0xFF, 0xFF, 0xFF}}}, 133 | {{{100, 100, 4},0, {1008, 1008},{0xFF, 0xFF, 0xFF, 0xFF}}}, 134 | {{{33, 100, 4},0, {1008, 667},{0xFF, 0xFF, 0xFF, 0xFF}}}, 135 | {{{48, 96, 4},0, {667, 581},{0xFF, 0xFF, 0xFF, 0xFF}}}, 136 | {{{33, -100, 4},0, {-16, 667},{0xFF, 0xFF, 0xFF, 0xFF}}}, 137 | {{{96, -96, 4},0, {325, 667},{0xFF, 0xFF, 0xFF, 0xFF}}}, 138 | {{{48, -96, 4},0, {325, 581},{0xFF, 0xFF, 0xFF, 0xFF}}}, 139 | {{{100, -100, 4},0, {-16, 1008},{0xFF, 0xFF, 0xFF, 0xFF}}}, 140 | {{{100, -33, 4},0, {325, 1008},{0xFF, 0xFF, 0xFF, 0xFF}}}, 141 | {{{96, -48, 4},0, {411, 667},{0xFF, 0xFF, 0xFF, 0xFF}}}, 142 | {{{5, -5, 4},0, {411, 581},{0xFF, 0xFF, 0xFF, 0xFF}}}, 143 | {{{26, 0, 4},0, {496, 581},{0xFF, 0xFF, 0xFF, 0xFF}}}, 144 | {{{0, 0, 4},0, {496, 496},{0xFF, 0xFF, 0xFF, 0xFF}}}, 145 | {{{5, 5, 4},0, {581, 581},{0xFF, 0xFF, 0xFF, 0xFF}}}, 146 | {{{0, 26, 4},0, {581, 496},{0xFF, 0xFF, 0xFF, 0xFF}}}, 147 | {{{-5, 5, 4},0, {581, 411},{0xFF, 0xFF, 0xFF, 0xFF}}}, 148 | {{{-26, 0, 4},0, {496, 411},{0xFF, 0xFF, 0xFF, 0xFF}}}, 149 | {{{-5, -5, 4},0, {411, 411},{0xFF, 0xFF, 0xFF, 0xFF}}}, 150 | {{{0, -26, 4},0, {411, 496},{0xFF, 0xFF, 0xFF, 0xFF}}}, 151 | {{{0, 0, 4},0, {496, 496},{0xFF, 0xFF, 0xFF, 0xFF}}}, 152 | {{{-5, -5, 4},0, {411, 411},{0xFF, 0xFF, 0xFF, 0xFF}}}, 153 | {{{5, -5, 4},0, {411, 581},{0xFF, 0xFF, 0xFF, 0xFF}}}, 154 | }; 155 | 156 | Gfx paddle_Cube_mesh_tri_1[] = { 157 | gsSPVertex(paddle_Cube_mesh_vtx_1 + 0, 32, 0), 158 | gsSP2Triangles(0, 1, 2, 0, 2, 3, 0, 0), 159 | gsSP2Triangles(2, 4, 3, 0, 5, 4, 2, 0), 160 | gsSP2Triangles(6, 7, 8, 0, 6, 8, 9, 0), 161 | gsSP2Triangles(8, 10, 9, 0, 8, 11, 10, 0), 162 | gsSP2Triangles(12, 13, 14, 0, 12, 15, 13, 0), 163 | gsSP2Triangles(15, 16, 13, 0, 13, 16, 17, 0), 164 | gsSP2Triangles(18, 19, 20, 0, 21, 19, 18, 0), 165 | gsSP2Triangles(21, 22, 19, 0, 19, 22, 23, 0), 166 | gsSP2Triangles(24, 25, 26, 0, 25, 27, 26, 0), 167 | gsSP2Triangles(27, 28, 26, 0, 26, 28, 29, 0), 168 | gsSP2Triangles(26, 29, 30, 0, 26, 30, 31, 0), 169 | gsSPVertex(paddle_Cube_mesh_vtx_1 + 32, 4, 0), 170 | gsSP2Triangles(0, 1, 2, 0, 3, 1, 0, 0), 171 | gsSPEndDisplayList(), 172 | }; 173 | 174 | 175 | Gfx mat_paddle_Material_001_f3d[] = { 176 | gsDPPipeSync(), 177 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 178 | gsSPTexture(65535, 65535, 0, 0, 1), 179 | gsDPSetEnvColor(254, 254, 254, 76), 180 | gsSPSetLights1(paddle_Material_001_f3d_lights), 181 | gsSPEndDisplayList(), 182 | }; 183 | 184 | 185 | Gfx mat_paddle_Material_002_f3d[] = { 186 | gsDPPipeSync(), 187 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 188 | gsSPClearGeometryMode(G_LIGHTING | G_SHADING_SMOOTH), 189 | gsSPTexture(65535, 65535, 0, 0, 1), 190 | gsDPSetEnvColor(254, 254, 254, 255), 191 | gsSPSetLights1(paddle_Material_002_f3d_lights), 192 | gsSPEndDisplayList(), 193 | }; 194 | 195 | Gfx mat_revert_paddle_Material_002_f3d[] = { 196 | gsDPPipeSync(), 197 | gsSPSetGeometryMode(G_LIGHTING | G_SHADING_SMOOTH), 198 | gsSPEndDisplayList(), 199 | }; 200 | 201 | 202 | Gfx paddle_Cube_mesh[] = { 203 | gsSPClearGeometryMode(G_LIGHTING), 204 | gsSPVertex(paddle_Cube_mesh_vtx_cull + 0, 8, 0), 205 | gsSPSetGeometryMode(G_LIGHTING), 206 | gsSPCullDisplayList(0, 7), 207 | gsSPDisplayList(mat_paddle_Material_001_f3d), 208 | gsSPDisplayList(paddle_Cube_mesh_tri_0), 209 | gsSPDisplayList(mat_paddle_Material_002_f3d), 210 | gsSPDisplayList(paddle_Cube_mesh_tri_1), 211 | gsSPDisplayList(mat_revert_paddle_Material_002_f3d), 212 | gsDPPipeSync(), 213 | gsSPSetGeometryMode(G_LIGHTING), 214 | gsSPClearGeometryMode(G_TEXTURE_GEN), 215 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 216 | gsSPTexture(65535, 65535, 0, 0, 0), 217 | gsSPEndDisplayList(), 218 | }; 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /src/game.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "common.h" 4 | #include "game.h" 5 | #include "graphics.h" 6 | #include "camera.h" 7 | #include "object.h" 8 | #include "plane.h" 9 | #include "collision.h" 10 | #include "brick.h" 11 | #include "paddle.h" 12 | #include "ball.h" 13 | #include "level.h" 14 | 15 | #include "models/stage.h" 16 | #include "models/paddle.h" 17 | #include "models/ball.h" 18 | #include "models/brick.h" 19 | 20 | #include "levels/stage0.h" 21 | 22 | #define ROT_VELOCITY 1.0f 23 | #define CAMERA_MOVE_SCALE 0.25 24 | #define NUM_LEVELS 1 25 | 26 | extern NUContData controller[1]; 27 | 28 | static Object stage; 29 | static Object ball; 30 | 31 | static Paddle paddle; 32 | 33 | static LevelData* level_data[] = { 34 | &stage0 35 | }; 36 | static Level level; 37 | static int current_level = 0; 38 | 39 | static bool paused = TRUE; 40 | static bool live = TRUE; 41 | 42 | // Check each wall for collision with the ball. 43 | // If there is a collision, move the ball to the collision point and return a new next_pos. 44 | // In this event, collision needs to be checked again with the new next_pos, in case another 45 | // collision occurs. 46 | static bool handle_collision_walls(Vec3f next_pos, float dist, Vec3f* new_next_pos) { 47 | bool intersection = FALSE; 48 | Vec3f hit; 49 | float time, dist_after_hit; 50 | 51 | // Check up to 3 walls, depending on the direction the ball is travelling. 52 | // For instance, if the ball is travelling in the -X direction, there is no need to check 53 | // the right wall, as it's only possible for the ball to hit the left wall when travelling left. 54 | // Additionally, collision checking is skipped if the next position is still within level bounds. 55 | 56 | // Check left wall 57 | if (ball.vel.x < 0 && 58 | next_pos.x <= level.bounds[SIDE_LEFT] + BALL_R && 59 | moving_sphere_plane_intersect(BALL_R, ball.pos, next_pos, level.walls[SIDE_LEFT], &hit, &time)) { 60 | // Flip x direction 61 | ball.vel.x *= -1; 62 | intersection = TRUE; 63 | } 64 | // Check right wall 65 | if (ball.vel.x > 0 && 66 | next_pos.x >= level.bounds[SIDE_RIGHT] - BALL_R && 67 | !intersection && 68 | moving_sphere_plane_intersect(BALL_R, ball.pos, next_pos, level.walls[SIDE_RIGHT], &hit, &time)) { 69 | // Flip x direction 70 | ball.vel.x *= -1; 71 | intersection = TRUE; 72 | } 73 | // Check top wall 74 | if (ball.vel.y > 0 && 75 | next_pos.y >= level.bounds[SIDE_TOP] - BALL_R && 76 | !intersection && 77 | moving_sphere_plane_intersect(BALL_R, ball.pos, next_pos, level.walls[SIDE_TOP], &hit, &time)) { 78 | // Flip y direction 79 | ball.vel.y *= -1; 80 | intersection = TRUE; 81 | } 82 | // Check bottom wall 83 | if (ball.vel.y < 0 && 84 | next_pos.y <= level.bounds[SIDE_BOTTOM] + BALL_R && 85 | !intersection && 86 | moving_sphere_plane_intersect(BALL_R, ball.pos, next_pos, level.walls[SIDE_BOTTOM], &hit, &time)) { 87 | // Flip y direction 88 | ball.vel.y *= -1; 89 | intersection = TRUE; 90 | } 91 | // Check back wall 92 | if (ball.vel.z < 0 && 93 | next_pos.z <= level.bounds[SIDE_BACK] + BALL_R && 94 | !intersection && 95 | moving_sphere_plane_intersect(BALL_R, ball.pos, next_pos, level.walls[SIDE_BACK], &hit, &time)) { 96 | // Flip z direction 97 | ball.vel.z *= -1; 98 | intersection = TRUE; 99 | } 100 | // Check front wall 101 | if (ball.vel.z > 0 && 102 | next_pos.z >= level.bounds[SIDE_FRONT] - BALL_R && 103 | !intersection && 104 | moving_sphere_plane_intersect(BALL_R, ball.pos, next_pos, level.walls[SIDE_FRONT], &hit, &time)) { 105 | // Check if the intersection point lies within the bounds of the paddle 106 | if (hit.x >= paddle.obj.pos.x - PADDLE_R - BALL_R && hit.x <= paddle.obj.pos.x + PADDLE_R + BALL_R && 107 | hit.y >= paddle.obj.pos.y - PADDLE_R - BALL_R && hit.y <= paddle.obj.pos.y + PADDLE_R + BALL_R) { 108 | // If so, set the ball's direction to a brand new angle based on its position relative to the paddle's centre 109 | vec3f_set( 110 | ball.vel, 111 | -(hit.x - paddle.obj.pos.x) / PADDLE_R, 112 | -(hit.y - paddle.obj.pos.y) / PADDLE_R, 113 | -ball.vel.z 114 | ); 115 | intersection = TRUE; 116 | // Calculate the hit animation rotation for this hit 117 | vec3f_set( 118 | paddle.hit_rot, 119 | (-(hit.y - paddle.obj.pos.y) / PADDLE_R) * PADDLE_HIT_ANIM_INTENSITY, 120 | ((hit.x - paddle.obj.pos.x) / PADDLE_R) * PADDLE_HIT_ANIM_INTENSITY, 121 | 0 122 | ); 123 | // If the A button is held on this frame, hold the ball 124 | if (controller[0].button & A_BUTTON) { 125 | paddle.held = TRUE; 126 | vec3f_set( 127 | paddle.hold_pos, 128 | hit.x - paddle.obj.pos.x, 129 | hit.y - paddle.obj.pos.y, 130 | hit.z - paddle.obj.pos.z 131 | ); 132 | *new_next_pos = hit; 133 | return FALSE; 134 | } 135 | // Otherwise, start the hit animation 136 | else { 137 | paddle.hit_anim_timer = PADDLE_HIT_ANIM_DURATION; 138 | } 139 | } 140 | // If the ball doesn't hit the paddle but still intersects with the front wall, it's an out 141 | // For now, just respawn the ball 142 | else { 143 | live = FALSE; 144 | return FALSE; 145 | } 146 | } 147 | 148 | if (intersection) { 149 | // Move the ball to the intersection point 150 | ball.pos = hit; 151 | 152 | // Calculate the portion of the ball's movement that occurs after collision 153 | dist_after_hit = (1.0f - time) * dist; 154 | 155 | // Return the new next position so further testing can be done 156 | // between the point of intersection and the new next position 157 | vec3f_set( 158 | *new_next_pos, 159 | ball.pos.x + ball.vel.x * dist_after_hit, 160 | ball.pos.y + ball.vel.y * dist_after_hit, 161 | ball.pos.z + ball.vel.z * dist_after_hit 162 | ); 163 | 164 | return TRUE; 165 | } 166 | 167 | // In the event that there is no collision at all, just return the original next_pos 168 | return FALSE; 169 | } 170 | 171 | // Check each brick for collision with the ball. 172 | // If there is a collision, move the ball to the collision point and return a new next_pos. 173 | // In this event, collision needs to be checked again with the new next_pos, in case another 174 | // collision occurs. 175 | static bool handle_collision_bricks(Vec3f next_pos, float dist, Vec3f* new_next_pos) { 176 | bool intersection = FALSE; 177 | Vec3f hit; 178 | float time, dist_after_hit; 179 | int i; 180 | 181 | for (i = 0; i < level.num_bricks; i++) { 182 | // Check the distance from the ball to the cube and see if it's worth doing collision detection 183 | float dist_to_brick = sqrtf( 184 | pow(level.bricks[i].obj.pos.x - ball.pos.x, 2) + 185 | pow(level.bricks[i].obj.pos.y - ball.pos.y, 2) + 186 | pow(level.bricks[i].obj.pos.z - ball.pos.z, 2) 187 | ) - BALL_R - BRICK_CR; 188 | 189 | if (dist_to_brick - dist >= 0) { 190 | continue; 191 | } 192 | 193 | // Don't check dead bricks 194 | if (level.bricks[i].lives == 0) { 195 | continue; 196 | } 197 | 198 | // Check three sides of the brick, depending on the ball's velocity 199 | // Check front face if travelling away from the camera 200 | if (ball.vel.z < 0 && 201 | moving_sphere_quad_intersect( 202 | BALL_R, ball.pos, next_pos, 203 | level.bricks[i].front[0], level.bricks[i].front[1], level.bricks[i].front[2], level.bricks[i].front[3], 204 | &hit, &time 205 | )) { 206 | if (level.bricks[i].lives > 1) { 207 | ball.vel.z *= -1; 208 | intersection = TRUE; 209 | } else { 210 | // Don't report a hit if the brick dies 211 | brick_kill_contiguous(&level.bricks[i]); 212 | return FALSE; 213 | } 214 | } 215 | 216 | // Check left face if travelling right 217 | if (ball.vel.x > 0 && 218 | !intersection && 219 | moving_sphere_quad_intersect( 220 | BALL_R, ball.pos, next_pos, 221 | level.bricks[i].left[0], level.bricks[i].left[1], level.bricks[i].left[2], level.bricks[i].left[3], 222 | &hit, &time 223 | )) { 224 | if (level.bricks[i].lives > 1) { 225 | ball.vel.x *= -1; 226 | intersection = TRUE; 227 | } else { 228 | brick_kill_contiguous(&level.bricks[i]); 229 | return FALSE; 230 | } 231 | } 232 | 233 | // Check right face if travelling left 234 | if (ball.vel.x < 0 && 235 | !intersection && 236 | moving_sphere_quad_intersect( 237 | BALL_R, ball.pos, next_pos, 238 | level.bricks[i].right[0], level.bricks[i].right[1], level.bricks[i].right[2], level.bricks[i].right[3], 239 | &hit, &time 240 | )) { 241 | if (level.bricks[i].lives > 1) { 242 | ball.vel.x *= -1; 243 | intersection = TRUE; 244 | } else { 245 | brick_kill_contiguous(&level.bricks[i]); 246 | return FALSE; 247 | } 248 | } 249 | 250 | // Check top face if travelling down 251 | if (ball.vel.y < 0 && 252 | !intersection && 253 | moving_sphere_quad_intersect( 254 | BALL_R, ball.pos, next_pos, 255 | level.bricks[i].top[0], level.bricks[i].top[1], level.bricks[i].top[2], level.bricks[i].top[3], 256 | &hit, &time 257 | )) { 258 | if (level.bricks[i].lives > 1) { 259 | ball.vel.y *= -1; 260 | intersection = TRUE; 261 | } else { 262 | brick_kill_contiguous(&level.bricks[i]); 263 | return FALSE; 264 | } 265 | } 266 | 267 | // Check bottom face if travelling up 268 | if (ball.vel.y > 0 && 269 | !intersection && 270 | moving_sphere_quad_intersect( 271 | BALL_R, ball.pos, next_pos, 272 | level.bricks[i].bottom[0], level.bricks[i].bottom[1], level.bricks[i].bottom[2], level.bricks[i].bottom[3], 273 | &hit, &time 274 | )) { 275 | if (level.bricks[i].lives > 1) { 276 | ball.vel.y *= -1; 277 | intersection = TRUE; 278 | } else { 279 | brick_kill_contiguous(&level.bricks[i]); 280 | return FALSE; 281 | } 282 | } 283 | 284 | // Check back face if travelling towards from the camera 285 | if (ball.vel.z > 0 && 286 | !intersection && 287 | moving_sphere_quad_intersect( 288 | BALL_R, ball.pos, next_pos, 289 | level.bricks[i].back[0], level.bricks[i].back[1], level.bricks[i].back[2], level.bricks[i].back[3], 290 | &hit, &time 291 | )) { 292 | if (level.bricks[i].lives > 1) { 293 | ball.vel.z *= -1; 294 | intersection = TRUE; 295 | } else { 296 | brick_kill_contiguous(&level.bricks[i]); 297 | return FALSE; 298 | } 299 | } 300 | 301 | // If there was an intersection with any face of this brick, 302 | // start the hit animation timer 303 | if (intersection) { 304 | level.bricks[i].lives--; 305 | level.bricks[i].hit_anim_timer = BRICK_HIT_ANIM_DURATION; 306 | break; 307 | } 308 | } 309 | 310 | if (intersection) { 311 | // Move the ball to the intersection point 312 | vec3f_copy(ball.pos, hit); 313 | 314 | // Calculate the portion of the ball's movement that occurs after collision 315 | dist_after_hit = (1.0f - time) * dist; 316 | 317 | // Return the new next position so further testing can be done 318 | // between the point of intersection and the new next position 319 | vec3f_set( 320 | *new_next_pos, 321 | ball.pos.x + ball.vel.x * dist_after_hit, 322 | ball.pos.y + ball.vel.y * dist_after_hit, 323 | ball.pos.z + ball.vel.z * dist_after_hit 324 | ); 325 | 326 | return TRUE; 327 | } 328 | 329 | // In the event that there is no collision at all, just return the original next_pos 330 | return FALSE; 331 | } 332 | 333 | static void update_camera(double dt) { 334 | Vec2f rot = { 335 | -(paddle.obj.pos.x / paddle.max_x) * 5, 336 | -(paddle.obj.pos.y / paddle.max_y) * 5 337 | }; 338 | camera_rotate_to(rot); 339 | camera.pos.x = paddle.obj.pos.x * CAMERA_MOVE_SCALE; 340 | camera.pos.y = paddle.obj.pos.y * CAMERA_MOVE_SCALE; 341 | } 342 | 343 | static void update_ball(double dt) { 344 | int i, j; 345 | bool hit; 346 | bool brick_hit; 347 | Vec3f move; 348 | Vec3f next_pos, new_next_pos; 349 | double dist = BALL_BASE_VELOCITY * dt; 350 | 351 | // Project the next ball position 352 | move.x = ball.vel.x * dist; 353 | move.y = ball.vel.y * dist; 354 | move.z = ball.vel.z * dist; 355 | next_pos.x = ball.pos.x + move.x; 356 | next_pos.y = ball.pos.y + move.y; 357 | next_pos.z = ball.pos.z + move.z; 358 | 359 | // Start collision detection 360 | do { 361 | // Check for a collision with the bricks first 362 | hit = handle_collision_bricks(next_pos, dist, &new_next_pos); 363 | 364 | // If there's no collision with the bricks, check for collision with the walls 365 | if (!hit) { 366 | hit = handle_collision_walls(next_pos, dist, &new_next_pos); 367 | } 368 | 369 | // If there is ultimately a collision in this iteration, move the ball to its corrected position 370 | if (hit) { 371 | next_pos = new_next_pos; 372 | } 373 | } while (hit); // Iterate until there are no more collisions to resolve this update 374 | 375 | // If the ball is still live, move it to its corrected new position 376 | if (live) { 377 | // Skip this if the ball is being held by the paddle 378 | if (!paddle.held) { 379 | ball.pos = next_pos; 380 | } 381 | } 382 | // Otherwise, respawn the ball 383 | else { 384 | vec3f_set(ball.pos, 0, 0, UNIT_SIZE); 385 | vec3f_set(ball.vel, 0, 0, level.start_vel); 386 | live = TRUE; 387 | } 388 | } 389 | 390 | void game_init(void) { 391 | // Load level data 392 | level = level_load(level_data[current_level]); 393 | 394 | // Initialize stage 395 | vec3f_set(stage.pos, 0, 0, 0); 396 | vec3f_set(stage.rot, 0, 0, 0); 397 | vec3f_set(stage.vel, 0, 0, 0); 398 | stage.scale = level.width; 399 | 400 | // Initialize paddle 401 | paddle_init(&paddle, &level); 402 | 403 | // Initialize ball 404 | vec3f_set(ball.pos, 0, 0, 450); 405 | vec3f_set(ball.rot, 0, 0, 0); 406 | vec3f_set(ball.vel, 0, 0, level.start_vel); 407 | ball.scale = 1; 408 | 409 | // Initialize camera 410 | camera_init(); 411 | } 412 | 413 | void game_update(double dt) { 414 | int i; 415 | 416 | // Check for a pause button press 417 | if (controller[0].trigger & START_BUTTON) { 418 | paused = !paused; 419 | } 420 | 421 | if (paused) { 422 | return; 423 | } 424 | 425 | paddle_update(&paddle, &level, dt); 426 | 427 | // Check if the ball is held 428 | if (paddle.held) { 429 | // Position the ball relative to the paddle 430 | ball.pos = paddle.hold_pos; 431 | vec3f_add(ball.pos, paddle.obj.pos); 432 | // Check for A button release 433 | if (!(controller[0].button & A_BUTTON)) { 434 | paddle.held = FALSE; 435 | paddle.hit_anim_timer = PADDLE_HIT_ANIM_DURATION; 436 | } 437 | } else { 438 | update_ball(dt); 439 | } 440 | 441 | update_camera(dt); 442 | 443 | // Update bricks 444 | for (i = 0; i < level.num_bricks; i++) { 445 | brick_update(&level.bricks[i], dt); 446 | } 447 | } 448 | 449 | void game_draw(void) { 450 | int i; 451 | MVP* mvpp = &mvp[task_num]; 452 | glistp = &glist[task_num][0]; 453 | 454 | graphics_init_RCP(); 455 | graphics_clear(0, 0, 0); 456 | 457 | camera_look(mvpp); 458 | 459 | // Draw opaque objects first 460 | // Begin with the bricks 461 | for (i = 0; i < level.num_bricks; i++) { 462 | switch (level.bricks[i].lives) { 463 | case 3: 464 | graphics_draw_textured_object(&(level.bricks[i].obj), brick_Cube_mesh_green, FALSE); 465 | break; 466 | case 2: 467 | graphics_draw_textured_object(&(level.bricks[i].obj), brick_Cube_mesh_orange, FALSE); 468 | break; 469 | case 1: 470 | graphics_draw_textured_object(&(level.bricks[i].obj), brick_Cube_mesh_pink, FALSE); 471 | break; 472 | case 0: 473 | if (level.bricks[i].death_anim_timer > 0) { 474 | graphics_draw_textured_object(&(level.bricks[i].obj), brick_Cube_mesh_pink, FALSE); 475 | } 476 | break; 477 | default: 478 | break; 479 | } 480 | } 481 | 482 | // Draw the stage 483 | // graphics_draw_object(&stage, stage_opa_Cube_mesh, FALSE); 484 | graphics_draw_object(&stage, stage_Cube_mesh, FALSE); 485 | 486 | // Draw the ball 487 | graphics_draw_object(&ball, ball_Icosphere_mesh, FALSE); 488 | 489 | // Transparent objects drawn last 490 | graphics_draw_object(&paddle.obj, paddle_Cube_mesh, TRUE); 491 | 492 | gDPFullSync(glistp++); 493 | gSPEndDisplayList(glistp++); 494 | 495 | nuGfxTaskStart( 496 | &glist[task_num][0], 497 | (s32)(glistp - glist[task_num]) * sizeof(Gfx), 498 | NU_GFX_UCODE_F3DEX, 499 | NU_SC_SWAPBUFFER 500 | ); 501 | 502 | task_num++; 503 | task_num %= MAX_TASKS; 504 | } 505 | -------------------------------------------------------------------------------- /data/models/ball.h: -------------------------------------------------------------------------------- 1 | Lights1 ball_Material_001_f3d_lights = gdSPDefLights1( 2 | 0x7F, 0x7F, 0x7F, 3 | 0xFE, 0xFE, 0xFE, 0x28, 0x28, 0x28); 4 | 5 | Vtx ball_Icosphere_mesh_vtx_cull[8] = { 6 | {{{-48, -50, -50},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 7 | {{{-48, -50, 50},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 8 | {{{-48, 50, 50},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 9 | {{{-48, 50, -50},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 10 | {{{48, -50, -50},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 11 | {{{48, -50, 50},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 12 | {{{48, 50, 50},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 13 | {{{48, 50, -50},0, {-16, -16},{0x0, 0x0, 0x0, 0xFF}}}, 14 | }; 15 | 16 | Vtx ball_Icosphere_mesh_vtx_0[240] = { 17 | {{{0, -50, 0},0, {822, 1008},{0xD, 0x88, 0x28, 0xFF}}}, 18 | {{{21, -43, 15},0, {775, 927},{0xD, 0x88, 0x28, 0xFF}}}, 19 | {{{-8, -43, 25},0, {868, 927},{0xD, 0x88, 0x28, 0xFF}}}, 20 | {{{36, -22, 26},0, {729, 847},{0x59, 0xAC, 0x22, 0xFF}}}, 21 | {{{21, -43, 15},0, {682, 927},{0x59, 0xAC, 0x22, 0xFF}}}, 22 | {{{43, -26, 0},0, {636, 847},{0x59, 0xAC, 0x22, 0xFF}}}, 23 | {{{0, -50, 0},0, {77, 1008},{0xDE, 0x88, 0x19, 0xFF}}}, 24 | {{{-8, -43, 25},0, {31, 927},{0xDE, 0x88, 0x19, 0xFF}}}, 25 | {{{-26, -43, 0},0, {124, 927},{0xDE, 0x88, 0x19, 0xFF}}}, 26 | {{{0, -50, 0},0, {263, 1008},{0xDE, 0x88, 0xE7, 0xFF}}}, 27 | {{{-26, -43, 0},0, {217, 927},{0xDE, 0x88, 0xE7, 0xFF}}}, 28 | {{{-8, -43, -25},0, {310, 927},{0xDE, 0x88, 0xE7, 0xFF}}}, 29 | {{{0, -50, 0},0, {449, 1008},{0xD, 0x88, 0xD8, 0xFF}}}, 30 | {{{-8, -43, -25},0, {403, 927},{0xD, 0x88, 0xD8, 0xFF}}}, 31 | {{{21, -43, -15},0, {496, 927},{0xD, 0x88, 0xD8, 0xFF}}}, 32 | {{{36, -22, 26},0, {729, 847},{0x73, 0xD6, 0x22, 0xFF}}}, 33 | {{{43, -26, 0},0, {636, 847},{0x73, 0xD6, 0x22, 0xFF}}}, 34 | {{{48, 0, 15},0, {682, 766},{0x73, 0xD6, 0x22, 0xFF}}}, 35 | {{{-14, -22, 43},0, {915, 847},{0x3, 0xD6, 0x78, 0xFF}}}, 36 | {{{13, -26, 40},0, {822, 847},{0x3, 0xD6, 0x78, 0xFF}}}, 37 | {{{0, 0, 50},0, {868, 766},{0x3, 0xD6, 0x78, 0xFF}}}, 38 | {{{-45, -22, 0},0, {170, 847},{0x8F, 0xD6, 0x28, 0xFF}}}, 39 | {{{-34, -26, 25},0, {77, 847},{0x8F, 0xD6, 0x28, 0xFF}}}, 40 | {{{-48, 0, 15},0, {124, 766},{0x8F, 0xD6, 0x28, 0xFF}}}, 41 | {{{-14, -22, -43},0, {356, 847},{0xB7, 0xD6, 0xA1, 0xFF}}}, 42 | {{{-34, -26, -25},0, {263, 847},{0xB7, 0xD6, 0xA1, 0xFF}}}, 43 | {{{-29, 0, -40},0, {310, 766},{0xB7, 0xD6, 0xA1, 0xFF}}}, 44 | {{{36, -22, -26},0, {543, 847},{0x43, 0xD6, 0x9D, 0xFF}}}, 45 | {{{13, -26, -40},0, {449, 847},{0x43, 0xD6, 0x9D, 0xFF}}}, 46 | {{{29, 0, -40},0, {496, 766},{0x43, 0xD6, 0x9D, 0xFF}}}, 47 | {{{36, -22, 26},0, {729, 847},{0x66, 0xF0, 0x4A, 0xFF}}}, 48 | {{{48, 0, 15},0, {682, 766},{0x66, 0xF0, 0x4A, 0xFF}}}, 49 | {{{29, 0, 40},0, {775, 766},{0x66, 0xF0, 0x4A, 0xFF}}}, 50 | {{{-14, -22, 43},0, {915, 847},{0xD9, 0xF0, 0x78, 0xFF}}}, 51 | {{{0, 0, 50},0, {868, 766},{0xD9, 0xF0, 0x78, 0xFF}}}, 52 | {{{-29, 0, 40},0, {961, 766},{0xD9, 0xF0, 0x78, 0xFF}}}, 53 | {{{-45, -22, 0},0, {170, 847},{0x82, 0xF0, 0x0, 0xFF}}}, 54 | {{{-48, 0, 15},0, {124, 766},{0x82, 0xF0, 0x0, 0xFF}}}, 55 | {{{-48, 0, -15},0, {217, 766},{0x82, 0xF0, 0x0, 0xFF}}}, 56 | {{{-14, -22, -43},0, {356, 847},{0xD9, 0xF0, 0x88, 0xFF}}}, 57 | {{{-29, 0, -40},0, {310, 766},{0xD9, 0xF0, 0x88, 0xFF}}}, 58 | {{{0, 0, -50},0, {403, 766},{0xD9, 0xF0, 0x88, 0xFF}}}, 59 | {{{36, -22, -26},0, {543, 847},{0x66, 0xF0, 0xB6, 0xFF}}}, 60 | {{{29, 0, -40},0, {496, 766},{0x66, 0xF0, 0xB6, 0xFF}}}, 61 | {{{48, 0, -15},0, {589, 766},{0x66, 0xF0, 0xB6, 0xFF}}}, 62 | {{{14, 22, 43},0, {822, 686},{0x34, 0x54, 0x50, 0xFF}}}, 63 | {{{34, 26, 25},0, {729, 686},{0x34, 0x54, 0x50, 0xFF}}}, 64 | {{{8, 43, 25},0, {775, 605},{0x34, 0x54, 0x50, 0xFF}}}, 65 | {{{-36, 22, 26},0, {1008, 686},{0xC5, 0x54, 0x4A, 0xFF}}}, 66 | {{{-13, 26, 40},0, {915, 686},{0xC5, 0x54, 0x4A, 0xFF}}}, 67 | {{{-21, 43, 15},0, {961, 605},{0xC5, 0x54, 0x4A, 0xFF}}}, 68 | {{{-36, 22, -26},0, {263, 686},{0xA7, 0x54, 0xDE, 0xFF}}}, 69 | {{{-43, 26, 0},0, {170, 686},{0xA7, 0x54, 0xDE, 0xFF}}}, 70 | {{{-21, 43, -15},0, {217, 605},{0xA7, 0x54, 0xDE, 0xFF}}}, 71 | {{{14, 22, -43},0, {449, 686},{0x5, 0x54, 0xA1, 0xFF}}}, 72 | {{{-13, 26, -40},0, {356, 686},{0x5, 0x54, 0xA1, 0xFF}}}, 73 | {{{8, 43, -25},0, {403, 605},{0x5, 0x54, 0xA1, 0xFF}}}, 74 | {{{45, 22, 0},0, {636, 686},{0x5C, 0x54, 0xE7, 0xFF}}}, 75 | {{{34, 26, -25},0, {543, 686},{0x5C, 0x54, 0xE7, 0xFF}}}, 76 | {{{26, 43, 0},0, {589, 605},{0x5C, 0x54, 0xE7, 0xFF}}}, 77 | {{{26, 43, 0},0, {589, 605},{0x22, 0x78, 0xE7, 0xFF}}}, 78 | {{{8, 43, -25},0, {496, 605},{0x22, 0x78, 0xE7, 0xFF}}}, 79 | {{{0, 50, 0},0, {543, 524},{0x22, 0x78, 0xE7, 0xFF}}}, 80 | {{{26, 43, 0},0, {589, 605},{0x3E, 0x65, 0xD3, 0xFF}}}, 81 | {{{34, 26, -25},0, {543, 686},{0x3E, 0x65, 0xD3, 0xFF}}}, 82 | {{{8, 43, -25},0, {496, 605},{0x3E, 0x65, 0xD3, 0xFF}}}, 83 | {{{34, 26, -25},0, {543, 686},{0x34, 0x54, 0xB0, 0xFF}}}, 84 | {{{14, 22, -43},0, {449, 686},{0x34, 0x54, 0xB0, 0xFF}}}, 85 | {{{8, 43, -25},0, {496, 605},{0x34, 0x54, 0xB0, 0xFF}}}, 86 | {{{8, 43, -25},0, {403, 605},{0xF3, 0x78, 0xD8, 0xFF}}}, 87 | {{{-21, 43, -15},0, {310, 605},{0xF3, 0x78, 0xD8, 0xFF}}}, 88 | {{{0, 50, 0},0, {356, 524},{0xF3, 0x78, 0xD8, 0xFF}}}, 89 | {{{8, 43, -25},0, {403, 605},{0xE8, 0x65, 0xB7, 0xFF}}}, 90 | {{{-13, 26, -40},0, {356, 686},{0xE8, 0x65, 0xB7, 0xFF}}}, 91 | {{{-21, 43, -15},0, {310, 605},{0xE8, 0x65, 0xB7, 0xFF}}}, 92 | {{{-13, 26, -40},0, {356, 686},{0xC5, 0x54, 0xB6, 0xFF}}}, 93 | {{{-36, 22, -26},0, {263, 686},{0xC5, 0x54, 0xB6, 0xFF}}}, 94 | {{{-21, 43, -15},0, {310, 605},{0xC5, 0x54, 0xB6, 0xFF}}}, 95 | {{{-21, 43, -15},0, {217, 605},{0xD6, 0x78, 0x0, 0xFF}}}, 96 | {{{-21, 43, 15},0, {124, 605},{0xD6, 0x78, 0x0, 0xFF}}}, 97 | {{{0, 50, 0},0, {170, 524},{0xD6, 0x78, 0x0, 0xFF}}}, 98 | {{{-21, 43, -15},0, {217, 605},{0xB3, 0x65, 0x0, 0xFF}}}, 99 | {{{-43, 26, 0},0, {170, 686},{0xB3, 0x65, 0x0, 0xFF}}}, 100 | {{{-21, 43, 15},0, {124, 605},{0xB3, 0x65, 0x0, 0xFF}}}, 101 | {{{-43, 26, 0},0, {170, 686},{0xA7, 0x54, 0x22, 0xFF}}}, 102 | {{{-36, 22, 26},0, {77, 686},{0xA7, 0x54, 0x22, 0xFF}}}, 103 | {{{-21, 43, 15},0, {124, 605},{0xA7, 0x54, 0x22, 0xFF}}}, 104 | {{{-21, 43, 15},0, {961, 605},{0xF3, 0x78, 0x28, 0xFF}}}, 105 | {{{8, 43, 25},0, {868, 605},{0xF3, 0x78, 0x28, 0xFF}}}, 106 | {{{0, 50, 0},0, {915, 524},{0xF3, 0x78, 0x28, 0xFF}}}, 107 | {{{-21, 43, 15},0, {961, 605},{0xE8, 0x65, 0x49, 0xFF}}}, 108 | {{{-13, 26, 40},0, {915, 686},{0xE8, 0x65, 0x49, 0xFF}}}, 109 | {{{8, 43, 25},0, {868, 605},{0xE8, 0x65, 0x49, 0xFF}}}, 110 | {{{-13, 26, 40},0, {915, 686},{0x5, 0x54, 0x5F, 0xFF}}}, 111 | {{{14, 22, 43},0, {822, 686},{0x5, 0x54, 0x5F, 0xFF}}}, 112 | {{{8, 43, 25},0, {868, 605},{0x5, 0x54, 0x5F, 0xFF}}}, 113 | {{{8, 43, 25},0, {775, 605},{0x22, 0x78, 0x19, 0xFF}}}, 114 | {{{26, 43, 0},0, {682, 605},{0x22, 0x78, 0x19, 0xFF}}}, 115 | {{{0, 50, 0},0, {729, 524},{0x22, 0x78, 0x19, 0xFF}}}, 116 | {{{8, 43, 25},0, {775, 605},{0x3E, 0x65, 0x2D, 0xFF}}}, 117 | {{{34, 26, 25},0, {729, 686},{0x3E, 0x65, 0x2D, 0xFF}}}, 118 | {{{26, 43, 0},0, {682, 605},{0x3E, 0x65, 0x2D, 0xFF}}}, 119 | {{{34, 26, 25},0, {729, 686},{0x5C, 0x54, 0x19, 0xFF}}}, 120 | {{{45, 22, 0},0, {636, 686},{0x5C, 0x54, 0x19, 0xFF}}}, 121 | {{{26, 43, 0},0, {682, 605},{0x5C, 0x54, 0x19, 0xFF}}}, 122 | {{{48, 0, -15},0, {589, 766},{0x71, 0x2A, 0xD8, 0xFF}}}, 123 | {{{34, 26, -25},0, {543, 686},{0x71, 0x2A, 0xD8, 0xFF}}}, 124 | {{{45, 22, 0},0, {636, 686},{0x71, 0x2A, 0xD8, 0xFF}}}, 125 | {{{48, 0, -15},0, {589, 766},{0x65, 0x18, 0xB7, 0xFF}}}, 126 | {{{29, 0, -40},0, {496, 766},{0x65, 0x18, 0xB7, 0xFF}}}, 127 | {{{34, 26, -25},0, {543, 686},{0x65, 0x18, 0xB7, 0xFF}}}, 128 | {{{29, 0, -40},0, {496, 766},{0x49, 0x2A, 0xA1, 0xFF}}}, 129 | {{{14, 22, -43},0, {449, 686},{0x49, 0x2A, 0xA1, 0xFF}}}, 130 | {{{34, 26, -25},0, {543, 686},{0x49, 0x2A, 0xA1, 0xFF}}}, 131 | {{{0, 0, -50},0, {403, 766},{0xFD, 0x2A, 0x88, 0xFF}}}, 132 | {{{-13, 26, -40},0, {356, 686},{0xFD, 0x2A, 0x88, 0xFF}}}, 133 | {{{14, 22, -43},0, {449, 686},{0xFD, 0x2A, 0x88, 0xFF}}}, 134 | {{{0, 0, -50},0, {403, 766},{0xD9, 0x18, 0x89, 0xFF}}}, 135 | {{{-29, 0, -40},0, {310, 766},{0xD9, 0x18, 0x89, 0xFF}}}, 136 | {{{-13, 26, -40},0, {356, 686},{0xD9, 0x18, 0x89, 0xFF}}}, 137 | {{{-29, 0, -40},0, {310, 766},{0xBD, 0x2A, 0x9D, 0xFF}}}, 138 | {{{-36, 22, -26},0, {263, 686},{0xBD, 0x2A, 0x9D, 0xFF}}}, 139 | {{{-13, 26, -40},0, {356, 686},{0xBD, 0x2A, 0x9D, 0xFF}}}, 140 | {{{-48, 0, -15},0, {217, 766},{0x8D, 0x2A, 0xDE, 0xFF}}}, 141 | {{{-43, 26, 0},0, {170, 686},{0x8D, 0x2A, 0xDE, 0xFF}}}, 142 | {{{-36, 22, -26},0, {263, 686},{0x8D, 0x2A, 0xDE, 0xFF}}}, 143 | {{{-48, 0, -15},0, {217, 766},{0x83, 0x18, 0x0, 0xFF}}}, 144 | {{{-48, 0, 15},0, {124, 766},{0x83, 0x18, 0x0, 0xFF}}}, 145 | {{{-43, 26, 0},0, {170, 686},{0x83, 0x18, 0x0, 0xFF}}}, 146 | {{{-48, 0, 15},0, {124, 766},{0x8D, 0x2A, 0x22, 0xFF}}}, 147 | {{{-36, 22, 26},0, {77, 686},{0x8D, 0x2A, 0x22, 0xFF}}}, 148 | {{{-43, 26, 0},0, {170, 686},{0x8D, 0x2A, 0x22, 0xFF}}}, 149 | {{{-29, 0, 40},0, {961, 766},{0xBD, 0x2A, 0x63, 0xFF}}}, 150 | {{{-13, 26, 40},0, {915, 686},{0xBD, 0x2A, 0x63, 0xFF}}}, 151 | {{{-36, 22, 26},0, {1008, 686},{0xBD, 0x2A, 0x63, 0xFF}}}, 152 | {{{-29, 0, 40},0, {961, 766},{0xD9, 0x18, 0x77, 0xFF}}}, 153 | {{{0, 0, 50},0, {868, 766},{0xD9, 0x18, 0x77, 0xFF}}}, 154 | {{{-13, 26, 40},0, {915, 686},{0xD9, 0x18, 0x77, 0xFF}}}, 155 | {{{0, 0, 50},0, {868, 766},{0xFD, 0x2A, 0x78, 0xFF}}}, 156 | {{{14, 22, 43},0, {822, 686},{0xFD, 0x2A, 0x78, 0xFF}}}, 157 | {{{-13, 26, 40},0, {915, 686},{0xFD, 0x2A, 0x78, 0xFF}}}, 158 | {{{29, 0, 40},0, {775, 766},{0x49, 0x2A, 0x5F, 0xFF}}}, 159 | {{{34, 26, 25},0, {729, 686},{0x49, 0x2A, 0x5F, 0xFF}}}, 160 | {{{14, 22, 43},0, {822, 686},{0x49, 0x2A, 0x5F, 0xFF}}}, 161 | {{{29, 0, 40},0, {775, 766},{0x65, 0x18, 0x49, 0xFF}}}, 162 | {{{48, 0, 15},0, {682, 766},{0x65, 0x18, 0x49, 0xFF}}}, 163 | {{{34, 26, 25},0, {729, 686},{0x65, 0x18, 0x49, 0xFF}}}, 164 | {{{48, 0, 15},0, {682, 766},{0x71, 0x2A, 0x28, 0xFF}}}, 165 | {{{45, 22, 0},0, {636, 686},{0x71, 0x2A, 0x28, 0xFF}}}, 166 | {{{34, 26, 25},0, {729, 686},{0x71, 0x2A, 0x28, 0xFF}}}, 167 | {{{29, 0, -40},0, {496, 766},{0x27, 0x10, 0x88, 0xFF}}}, 168 | {{{0, 0, -50},0, {403, 766},{0x27, 0x10, 0x88, 0xFF}}}, 169 | {{{14, 22, -43},0, {449, 686},{0x27, 0x10, 0x88, 0xFF}}}, 170 | {{{29, 0, -40},0, {496, 766},{0x27, 0xE8, 0x89, 0xFF}}}, 171 | {{{13, -26, -40},0, {449, 847},{0x27, 0xE8, 0x89, 0xFF}}}, 172 | {{{0, 0, -50},0, {403, 766},{0x27, 0xE8, 0x89, 0xFF}}}, 173 | {{{13, -26, -40},0, {449, 847},{0x3, 0xD6, 0x88, 0xFF}}}, 174 | {{{-14, -22, -43},0, {356, 847},{0x3, 0xD6, 0x88, 0xFF}}}, 175 | {{{0, 0, -50},0, {403, 766},{0x3, 0xD6, 0x88, 0xFF}}}, 176 | {{{-29, 0, -40},0, {310, 766},{0x9A, 0x10, 0xB6, 0xFF}}}, 177 | {{{-48, 0, -15},0, {217, 766},{0x9A, 0x10, 0xB6, 0xFF}}}, 178 | {{{-36, 22, -26},0, {263, 686},{0x9A, 0x10, 0xB6, 0xFF}}}, 179 | {{{-29, 0, -40},0, {310, 766},{0x9B, 0xE8, 0xB7, 0xFF}}}, 180 | {{{-34, -26, -25},0, {263, 847},{0x9B, 0xE8, 0xB7, 0xFF}}}, 181 | {{{-48, 0, -15},0, {217, 766},{0x9B, 0xE8, 0xB7, 0xFF}}}, 182 | {{{-34, -26, -25},0, {263, 847},{0x8F, 0xD6, 0xD8, 0xFF}}}, 183 | {{{-45, -22, 0},0, {170, 847},{0x8F, 0xD6, 0xD8, 0xFF}}}, 184 | {{{-48, 0, -15},0, {217, 766},{0x8F, 0xD6, 0xD8, 0xFF}}}, 185 | {{{-48, 0, 15},0, {124, 766},{0x9A, 0x10, 0x4A, 0xFF}}}, 186 | {{{-29, 0, 40},0, {31, 766},{0x9A, 0x10, 0x4A, 0xFF}}}, 187 | {{{-36, 22, 26},0, {77, 686},{0x9A, 0x10, 0x4A, 0xFF}}}, 188 | {{{-48, 0, 15},0, {124, 766},{0x9B, 0xE8, 0x49, 0xFF}}}, 189 | {{{-34, -26, 25},0, {77, 847},{0x9B, 0xE8, 0x49, 0xFF}}}, 190 | {{{-29, 0, 40},0, {31, 766},{0x9B, 0xE8, 0x49, 0xFF}}}, 191 | {{{-34, -26, 25},0, {77, 847},{0xB7, 0xD6, 0x5F, 0xFF}}}, 192 | {{{-14, -22, 43},0, {-16, 847},{0xB7, 0xD6, 0x5F, 0xFF}}}, 193 | {{{-29, 0, 40},0, {31, 766},{0xB7, 0xD6, 0x5F, 0xFF}}}, 194 | {{{0, 0, 50},0, {868, 766},{0x27, 0x10, 0x78, 0xFF}}}, 195 | {{{29, 0, 40},0, {775, 766},{0x27, 0x10, 0x78, 0xFF}}}, 196 | {{{14, 22, 43},0, {822, 686},{0x27, 0x10, 0x78, 0xFF}}}, 197 | {{{0, 0, 50},0, {868, 766},{0x27, 0xE8, 0x77, 0xFF}}}, 198 | {{{13, -26, 40},0, {822, 847},{0x27, 0xE8, 0x77, 0xFF}}}, 199 | {{{29, 0, 40},0, {775, 766},{0x27, 0xE8, 0x77, 0xFF}}}, 200 | {{{13, -26, 40},0, {822, 847},{0x43, 0xD6, 0x63, 0xFF}}}, 201 | {{{36, -22, 26},0, {729, 847},{0x43, 0xD6, 0x63, 0xFF}}}, 202 | {{{29, 0, 40},0, {775, 766},{0x43, 0xD6, 0x63, 0xFF}}}, 203 | {{{48, 0, 15},0, {682, 766},{0x7E, 0x10, 0x0, 0xFF}}}, 204 | {{{48, 0, -15},0, {589, 766},{0x7E, 0x10, 0x0, 0xFF}}}, 205 | {{{45, 22, 0},0, {636, 686},{0x7E, 0x10, 0x0, 0xFF}}}, 206 | {{{48, 0, 15},0, {682, 766},{0x7D, 0xE8, 0x0, 0xFF}}}, 207 | {{{43, -26, 0},0, {636, 847},{0x7D, 0xE8, 0x0, 0xFF}}}, 208 | {{{48, 0, -15},0, {589, 766},{0x7D, 0xE8, 0x0, 0xFF}}}, 209 | {{{43, -26, 0},0, {636, 847},{0x73, 0xD6, 0xDE, 0xFF}}}, 210 | {{{36, -22, -26},0, {543, 847},{0x73, 0xD6, 0xDE, 0xFF}}}, 211 | {{{48, 0, -15},0, {589, 766},{0x73, 0xD6, 0xDE, 0xFF}}}, 212 | {{{21, -43, -15},0, {496, 927},{0x3B, 0xAC, 0xB6, 0xFF}}}, 213 | {{{13, -26, -40},0, {449, 847},{0x3B, 0xAC, 0xB6, 0xFF}}}, 214 | {{{36, -22, -26},0, {543, 847},{0x3B, 0xAC, 0xB6, 0xFF}}}, 215 | {{{21, -43, -15},0, {496, 927},{0x18, 0x9B, 0xB7, 0xFF}}}, 216 | {{{-8, -43, -25},0, {403, 927},{0x18, 0x9B, 0xB7, 0xFF}}}, 217 | {{{13, -26, -40},0, {449, 847},{0x18, 0x9B, 0xB7, 0xFF}}}, 218 | {{{-8, -43, -25},0, {403, 927},{0xFB, 0xAC, 0xA1, 0xFF}}}, 219 | {{{-14, -22, -43},0, {356, 847},{0xFB, 0xAC, 0xA1, 0xFF}}}, 220 | {{{13, -26, -40},0, {449, 847},{0xFB, 0xAC, 0xA1, 0xFF}}}, 221 | {{{-8, -43, -25},0, {310, 927},{0xCC, 0xAC, 0xB0, 0xFF}}}, 222 | {{{-34, -26, -25},0, {263, 847},{0xCC, 0xAC, 0xB0, 0xFF}}}, 223 | {{{-14, -22, -43},0, {356, 847},{0xCC, 0xAC, 0xB0, 0xFF}}}, 224 | {{{-8, -43, -25},0, {310, 927},{0xC2, 0x9B, 0xD3, 0xFF}}}, 225 | {{{-26, -43, 0},0, {217, 927},{0xC2, 0x9B, 0xD3, 0xFF}}}, 226 | {{{-34, -26, -25},0, {263, 847},{0xC2, 0x9B, 0xD3, 0xFF}}}, 227 | {{{-26, -43, 0},0, {217, 927},{0xA4, 0xAC, 0xE7, 0xFF}}}, 228 | {{{-45, -22, 0},0, {170, 847},{0xA4, 0xAC, 0xE7, 0xFF}}}, 229 | {{{-34, -26, -25},0, {263, 847},{0xA4, 0xAC, 0xE7, 0xFF}}}, 230 | {{{-26, -43, 0},0, {124, 927},{0xA4, 0xAC, 0x19, 0xFF}}}, 231 | {{{-34, -26, 25},0, {77, 847},{0xA4, 0xAC, 0x19, 0xFF}}}, 232 | {{{-45, -22, 0},0, {170, 847},{0xA4, 0xAC, 0x19, 0xFF}}}, 233 | {{{-26, -43, 0},0, {124, 927},{0xC2, 0x9B, 0x2D, 0xFF}}}, 234 | {{{-8, -43, 25},0, {31, 927},{0xC2, 0x9B, 0x2D, 0xFF}}}, 235 | {{{-34, -26, 25},0, {77, 847},{0xC2, 0x9B, 0x2D, 0xFF}}}, 236 | {{{-8, -43, 25},0, {31, 927},{0xCC, 0xAC, 0x50, 0xFF}}}, 237 | {{{-14, -22, 43},0, {-16, 847},{0xCC, 0xAC, 0x50, 0xFF}}}, 238 | {{{-34, -26, 25},0, {77, 847},{0xCC, 0xAC, 0x50, 0xFF}}}, 239 | {{{43, -26, 0},0, {636, 847},{0x59, 0xAC, 0xDE, 0xFF}}}, 240 | {{{21, -43, -15},0, {589, 927},{0x59, 0xAC, 0xDE, 0xFF}}}, 241 | {{{36, -22, -26},0, {543, 847},{0x59, 0xAC, 0xDE, 0xFF}}}, 242 | {{{43, -26, 0},0, {636, 847},{0x4D, 0x9B, 0x0, 0xFF}}}, 243 | {{{21, -43, 15},0, {682, 927},{0x4D, 0x9B, 0x0, 0xFF}}}, 244 | {{{21, -43, -15},0, {589, 927},{0x4D, 0x9B, 0x0, 0xFF}}}, 245 | {{{21, -43, 15},0, {682, 927},{0x2A, 0x88, 0x0, 0xFF}}}, 246 | {{{0, -50, 0},0, {636, 1008},{0x2A, 0x88, 0x0, 0xFF}}}, 247 | {{{21, -43, -15},0, {589, 927},{0x2A, 0x88, 0x0, 0xFF}}}, 248 | {{{-8, -43, 25},0, {868, 927},{0xFB, 0xAC, 0x5F, 0xFF}}}, 249 | {{{13, -26, 40},0, {822, 847},{0xFB, 0xAC, 0x5F, 0xFF}}}, 250 | {{{-14, -22, 43},0, {915, 847},{0xFB, 0xAC, 0x5F, 0xFF}}}, 251 | {{{-8, -43, 25},0, {868, 927},{0x18, 0x9B, 0x49, 0xFF}}}, 252 | {{{21, -43, 15},0, {775, 927},{0x18, 0x9B, 0x49, 0xFF}}}, 253 | {{{13, -26, 40},0, {822, 847},{0x18, 0x9B, 0x49, 0xFF}}}, 254 | {{{21, -43, 15},0, {775, 927},{0x3B, 0xAC, 0x4A, 0xFF}}}, 255 | {{{36, -22, 26},0, {729, 847},{0x3B, 0xAC, 0x4A, 0xFF}}}, 256 | {{{13, -26, 40},0, {822, 847},{0x3B, 0xAC, 0x4A, 0xFF}}}, 257 | }; 258 | 259 | Gfx ball_Icosphere_mesh_tri_0[] = { 260 | gsSPVertex(ball_Icosphere_mesh_vtx_0 + 0, 30, 0), 261 | gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0), 262 | gsSP2Triangles(6, 7, 8, 0, 9, 10, 11, 0), 263 | gsSP2Triangles(12, 13, 14, 0, 15, 16, 17, 0), 264 | gsSP2Triangles(18, 19, 20, 0, 21, 22, 23, 0), 265 | gsSP2Triangles(24, 25, 26, 0, 27, 28, 29, 0), 266 | gsSPVertex(ball_Icosphere_mesh_vtx_0 + 30, 30, 0), 267 | gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0), 268 | gsSP2Triangles(6, 7, 8, 0, 9, 10, 11, 0), 269 | gsSP2Triangles(12, 13, 14, 0, 15, 16, 17, 0), 270 | gsSP2Triangles(18, 19, 20, 0, 21, 22, 23, 0), 271 | gsSP2Triangles(24, 25, 26, 0, 27, 28, 29, 0), 272 | gsSPVertex(ball_Icosphere_mesh_vtx_0 + 60, 30, 0), 273 | gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0), 274 | gsSP2Triangles(6, 7, 8, 0, 9, 10, 11, 0), 275 | gsSP2Triangles(12, 13, 14, 0, 15, 16, 17, 0), 276 | gsSP2Triangles(18, 19, 20, 0, 21, 22, 23, 0), 277 | gsSP2Triangles(24, 25, 26, 0, 27, 28, 29, 0), 278 | gsSPVertex(ball_Icosphere_mesh_vtx_0 + 90, 30, 0), 279 | gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0), 280 | gsSP2Triangles(6, 7, 8, 0, 9, 10, 11, 0), 281 | gsSP2Triangles(12, 13, 14, 0, 15, 16, 17, 0), 282 | gsSP2Triangles(18, 19, 20, 0, 21, 22, 23, 0), 283 | gsSP2Triangles(24, 25, 26, 0, 27, 28, 29, 0), 284 | gsSPVertex(ball_Icosphere_mesh_vtx_0 + 120, 30, 0), 285 | gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0), 286 | gsSP2Triangles(6, 7, 8, 0, 9, 10, 11, 0), 287 | gsSP2Triangles(12, 13, 14, 0, 15, 16, 17, 0), 288 | gsSP2Triangles(18, 19, 20, 0, 21, 22, 23, 0), 289 | gsSP2Triangles(24, 25, 26, 0, 27, 28, 29, 0), 290 | gsSPVertex(ball_Icosphere_mesh_vtx_0 + 150, 30, 0), 291 | gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0), 292 | gsSP2Triangles(6, 7, 8, 0, 9, 10, 11, 0), 293 | gsSP2Triangles(12, 13, 14, 0, 15, 16, 17, 0), 294 | gsSP2Triangles(18, 19, 20, 0, 21, 22, 23, 0), 295 | gsSP2Triangles(24, 25, 26, 0, 27, 28, 29, 0), 296 | gsSPVertex(ball_Icosphere_mesh_vtx_0 + 180, 30, 0), 297 | gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0), 298 | gsSP2Triangles(6, 7, 8, 0, 9, 10, 11, 0), 299 | gsSP2Triangles(12, 13, 14, 0, 15, 16, 17, 0), 300 | gsSP2Triangles(18, 19, 20, 0, 21, 22, 23, 0), 301 | gsSP2Triangles(24, 25, 26, 0, 27, 28, 29, 0), 302 | gsSPVertex(ball_Icosphere_mesh_vtx_0 + 210, 30, 0), 303 | gsSP2Triangles(0, 1, 2, 0, 3, 4, 5, 0), 304 | gsSP2Triangles(6, 7, 8, 0, 9, 10, 11, 0), 305 | gsSP2Triangles(12, 13, 14, 0, 15, 16, 17, 0), 306 | gsSP2Triangles(18, 19, 20, 0, 21, 22, 23, 0), 307 | gsSP2Triangles(24, 25, 26, 0, 27, 28, 29, 0), 308 | gsSPEndDisplayList(), 309 | }; 310 | 311 | 312 | Gfx mat_ball_Material_001_f3d[] = { 313 | gsDPPipeSync(), 314 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 315 | gsSPTexture(65535, 65535, 0, 0, 1), 316 | gsSPSetLights1(ball_Material_001_f3d_lights), 317 | gsSPEndDisplayList(), 318 | }; 319 | 320 | 321 | Gfx ball_Icosphere_mesh[] = { 322 | gsSPClearGeometryMode(G_LIGHTING), 323 | gsSPVertex(ball_Icosphere_mesh_vtx_cull + 0, 8, 0), 324 | gsSPSetGeometryMode(G_LIGHTING), 325 | gsSPCullDisplayList(0, 7), 326 | gsSPDisplayList(mat_ball_Material_001_f3d), 327 | gsSPDisplayList(ball_Icosphere_mesh_tri_0), 328 | gsDPPipeSync(), 329 | gsSPSetGeometryMode(G_LIGHTING), 330 | gsSPClearGeometryMode(G_TEXTURE_GEN), 331 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 332 | gsSPTexture(65535, 65535, 0, 0, 0), 333 | gsSPEndDisplayList(), 334 | }; 335 | 336 | 337 | 338 | -------------------------------------------------------------------------------- /data/models/brick.h: -------------------------------------------------------------------------------- 1 | Lights1 brick_Material_001_f3d_lights = gdSPDefLights1( 2 | 0x7F, 0x7F, 0x7F, 3 | 0xFE, 0xFE, 0xFE, 0x28, 0x28, 0x28); 4 | 5 | Gfx pink_tex_aligner[] = {gsSPEndDisplayList()}; 6 | u8 pink_tex[] = { 7 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 8 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 9 | 0x0, 0x0, 0x0, 0x0, 0x1, 0x22, 0x22, 0x10, 0x0, 10 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 11 | 0x0, 0x0, 0x2, 0x34, 0x43, 0x20, 0x0, 0x0, 0x0, 12 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 13 | 0x2, 0x56, 0x64, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 14 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x56, 15 | 0x64, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 16 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x35, 0x53, 0x20, 17 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 18 | 0x0, 0x0, 0x0, 0x1, 0x22, 0x22, 0x10, 0x0, 0x0, 19 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 20 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 21 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 22 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 23 | 0x0, 0x0, 0x1, 0x22, 0x22, 0x10, 0x1, 0x22, 0x22, 24 | 0x10, 0x1, 0x22, 0x22, 0x10, 0x0, 0x0, 0x0, 0x0, 25 | 0x2, 0x34, 0x43, 0x20, 0x2, 0x34, 0x43, 0x20, 0x2, 26 | 0x34, 0x43, 0x20, 0x0, 0x0, 0x0, 0x0, 0x2, 0x56, 27 | 0x64, 0x20, 0x2, 0x56, 0x64, 0x20, 0x2, 0x46, 0x64, 28 | 0x20, 0x0, 0x0, 0x0, 0x0, 0x2, 0x56, 0x64, 0x20, 29 | 0x2, 0x56, 0x64, 0x20, 0x2, 0x56, 0x64, 0x20, 0x0, 30 | 0x0, 0x0, 0x0, 0x2, 0x35, 0x53, 0x20, 0x2, 0x35, 31 | 0x43, 0x20, 0x2, 0x35, 0x53, 0x20, 0x0, 0x0, 0x0, 32 | 0x0, 0x1, 0x22, 0x22, 0x10, 0x1, 0x22, 0x22, 0x10, 33 | 0x1, 0x22, 0x22, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 34 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 35 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 36 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 37 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 38 | 0x22, 0x22, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 39 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x34, 0x43, 40 | 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 41 | 0x0, 0x0, 0x0, 0x0, 0x2, 0x46, 0x64, 0x20, 0x0, 42 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 43 | 0x0, 0x0, 0x2, 0x46, 0x65, 0x20, 0x0, 0x0, 0x0, 44 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 45 | 0x2, 0x35, 0x53, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 46 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x22, 47 | 0x22, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 48 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 49 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 50 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 51 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 52 | 0x0, 0x1, 0x22, 0x22, 0x10, 0x0, 0x0, 0x0, 0x0, 53 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 54 | 0x34, 0x43, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 55 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x56, 0x64, 56 | 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 57 | 0x0, 0x0, 0x0, 0x0, 0x2, 0x56, 0x64, 0x20, 0x0, 58 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 59 | 0x0, 0x0, 0x2, 0x35, 0x53, 0x20, 0x0, 0x0, 0x0, 60 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 61 | 0x1, 0x22, 0x22, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 62 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 63 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 64 | }; 65 | 66 | Gfx pink_tex_pal_rgba16_aligner[] = {gsSPEndDisplayList()}; 67 | u8 pink_tex_pal_rgba16[] = { 68 | 0x0, 0x1, 0xFA, 0x65, 0xFA, 0xA5, 0xFA, 0xE7, 0xFB, 69 | 0x27, 0xFB, 0x29, 0xFB, 0x69, 70 | }; 71 | 72 | Gfx orange_tex_aligner[] = {gsSPEndDisplayList()}; 73 | u8 orange_tex[] = { 74 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 75 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 76 | 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 77 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 78 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 79 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 80 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 81 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 82 | 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 83 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 84 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 85 | 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 86 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 87 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 88 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 89 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 90 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 91 | 0x10, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 92 | 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x1, 93 | 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 94 | 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 95 | 0x10, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 96 | 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x0, 97 | 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 98 | 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 99 | 0x0, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 100 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 101 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 102 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 103 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 104 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 105 | 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 106 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 107 | 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 108 | 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 109 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 110 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 111 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 112 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 113 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 114 | 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 115 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 116 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 117 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 118 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 119 | 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 120 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 121 | 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 122 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 123 | 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 124 | 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 125 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 126 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 127 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 128 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 129 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 130 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 131 | }; 132 | 133 | Gfx orange_tex_pal_rgba16_aligner[] = {gsSPEndDisplayList()}; 134 | u8 orange_tex_pal_rgba16[] = { 135 | 0x0, 0x1, 0xFC, 0x53, 136 | }; 137 | 138 | Gfx yellow_tex_aligner[] = {gsSPEndDisplayList()}; 139 | u8 yellow_tex[] = { 140 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 141 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 142 | 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 143 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 144 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 145 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 146 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 147 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 148 | 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 149 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 150 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 151 | 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 152 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 153 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 154 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 155 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 156 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 157 | 0x10, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 158 | 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x1, 159 | 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 160 | 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 161 | 0x10, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 162 | 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x0, 163 | 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 164 | 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 165 | 0x0, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 166 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 167 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 168 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 169 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 170 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 171 | 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 172 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 173 | 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 174 | 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 175 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 176 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 177 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 178 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 179 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 180 | 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 181 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 182 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 183 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 184 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 185 | 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 186 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 187 | 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 188 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 189 | 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 190 | 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 191 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 192 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 193 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 194 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 195 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 196 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 197 | }; 198 | 199 | Gfx yellow_tex_pal_rgba16_aligner[] = {gsSPEndDisplayList()}; 200 | u8 yellow_tex_pal_rgba16[] = { 201 | 0x0, 0x1, 0xFF, 0x13, 202 | }; 203 | 204 | Gfx green_tex_aligner[] = {gsSPEndDisplayList()}; 205 | u8 green_tex[] = { 206 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 207 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 208 | 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 209 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 210 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 211 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 212 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 213 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 214 | 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 215 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 216 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 217 | 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 218 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 219 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 220 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 221 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 222 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 223 | 0x10, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 224 | 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x1, 225 | 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 226 | 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 227 | 0x10, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 228 | 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x0, 229 | 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 230 | 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 231 | 0x0, 0x1, 0x11, 0x11, 0x10, 0x1, 0x11, 0x11, 0x10, 232 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 233 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 234 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 235 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 236 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 237 | 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 238 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 239 | 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 240 | 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 241 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 242 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 243 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 244 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 245 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 246 | 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 247 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 248 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 249 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 250 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 251 | 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 252 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 253 | 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 254 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 255 | 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 256 | 0x0, 0x0, 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 257 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 258 | 0x0, 0x0, 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 259 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 260 | 0x1, 0x11, 0x11, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 261 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 262 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 263 | }; 264 | 265 | Gfx green_tex_pal_rgba16_aligner[] = {gsSPEndDisplayList()}; 266 | u8 green_tex_pal_rgba16[] = { 267 | 0x0, 0x1, 0x87, 0xD3, 268 | }; 269 | 270 | Vtx brick_Cube_mesh_vtx_0[24] = { 271 | {{{-100, -100, 100},0, {368, 1008},{0x81, 0x0, 0x0, 0xFF}}}, 272 | {{{-100, 100, 100},0, {624, 1008},{0x81, 0x0, 0x0, 0xFF}}}, 273 | {{{-100, 100, -100},0, {624, 752},{0x81, 0x0, 0x0, 0xFF}}}, 274 | {{{-100, -100, -100},0, {368, 752},{0x81, 0x0, 0x0, 0xFF}}}, 275 | {{{-100, -100, -100},0, {368, 752},{0x0, 0x0, 0x81, 0xFF}}}, 276 | {{{-100, 100, -100},0, {624, 752},{0x0, 0x0, 0x81, 0xFF}}}, 277 | {{{100, 100, -100},0, {624, 496},{0x0, 0x0, 0x81, 0xFF}}}, 278 | {{{100, -100, -100},0, {368, 496},{0x0, 0x0, 0x81, 0xFF}}}, 279 | {{{100, -100, -100},0, {368, 496},{0x7F, 0x0, 0x0, 0xFF}}}, 280 | {{{100, 100, -100},0, {624, 496},{0x7F, 0x0, 0x0, 0xFF}}}, 281 | {{{100, 100, 100},0, {624, 240},{0x7F, 0x0, 0x0, 0xFF}}}, 282 | {{{100, -100, 100},0, {368, 240},{0x7F, 0x0, 0x0, 0xFF}}}, 283 | {{{100, -100, 100},0, {368, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 284 | {{{100, 100, 100},0, {624, 240},{0x0, 0x0, 0x7F, 0xFF}}}, 285 | {{{-100, 100, 100},0, {624, -16},{0x0, 0x0, 0x7F, 0xFF}}}, 286 | {{{-100, -100, 100},0, {368, -16},{0x0, 0x0, 0x7F, 0xFF}}}, 287 | {{{-100, -100, -100},0, {112, 496},{0x0, 0x81, 0x0, 0xFF}}}, 288 | {{{100, -100, -100},0, {368, 496},{0x0, 0x81, 0x0, 0xFF}}}, 289 | {{{100, -100, 100},0, {368, 240},{0x0, 0x81, 0x0, 0xFF}}}, 290 | {{{-100, -100, 100},0, {112, 240},{0x0, 0x81, 0x0, 0xFF}}}, 291 | {{{100, 100, -100},0, {624, 496},{0x0, 0x7F, 0x0, 0xFF}}}, 292 | {{{-100, 100, -100},0, {880, 496},{0x0, 0x7F, 0x0, 0xFF}}}, 293 | {{{-100, 100, 100},0, {880, 240},{0x0, 0x7F, 0x0, 0xFF}}}, 294 | {{{100, 100, 100},0, {624, 240},{0x0, 0x7F, 0x0, 0xFF}}}, 295 | }; 296 | 297 | Gfx brick_Cube_mesh_tri_0[] = { 298 | gsSPVertex(brick_Cube_mesh_vtx_0 + 0, 16, 0), 299 | gsSP1Triangle(0, 1, 2, 0), 300 | gsSP1Triangle(0, 2, 3, 0), 301 | gsSP1Triangle(4, 5, 6, 0), 302 | gsSP1Triangle(4, 6, 7, 0), 303 | gsSP1Triangle(8, 9, 10, 0), 304 | gsSP1Triangle(8, 10, 11, 0), 305 | gsSP1Triangle(12, 13, 14, 0), 306 | gsSP1Triangle(12, 14, 15, 0), 307 | gsSPVertex(brick_Cube_mesh_vtx_0 + 16, 8, 0), 308 | gsSP1Triangle(0, 1, 2, 0), 309 | gsSP1Triangle(0, 2, 3, 0), 310 | gsSP1Triangle(4, 5, 6, 0), 311 | gsSP1Triangle(4, 6, 7, 0), 312 | gsSPEndDisplayList(), 313 | }; 314 | 315 | Gfx mat_brick_Material_pink_f3d[] = { 316 | gsDPPipeSync(), 317 | gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT, TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT), 318 | gsSPTexture(65535, 65535, 0, 0, 1), 319 | gsDPSetTextureLUT(G_TT_RGBA16), 320 | gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, pink_tex_pal_rgba16), 321 | gsDPTileSync(), 322 | gsDPSetTile(0, 0, 0, 256, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0), 323 | gsDPLoadSync(), 324 | gsDPLoadTLUTCmd(7, 6), 325 | gsDPPipeSync(), 326 | gsDPTileSync(), 327 | gsDPSetTextureImage(G_IM_FMT_CI, G_IM_SIZ_8b, 16, pink_tex), 328 | gsDPSetTile(G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0), 329 | gsDPLoadSync(), 330 | gsDPLoadTile(7, 0, 0, 62, 124), 331 | gsDPPipeSync(), 332 | gsDPSetTile(G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0), 333 | gsDPSetTileSize(0, 0, 0, 124, 124), 334 | gsSPSetLights1(brick_Material_001_f3d_lights), 335 | gsSPEndDisplayList(), 336 | }; 337 | 338 | Gfx mat_brick_Material_orange_f3d[] = { 339 | gsDPPipeSync(), 340 | gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT, TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT), 341 | gsSPTexture(65535, 65535, 0, 0, 1), 342 | gsDPSetTextureLUT(G_TT_RGBA16), 343 | gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, orange_tex_pal_rgba16), 344 | gsDPTileSync(), 345 | gsDPSetTile(0, 0, 0, 256, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0), 346 | gsDPLoadSync(), 347 | gsDPLoadTLUTCmd(7, 1), 348 | gsDPPipeSync(), 349 | gsDPTileSync(), 350 | gsDPSetTextureImage(G_IM_FMT_CI, G_IM_SIZ_8b, 16, orange_tex), 351 | gsDPSetTile(G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0), 352 | gsDPLoadSync(), 353 | gsDPLoadTile(7, 0, 0, 62, 124), 354 | gsDPPipeSync(), 355 | gsDPSetTile(G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0), 356 | gsDPSetTileSize(0, 0, 0, 124, 124), 357 | gsSPSetLights1(brick_Material_001_f3d_lights), 358 | gsSPEndDisplayList(), 359 | }; 360 | 361 | Gfx mat_brick_Material_yellow_f3d[] = { 362 | gsDPPipeSync(), 363 | gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT, TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT), 364 | gsSPTexture(65535, 65535, 0, 0, 1), 365 | gsDPSetTextureLUT(G_TT_RGBA16), 366 | gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, yellow_tex_pal_rgba16), 367 | gsDPTileSync(), 368 | gsDPSetTile(0, 0, 0, 256, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0), 369 | gsDPLoadSync(), 370 | gsDPLoadTLUTCmd(7, 1), 371 | gsDPPipeSync(), 372 | gsDPTileSync(), 373 | gsDPSetTextureImage(G_IM_FMT_CI, G_IM_SIZ_8b, 16, yellow_tex), 374 | gsDPSetTile(G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0), 375 | gsDPLoadSync(), 376 | gsDPLoadTile(7, 0, 0, 62, 124), 377 | gsDPPipeSync(), 378 | gsDPSetTile(G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0), 379 | gsDPSetTileSize(0, 0, 0, 124, 124), 380 | gsSPSetLights1(brick_Material_001_f3d_lights), 381 | gsSPEndDisplayList(), 382 | }; 383 | 384 | Gfx mat_brick_Material_green_f3d[] = { 385 | gsDPPipeSync(), 386 | gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT, TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT), 387 | gsSPTexture(65535, 65535, 0, 0, 1), 388 | gsDPSetTextureLUT(G_TT_RGBA16), 389 | gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, green_tex_pal_rgba16), 390 | gsDPTileSync(), 391 | gsDPSetTile(0, 0, 0, 256, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0), 392 | gsDPLoadSync(), 393 | gsDPLoadTLUTCmd(7, 1), 394 | gsDPPipeSync(), 395 | gsDPTileSync(), 396 | gsDPSetTextureImage(G_IM_FMT_CI, G_IM_SIZ_8b, 16, green_tex), 397 | gsDPSetTile(G_IM_FMT_CI, G_IM_SIZ_8b, 2, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0), 398 | gsDPLoadSync(), 399 | gsDPLoadTile(7, 0, 0, 62, 124), 400 | gsDPPipeSync(), 401 | gsDPSetTile(G_IM_FMT_CI, G_IM_SIZ_4b, 2, 0, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0), 402 | gsDPSetTileSize(0, 0, 0, 124, 124), 403 | gsSPSetLights1(brick_Material_001_f3d_lights), 404 | gsSPEndDisplayList(), 405 | }; 406 | 407 | Gfx mat_revert_brick_Material_001_f3d[] = { 408 | gsDPPipeSync(), 409 | gsDPSetTextureLUT(G_TT_NONE), 410 | gsSPEndDisplayList(), 411 | }; 412 | 413 | Gfx brick_Cube_mesh_pink[] = { 414 | gsSPDisplayList(mat_brick_Material_pink_f3d), 415 | gsSPDisplayList(brick_Cube_mesh_tri_0), 416 | gsSPDisplayList(mat_revert_brick_Material_001_f3d), 417 | gsDPPipeSync(), 418 | gsSPSetGeometryMode(G_LIGHTING), 419 | gsSPClearGeometryMode(G_TEXTURE_GEN), 420 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 421 | gsSPTexture(65535, 65535, 0, 0, 0), 422 | gsSPEndDisplayList(), 423 | }; 424 | 425 | Gfx brick_Cube_mesh_orange[] = { 426 | gsSPDisplayList(mat_brick_Material_orange_f3d), 427 | gsSPDisplayList(brick_Cube_mesh_tri_0), 428 | gsSPDisplayList(mat_revert_brick_Material_001_f3d), 429 | gsDPPipeSync(), 430 | gsSPSetGeometryMode(G_LIGHTING), 431 | gsSPClearGeometryMode(G_TEXTURE_GEN), 432 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 433 | gsSPTexture(65535, 65535, 0, 0, 0), 434 | gsSPEndDisplayList(), 435 | }; 436 | 437 | Gfx brick_Cube_mesh_yellow[] = { 438 | gsSPDisplayList(mat_brick_Material_yellow_f3d), 439 | gsSPDisplayList(brick_Cube_mesh_tri_0), 440 | gsSPDisplayList(mat_revert_brick_Material_001_f3d), 441 | gsDPPipeSync(), 442 | gsSPSetGeometryMode(G_LIGHTING), 443 | gsSPClearGeometryMode(G_TEXTURE_GEN), 444 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 445 | gsSPTexture(65535, 65535, 0, 0, 0), 446 | gsSPEndDisplayList(), 447 | }; 448 | 449 | Gfx brick_Cube_mesh_green[] = { 450 | gsSPDisplayList(mat_brick_Material_green_f3d), 451 | gsSPDisplayList(brick_Cube_mesh_tri_0), 452 | gsSPDisplayList(mat_revert_brick_Material_001_f3d), 453 | gsDPPipeSync(), 454 | gsSPSetGeometryMode(G_LIGHTING), 455 | gsSPClearGeometryMode(G_TEXTURE_GEN), 456 | gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), 457 | gsSPTexture(65535, 65535, 0, 0, 0), 458 | gsSPEndDisplayList(), 459 | }; 460 | --------------------------------------------------------------------------------