diff --git a/include/config.h b/include/config.h index b1d73227..508d769e 100644 --- a/include/config.h +++ b/include/config.h @@ -121,6 +121,11 @@ // Decides the warp node "exit course" takes you to (has no effect if you disable exit course) #define EXIT_COURSE_NODE 0x1F +// OTHER ENHANCEMENTS +//Skybox size modifier, changing this will add support for larger skybox images. NOTE: Vanilla skyboxes may break if you change this option. Be sure to rescale them accordingly. +//Whenever you change this, make sure to run "make -C tools clean" to rebuild the skybox tool (alternatively go into skyconv.c and change the file in any way (like adding/deleting a space) to specifically rebuild that tool). +#define SKYBOX_SIZE 1 + // If you want to change the extended boundaries mode, go to engine/extended_bounds.h and change EXTENDED_BOUNDS_MODE #endif // CONFIG_H diff --git a/src/game/skybox.c b/src/game/skybox.c index 1cf58f5c..4cf27712 100644 --- a/src/game/skybox.c +++ b/src/game/skybox.c @@ -60,7 +60,7 @@ struct Skybox { struct Skybox sSkyBoxInfo[2]; -typedef const u8 *const SkyboxTexture[80]; +typedef const u8 *const SkyboxTexture[80 * SKYBOX_SIZE]; extern SkyboxTexture bbh_skybox_ptrlist; extern SkyboxTexture bidw_skybox_ptrlist; @@ -108,21 +108,21 @@ u8 sSkyboxColors[][3] = { * The tile's width in world space. * By default, two full tiles can fit in the screen. */ -#define SKYBOX_TILE_WIDTH (SCREEN_WIDTH / 2) +#define SKYBOX_TILE_WIDTH (SCREEN_WIDTH / (2 * SKYBOX_SIZE)) /** * The tile's height in world space. * By default, two full tiles can fit in the screen. */ -#define SKYBOX_TILE_HEIGHT (SCREEN_HEIGHT / 2) +#define SKYBOX_TILE_HEIGHT (SCREEN_HEIGHT / (2 * SKYBOX_SIZE)) /** * The horizontal length of the skybox tilemap in tiles. */ -#define SKYBOX_COLS (10) +#define SKYBOX_COLS (10 * SKYBOX_SIZE) /** * The vertical length of the skybox tilemap in tiles. */ -#define SKYBOX_ROWS (8) +#define SKYBOX_ROWS (8 * SKYBOX_SIZE) /** @@ -165,7 +165,7 @@ s32 calculate_skybox_scaled_y(s8 player, UNUSED f32 fov) { // Since pitch can be negative, and the tile grid starts 1 octant above the camera's focus, add // 5 octants to the y position - s32 scaledY = roundedY + 5 * SKYBOX_TILE_HEIGHT; + s32 scaledY = roundedY + (5 * SKYBOX_SIZE) * SKYBOX_TILE_HEIGHT; if (scaledY > SKYBOX_HEIGHT) { scaledY = SKYBOX_HEIGHT; @@ -221,8 +221,8 @@ void draw_skybox_tile_grid(Gfx **dlist, s8 background, s8 player, s8 colorIndex) s32 row; s32 col; - for (row = 0; row < 3; row++) { - for (col = 0; col < 3; col++) { + for (row = 0; row < (3 * SKYBOX_SIZE); row++) { + for (col = 0; col < (3 * SKYBOX_SIZE); col++) { s32 tileIndex = sSkyBoxInfo[player].upperLeftTile + row * SKYBOX_COLS + col; const u8 *const texture = (*(SkyboxTexture *) segmented_to_virtual(sSkyboxTextures[background]))[tileIndex]; @@ -265,7 +265,7 @@ void *create_skybox_ortho_matrix(s8 player) { */ Gfx *init_skybox_display_list(s8 player, s8 background, s8 colorIndex) { s32 dlCommandCount = 5 + (3 * 3) * 7; // 5 for the start and end, plus 9 skybox tiles - void *skybox = alloc_display_list(dlCommandCount * sizeof(Gfx)); + void *skybox = alloc_display_list(dlCommandCount * sizeof(Gfx) * sqr(SKYBOX_SIZE)); Gfx *dlist = skybox; if (skybox == NULL) { diff --git a/tools/Makefile b/tools/Makefile index feac3247..ceb243b5 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -56,6 +56,7 @@ vadpcm_enc_CFLAGS := -Wno-unused-result -Wno-uninitialized -Wno-sign-compare -W extract_data_for_mio_SOURCES := extract_data_for_mio.c skyconv_SOURCES := skyconv.c n64graphics.c utils.c +skyconv_CFLAGS := -g -I../include armips: CC := $(CXX) armips_SOURCES := armips.cpp diff --git a/tools/skyconv.c b/tools/skyconv.c index d81f9b2b..f4634ead 100644 --- a/tools/skyconv.c +++ b/tools/skyconv.c @@ -12,6 +12,7 @@ #include "n64graphics.h" #include "utils.h" +#include "config.h" #define SKYCONV_ENCODING ENCODING_U8 @@ -45,8 +46,8 @@ typedef struct { static const ImageProps IMAGE_PROPERTIES[ImageType_MAX][2] = { [Skybox] = { - {248, 248, 31, 31, 8, 8, true, true}, - {256, 256, 32, 32, 8, 8, true, true}, + {(248 * SKYBOX_SIZE), (248 * SKYBOX_SIZE), 31, 31, (8 * SKYBOX_SIZE), (8 * SKYBOX_SIZE), true, true}, + {(256 * SKYBOX_SIZE), (256 * SKYBOX_SIZE), 32, 32, (8 * SKYBOX_SIZE), (8 * SKYBOX_SIZE), true, true}, }, [Cake] = { {316, 228, 63, 29, 5, 8, false, false}, @@ -63,7 +64,7 @@ typedef struct { } TableDimension; static const TableDimension TABLE_DIMENSIONS[ImageType_MAX] = { - [Skybox] = {8, 10}, + [Skybox] = {(8 * SKYBOX_SIZE), (10 * SKYBOX_SIZE)}, [Cake] = {5, 8}, [CakeEU] = {5, 7}, }; @@ -318,9 +319,9 @@ static void write_skybox_c() { /* write c data to disc */ fprintf(cFile, "const Texture *const %s_skybox_ptrlist[] = {\n", skyboxName); - for (int row = 0; row < 8; row++) { - for (int col = 0; col < 10; col++) { - fprintf(cFile, "%s_skybox_texture_%05X,\n", skyboxName, get_index(tiles, row * 8 + (col % 8))); + for (int row = 0; row < (8 * SKYBOX_SIZE); row++) { + for (int col = 0; col < (10 * SKYBOX_SIZE); col++) { + fprintf(cFile, "%s_skybox_texture_%05X,\n", skyboxName, get_index(tiles, row * (8 * SKYBOX_SIZE) + (col % (8 * SKYBOX_SIZE)))); } } @@ -567,6 +568,7 @@ bool imageMatchesDimensions(int width, int height) { break; } } + if (!matchesDimensions) { if (type != CakeEU) { fprintf(stderr, "err: That type of image must be either %d x %d or %d x %d. Yours is %d x %d.\n",