Skip to content

Commit

Permalink
More moving stuff around in the credits
Browse files Browse the repository at this point in the history
  • Loading branch information
andwn committed Mar 27, 2017
1 parent f260daa commit ab4d8cc
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 50 deletions.
1 change: 1 addition & 0 deletions inc/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ VDPSprite playerSprite;
//uint8_t playerShow;
uint8_t playerIFrames;
uint8_t playerMoveMode;
uint8_t lookingDown;
// Max health - current health is player.health (Entity)
uint16_t playerMaxHealth;
// When this is TRUE, quote can not be controlled by player input
Expand Down
1 change: 1 addition & 0 deletions inc/vdp_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern const uint32_t TILE_BLANK[8];
// FadeOut is almost completely black, except index 15 which is white
// This allows text to still be displayed after the screen fades to black
extern const uint16_t PAL_FadeOut[64];
extern const uint16_t PAL_FadeOutBlue[64];
// FullWhite is used for a TSC instruction that flashes the screen white
extern const uint16_t PAL_FullWhite[64];
// Palette data
Expand Down
16 changes: 14 additions & 2 deletions src/ai/basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ void ai_teleLight(Entity *e) {
}

void ai_player(Entity *e) {
uint8_t collide = TRUE;
if(!e->grounded) e->y_speed += SPEED(0x40);
e->x_next = e->x + e->x_speed;
e->y_next = e->y + e->y_speed;
Expand Down Expand Up @@ -371,6 +372,7 @@ void ai_player(Entity *e) {
{
e->frame = 0;
sprite_vflip(e->sprite[0], 1);
e->grounded = FALSE;
}
break;
case 80: // face away
Expand All @@ -384,11 +386,21 @@ void ai_player(Entity *e) {
case 101:
case 102:
{
ANIMATE(e, 16, 0,1,0,2);
collide = FALSE;
e->grounded = FALSE;
if(++e->timer > TIME(25)) e->state = 103;
}
break;
case 103:
{
collide = FALSE;
e->grounded = TRUE;
e->y_speed = 0;
ANIMATE(e, 10, 0,1,0,2);
}
break;
}
entity_update_collision(e);
if(collide) entity_update_collision(e);
e->x = e->x_next;
e->y = e->y_next;
}
Expand Down
5 changes: 3 additions & 2 deletions src/ai/regu.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void ai_sue(Entity *e) {
// spawn red crystal and call it to us (Undead Core intro)
case 15:
{
//e->PushBehind(dr_create_red_crystal(e->x+(128<<CSF), e->y));
entity_create(e->x+(128<<CSF), e->y, OBJ_RED_CRYSTAL, 0);
e->state = 16;
e->x_speed = 0;
e->frame = 0;
Expand Down Expand Up @@ -381,7 +381,7 @@ void ai_sue(Entity *e) {
case 40: // she jumps off the island
{
e->state = 41;
e->frame = 10;
e->frame = 8;
e->y_speed = SPEED(-0x400);
e->grounded = FALSE;
}
Expand All @@ -396,6 +396,7 @@ void ai_sue(Entity *e) {
}

void ai_sue_teleport_in(Entity *e) {
e->x_next = e->x;
e->y_next = e->y + e->y_speed;
if(!e->grounded) e->grounded = collide_stage_floor(e);
else e->grounded = collide_stage_floor_grounded(e);
Expand Down
6 changes: 3 additions & 3 deletions src/credits.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "gamemode.h"

#define TILE_ICONINDEX (tiloc_index + 192)
#define TILE_ICONINDEX (tiloc_index + 224)

enum CreditCmd {
TEXT, ICON, WAIT, MOVE, SONG, SONG_FADE, FLAG_JUMP, JUMP, LABEL, PALETTE, END
Expand Down Expand Up @@ -98,8 +98,8 @@ void credits_main() {
for(uint8_t i = 0; i < 16; i++) {
if(icon[i].size) continue;
icon[i] = (VDPSprite) {
.x = textX * 8 - 20 + 128,
.y = SCREEN_HEIGHT + 128,
.x = textX * 8 - 22 + 128,
.y = SCREEN_HEIGHT - 6 + 128,
.size = SPRITE_SIZE(3, 3),
.attribut = TILE_ATTR_FULL(credits_info[pc].icon.pal,
1,0,0,TILE_ICONINDEX + i * 9)
Expand Down
2 changes: 1 addition & 1 deletion src/db/npc.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ const npc_info_def npc_info[NPC_COUNT + 9 + 14 + 5] = {
{ NULL, NOSHEET, PAL2, 1, &onspawn_persistent, &ai_null, &ai_null }, // Gaudi (Sitting)
{ NULL, NOSHEET, PAL3, 1, &onspawn_persistent, &ai_null, &ai_null }, // Puppy (Small)
{ NULL, NOSHEET, PAL1, 2, &onspawn_persistent, &ai_null, &ai_null }, // Balrog (Nurse)
{ &SPR_Santa, NOSHEET, PAL3, 1, &onspawn_persistent, &ai_null, &ai_null }, // Santa (Caged)
{ &SPR_Santa, NOSHEET, PAL3, 1, &onspawn_persistent, &ai_mimiga_caged, &ai_null }, // Santa (Caged)
{ NULL, SHEET_STUMPY, PAL0, 1, &ai_null, &ai_stumpy, &ondeath_default }, // Stumpy
{ NULL, NOSHEET, PAL0, 1, &ai_null, &ai_null, &ondeath_default }, // Bute
{ NULL, NOSHEET, PAL0, 1, &ai_null, &ai_null, &ondeath_default }, // Bute (Sword)
Expand Down
1 change: 0 additions & 1 deletion src/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ uint8_t airDisplayTime = 0;
uint8_t blockl, blocku, blockr, blockd;
uint8_t ledge_time;
uint8_t walk_time;
uint8_t lookingDown;

VDPSprite airTankSprite;

Expand Down
4 changes: 2 additions & 2 deletions src/stage.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ void stage_load_credits(uint8_t id) {

XGM_set68KBUSProtection(FALSE);

//VDP_setCachedPalette(PAL2, tileset_info[stageTileset].palette->data);
VDP_setPalette(PAL2, tileset_info[stageTileset].palette->data);
VDP_setCachedPalette(PAL2, tileset_info[stageTileset].palette->data);
//VDP_setPalette(PAL2, tileset_info[stageTileset].palette->data);
stage_load_blocks();

XGM_doVBlankProcess();
Expand Down
20 changes: 9 additions & 11 deletions src/tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ uint8_t execute_command() {
VDP_clearPlan(PLAN_A, TRUE);
entities_clear();
sprites_clear();
entity_create(240 << CSF, 120 << CSF, OBJ_NPC_PLAYER, 0)->state = 100;
tsc_load_stage(ID_CREDITS);
} else {
stage_load_credits(args[0]);
Expand Down Expand Up @@ -705,6 +706,7 @@ uint8_t execute_command() {
player.dir = 1;
}
player.x_speed = 0;
lookingDown = FALSE;
}
break;
case CMD_UNI: // Change movement type to (1)
Expand Down Expand Up @@ -1023,27 +1025,23 @@ uint8_t execute_command() {
inFade = FALSE; // Unlock sprites from updating
vsync(); // Wait a frame to let the sprites redraw
aftervsync();

VDP_fadeTo(0, 63, VDP_getCachedPalette(), 20, TRUE);
}

VDP_fadeTo(0, 63, VDP_getCachedPalette(), 20, TRUE);
}
break;
case CMD_FAO:
{
args[0] = tsc_read_word();
if(gamemode != GM_CREDITS) {
VDP_fadeTo(0, 63, PAL_FadeOut, 20, FALSE);

// Blank the sprite list in VRAM
spr_num = 0;
VDPSprite blank = (VDPSprite) {
.x = 128, .y = 128, .size = 0, .attribut = 0
};
DMA_doDma(DMA_VRAM, (uint32_t) &blank, VDP_SPRITE_TABLE, 4, 2);
inFade = TRUE; // and set a flag not to update sprites anymore
sprites_clear();
inFade = TRUE;
} else {
VDP_fadeTo(0, 63, PAL_FadeOutBlue, 20, TRUE);
waitTime = 20;
return 1;
}

}
break;
case CMD_FLA: // Flash screen white
Expand Down
5 changes: 5 additions & 0 deletions src/vdp_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ const uint16_t PAL_FadeOut[64] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
const uint16_t PAL_FadeOutBlue[64] = {
0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0xEEE,
0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,
0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,
0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200,0x200};
const uint16_t PAL_FullWhite[64] = {
0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,
0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,0xEEE,
Expand Down
36 changes: 8 additions & 28 deletions src/xgm/ym2612.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

#include "ym2612.h"

void YM2612_reset()
{
void YM2612_reset() {
uint16_t i;
uint16_t bus_taken;

Expand All @@ -15,8 +14,7 @@ void YM2612_reset()
Z80_requestBus(TRUE);

// enable left and right output for all channel
for(i = 0; i < 3; i++)
{
for(i = 0; i < 3; i++) {
YM2612_write(0, 0xB4 | i);
YM2612_write(1, 0xC0);
YM2612_write(2, 0xB4 | i);
Expand All @@ -33,8 +31,7 @@ void YM2612_reset()

// ALL KEY OFF
YM2612_write(0, 0x28);
for (i = 0; i < 3; i++)
{
for (i = 0; i < 3; i++) {
YM2612_write(1, 0x00 | i);
YM2612_write(1, 0x04 | i);
}
Expand All @@ -47,18 +44,15 @@ void YM2612_reset()
Z80_releaseBus();
}


uint8_t YM2612_read(const uint16_t port)
{
uint8_t YM2612_read(const uint16_t port) {
volatile uint8_t *pb;

pb = (uint8_t*) YM2612_BASEPORT;

return pb[port & 3];
}

void YM2612_write(const uint16_t port, const uint8_t data)
{
void YM2612_write(const uint16_t port, const uint8_t data) {
volatile int8_t *pb;

pb = (int8_t*) YM2612_BASEPORT;
Expand All @@ -69,13 +63,7 @@ void YM2612_write(const uint16_t port, const uint8_t data)
pb[port & 3] = data;
}

void YM2612_writeSafe(const uint16_t port, const uint8_t data)
{
YM2612_write(port, data);
}

void YM2612_writeReg(const uint16_t part, const uint8_t reg, const uint8_t data)
{
void YM2612_writeReg(const uint16_t part, const uint8_t reg, const uint8_t data) {
volatile int8_t *pb;
uint16_t port;

Expand All @@ -100,21 +88,13 @@ void YM2612_writeReg(const uint16_t part, const uint8_t reg, const uint8_t data)
pb[port + 1] = data;
}

void YM2612_writeRegSafe(const uint16_t part, const uint8_t reg, const uint8_t data)
{
YM2612_writeReg(part, reg, data);
}


void YM2612_enableDAC()
{
void YM2612_enableDAC() {
// enable DAC
YM2612_write(0, 0x2B);
YM2612_write(1, 0x80);
}

void YM2612_disableDAC()
{
void YM2612_disableDAC() {
// disable DAC
YM2612_write(0, 0x2B);
YM2612_write(1, 0x00);
Expand Down

0 comments on commit ab4d8cc

Please sign in to comment.