Skip to content

Commit

Permalink
Merge pull request #84 from wendelscardua/5-items
Browse files Browse the repository at this point in the history
Items
  • Loading branch information
wendelscardua authored Dec 1, 2021
2 parents 877a10c + 083341d commit d12863b
Show file tree
Hide file tree
Showing 18 changed files with 245 additions and 70 deletions.
Binary file modified assets/characters/enemies.chr
Binary file not shown.
4 changes: 4 additions & 0 deletions assets/dialogs.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#pragma rodata-name(push, "BANK1")

extern char dialog_beginning[];
extern char dialog_no_dlls[];
extern char dialog_gpu_dll[];
extern char dialog_disk_dll[];
extern char dialog_io_dll[];
extern char dialog_ram_dll[];
extern char dialog_the_end[];

#pragma rodata-name(pop)
2 changes: 1 addition & 1 deletion assets/dialogs.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.include "../src/charmap.inc"
.segment "RODATA"
.segment "BANK1"
.export _dialog_beginning
_dialog_beginning: .byte 1, "Welcome, Heroes of the System! I'm Queen Amda...", 2, "... and I'm Queen Intella. Please save our system from crashing.", 1, "Our Kingdom OS relies on four drivers: GPU.DLL, Disk.DLL, IO.DLL and RAM.DLL", 2, "Now the drivers are full of bugs. Dive into each driver, removing them. Cleaning the last sector will yield its crypto key. Return with it and the driver will be finally safe.", 1, "Now go, heroes! You're our last hope!", 0
.export _dialog_no_dlls
Expand Down
1 change: 1 addition & 0 deletions assets/sprites.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extern const unsigned char menu_cursor_sprite[];
extern const unsigned char * melee_sprite[4];
extern const unsigned char * enemy_sprite[48];
extern const unsigned char * player_sprite[12];
extern const unsigned char * item_sprite[1];
extern const unsigned char amda_sprite[];
extern const unsigned char intelle_sprite[];

Expand Down
15 changes: 14 additions & 1 deletion assets/sprites.s
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.export _intelle_sprite
.segment "BANK1"
.export _enemy_sprite

.export _item_sprite

.segment "RODATA"
_default_cursor_sprite:
Expand Down Expand Up @@ -281,3 +281,16 @@ _enemy_sprite:
.word .ident (.concat("enemy_right_alt_", .string(enemy_index), "_p", .string(palette)))
.endrepeat
.endrepeat

potion_sprite:
.byte 4, 7,$a0,1
.byte $80
ether_sprite:
.byte 4, 7,$a0,2
.byte $80
elixir_sprite:
.byte 4, 7,$a0,3
.byte $80

_item_sprite:
.word potion_sprite, ether_sprite, elixir_sprite
13 changes: 9 additions & 4 deletions src/castle.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include "lib/nesdoug.h"
#include "lib/neslib.h"
#include "mmc3/mmc3_code.h"
#include "charmap.h"
#include "castle.h"
#include "irq_buffer.h"
#include "main.h"
#include "temp.h"
#include "wram.h"
#include "../assets/dialogs.h"
Expand Down Expand Up @@ -39,8 +41,8 @@ unsigned char dialog_column;
char * dialog_queue[5];
unsigned char dialog_queue_index;

#pragma code-name ("CODE")
#pragma rodata-name ("RODATA")
#pragma rodata-name ("BANK1")
#pragma code-name ("BANK1")

void init_castle_cutscene() {
player_y = START_Y;
Expand Down Expand Up @@ -84,8 +86,6 @@ void init_castle_cutscene() {
dialog_column = FIRST_DIALOG_COLUMN;
}

void return_from_castle(void);

const char blank[] = " ";

void clean_dialog_window() {
Expand Down Expand Up @@ -186,7 +186,11 @@ void castle_handler() {
}
}

#pragma rodata-name ("RODATA")
#pragma code-name ("CODE")

void draw_castle_sprites() {
temp_bank = change_prg_8000(0);
oam_meta_spr(0x70, 0x3e, amda_sprite);
oam_meta_spr(0x80, 0x3e, intelle_sprite);
oam_meta_spr(0x68, 0x88, player_sprite[(PLAYER_UP_SPR << 2) | 1]);
Expand Down Expand Up @@ -223,4 +227,5 @@ void draw_castle_sprites() {
}
break;
}
set_prg_8000(temp_bank);
}
8 changes: 7 additions & 1 deletion src/castle.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#ifndef _CASTLE_H_
#define _CASTLE_H_

#include "lib/farcall.h"

#pragma wrapped-call (push, farcallax, bank)
#pragma code-name (push, "BANK1")
void __fastcall__ init_castle_cutscene(void);
void __fastcall__ draw_castle_sprites(void);
void __fastcall__ castle_handler(void);
#pragma code-name (pop)
#pragma wrapped-call (pop)
void __fastcall__ draw_castle_sprites(void);

#endif
2 changes: 2 additions & 0 deletions src/enemies.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
#define NUM_ENEMY_TYPES 5

#pragma wrapped-call (push, farcallax, bank)
#pragma code-name (push, "BANK1")
unsigned char select_enemy_type ();
void spawn_enemy (unsigned char entity_slot);
#pragma code-name (pop)
#pragma wrapped-call (pop)

#endif
Loading

0 comments on commit d12863b

Please sign in to comment.