Add music, beach fishing, catching, and selectable creature partners
This commit is contained in:
1 parent
3469f2e6dd
commit
cb77683a87
24 files changed
+1307
-104
No files matched your search
+80
-12
@@ -35,12 +35,40 @@ static void creature(void)
|
||||
void scaled_creature(int x, int y, int scale, const u16 *palette)
|
||||
{
|
||||
rectangle(x - 7 * scale, y, 14 * scale, 2 * scale,
|
||||
indoors() ? RGB(15, 11, 8) : RGB(8, 16, 7));
|
||||
indoors() ? RGB(15, 11, 8) : current_room == BEACH ? RGB(22, 20, 12) : RGB(8, 16, 7));
|
||||
blit_sprite(x - 8 * scale, y - 16 * scale, creature_art, 16, 16, palette, scale, 0);
|
||||
}
|
||||
|
||||
#include "wild_creatures.h"
|
||||
|
||||
/* Downsample route artwork to the same 16-pixel follower footprint as Sprout. */
|
||||
void draw_member(int member, int x, int y, int small)
|
||||
{
|
||||
static const u16 gold[] = {
|
||||
0, RGB(9, 8, 6), RGB(23, 15, 5), RGB(30, 23, 7),
|
||||
RGB(31, 28, 14), RGB(31, 31, 28), RGB(29, 13, 10), RGB(17, 8, 7)
|
||||
};
|
||||
if (!member) { draw_sprout(x, y, small ? 1 : 3); return; }
|
||||
enum Species kind = (enum Species)caught_species[member - 1];
|
||||
if (kind == GOLDEN) { scaled_creature(x, y, small ? 1 : 3, gold); return; }
|
||||
if (!small) { draw_wild_creature(kind, x, y); return; }
|
||||
static char pixels[4][16][17];
|
||||
static const char *rows[4][16];
|
||||
static int ready;
|
||||
if (!ready) {
|
||||
for (int k = 0; k < 4; ++k)
|
||||
for (int row = 0; row < 16; ++row) {
|
||||
rows[k][row] = pixels[k][row];
|
||||
for (int col = 0; col < 16; ++col)
|
||||
pixels[k][row][col] = wild_art[k].rows[row * 3 / 2][col * 3 / 2];
|
||||
}
|
||||
ready = 1;
|
||||
}
|
||||
rectangle(x - 7, y, 14, 2, indoors() ? RGB(15, 11, 8) :
|
||||
current_room == BEACH ? RGB(22, 20, 12) : RGB(8, 16, 7));
|
||||
sprite(x - 8, y - 16, rows[kind - FERNFOX], 16, wild_art[kind - FERNFOX].palette, 0);
|
||||
}
|
||||
|
||||
void draw_wild_creature(enum Species enemy, int x, int y)
|
||||
{
|
||||
const struct WildArt *art = &wild_art[enemy - FERNFOX];
|
||||
@@ -99,6 +127,31 @@ TEST_INTERNAL const char *const person_side_art[] = {
|
||||
".....111111.....", ".....1AA1A1.....", ".....1AA1A1.....", ".....111111....."
|
||||
};
|
||||
|
||||
/* Distinct long-haired girl silhouette, with front, back, and side views. */
|
||||
TEST_INTERNAL const char *const girl_art[] = {
|
||||
".....111111.....", "....14444441....", "...1434444341...", "...1444444441...",
|
||||
"..144444444441..", "..144666666441..", "..144616616441..", "..144666666441..",
|
||||
"...1466776641...", "...1446666441...", "...1441881441...", "...1418998141...",
|
||||
"...1168998611...", "..161889988161..", "..161888888161..", "...1618888161...",
|
||||
"....18888881....", "....1AA11AA1....", "....1AA11AA1....", "....111..111...."
|
||||
};
|
||||
|
||||
TEST_INTERNAL const char *const girl_back_art[] = {
|
||||
".....111111.....", "....14444441....", "...1434444341...", "...1444444441...",
|
||||
"...1444444441...", "...1444444441...", "...1244444421...", "...1244444421...",
|
||||
"...1444444441...", "....14444441....", "....18444481....", "...1881441881...",
|
||||
"..1618BBBB8161..", "..1618BCCB8161..", "..1618BCCB8161..", "..1668BBBB8661..",
|
||||
"...1111111111...", "....1AA11AA1....", "....1AA11AA1....", "....111..111...."
|
||||
};
|
||||
|
||||
TEST_INTERNAL const char *const girl_side_art[] = {
|
||||
"......11111.....", ".....1444441....", "....143444441...", "....144444441...",
|
||||
"...1444444441...", "..14444466661...", "..14444461661...", "..14444466661...",
|
||||
"..14444167761...", "...144411661....", "...14441881.....", "....14418881....",
|
||||
"....14188881....", ".....1881661....", ".....1881661....", ".....188161.....",
|
||||
".....111111.....", ".....1AA1A1.....", ".....1AA1A1.....", ".....111111....."
|
||||
};
|
||||
|
||||
static u16 lighter(u16 color)
|
||||
{
|
||||
int r = color & 31, g = (color >> 5) & 31, b = (color >> 10) & 31;
|
||||
@@ -112,22 +165,33 @@ static u16 darker(u16 color)
|
||||
}
|
||||
|
||||
/* x and y mark the feet. The art fits inside the original erase area. */
|
||||
TEST_INTERNAL void person(int x, int y, int step, u16 clothes, u16 hat, enum Facing facing)
|
||||
TEST_INTERNAL void styled_person(int x, int y, int step, u16 clothes, u16 hair_or_hat,
|
||||
enum Facing facing, enum CharacterStyle style)
|
||||
{
|
||||
u16 palette[] = {
|
||||
0, RGB(5, 7, 9), darker(hat), hat, RGB(11, 8, 7),
|
||||
0, RGB(5, 7, 9), darker(hair_or_hat),
|
||||
style == GIRL_STYLE ? lighter(hair_or_hat) : hair_or_hat,
|
||||
style == GIRL_STYLE ? hair_or_hat : RGB(11, 8, 7),
|
||||
RGB(24, 16, 12), RGB(31, 25, 19), RGB(25, 13, 12),
|
||||
clothes, lighter(clothes), RGB(9, 12, 17), RGB(24, 17, 8), RGB(30, 24, 12)
|
||||
};
|
||||
rectangle(x - 7, y - 1, 15, 3,
|
||||
indoors() ? RGB(15, 11, 8) : RGB(8, 16, 7));
|
||||
const char *const *art = facing == FACING_UP ? person_back_art :
|
||||
facing == FACING_DOWN ? person_art : person_side_art;
|
||||
indoors() ? RGB(15, 11, 8) : current_room == BEACH ? RGB(22, 20, 12) : RGB(8, 16, 7));
|
||||
const char *const *art;
|
||||
if (style == GIRL_STYLE)
|
||||
art = facing == FACING_UP ? girl_back_art : facing == FACING_DOWN ? girl_art : girl_side_art;
|
||||
else
|
||||
art = facing == FACING_UP ? person_back_art : facing == FACING_DOWN ? person_art : person_side_art;
|
||||
sprite(x - 8, y - 19, art, 20, palette, facing == FACING_LEFT);
|
||||
rectangle(x - 4, y, 3, 2 - step, palette[1]);
|
||||
rectangle(x + 1, y, 3, 1 + step, palette[1]);
|
||||
}
|
||||
|
||||
TEST_INTERNAL void person(int x, int y, int step, u16 clothes, u16 hat, enum Facing facing)
|
||||
{
|
||||
styled_person(x, y, step, clothes, hat, facing, BOY_STYLE);
|
||||
}
|
||||
|
||||
static void player(int x, int y, int step)
|
||||
{
|
||||
person(x, y, step, shirt, RGB(28, 8, 9), player_facing);
|
||||
@@ -135,7 +199,7 @@ static void player(int x, int y, int step)
|
||||
|
||||
void actors(int x, int y, int step)
|
||||
{
|
||||
enum { HERO, SPROUT, MILA, GOLDEN, PROFESSOR, RANGER };
|
||||
enum { HERO, SPROUT, MILA, GOLDEN_ACTOR, PROFESSOR, RANGER, FISHER };
|
||||
struct Actor { int x, y, kind; } list[4];
|
||||
int count = 0;
|
||||
if (partner_owned && follower_ready)
|
||||
@@ -145,10 +209,11 @@ void actors(int x, int y, int step)
|
||||
list[count++] = (struct Actor){PROF_X, PROF_Y, PROFESSOR};
|
||||
}
|
||||
if (current_room == OUTSIDE) {
|
||||
list[count++] = (struct Actor){182, 104, GOLDEN};
|
||||
if (!has_caught(GOLDEN)) list[count++] = (struct Actor){182, 104, GOLDEN_ACTOR};
|
||||
list[count++] = (struct Actor){NPC_X, NPC_Y, MILA};
|
||||
}
|
||||
if (current_room == ROUTE) list[count++] = (struct Actor){RANGER_X, RANGER_Y, RANGER};
|
||||
if (current_room == BEACH) list[count++] = (struct Actor){FISHER_X, FISHER_Y, FISHER};
|
||||
/* Stable depth ordering keeps Sprout behind the hero on equal feet. */
|
||||
for (int i = 1; i < count; ++i) {
|
||||
struct Actor actor = list[i];
|
||||
@@ -162,12 +227,15 @@ void actors(int x, int y, int step)
|
||||
for (int i = 0; i < count; ++i) {
|
||||
struct Actor actor = list[i];
|
||||
if (actor.kind == HERO) player(actor.x, actor.y, step);
|
||||
else if (actor.kind == SPROUT) draw_sprout(actor.x, actor.y, 1);
|
||||
else if (actor.kind == GOLDEN) creature();
|
||||
else if (actor.kind == SPROUT) draw_member(active_member, actor.x, actor.y, 1);
|
||||
else if (actor.kind == GOLDEN_ACTOR) creature();
|
||||
else if (actor.kind == MILA)
|
||||
person(actor.x, actor.y, 0, RGB(4, 21, 13), RGB(12, 7, 4), FACING_DOWN);
|
||||
styled_person(actor.x, actor.y, 0, RGB(4, 21, 13), RGB(12, 7, 4), FACING_DOWN, GIRL_STYLE);
|
||||
else if (actor.kind == RANGER)
|
||||
person(actor.x, actor.y, 0, RGB(27, 16, 7), RGB(6, 15, 11), FACING_DOWN);
|
||||
else person(actor.x, actor.y, 0, RGB(29, 30, 27), RGB(20, 21, 19), FACING_DOWN);
|
||||
else if (actor.kind == FISHER)
|
||||
styled_person(actor.x, actor.y, 0, RGB(5, 23, 26), RGB(26, 12, 7), FACING_DOWN, GIRL_STYLE);
|
||||
else styled_person(actor.x, actor.y, 0, RGB(29, 30, 27), RGB(20, 21, 19),
|
||||
FACING_DOWN, GIRL_STYLE);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user