1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-14 00:29:35 +00:00

nes: preset updates

This commit is contained in:
Steven Hugg 2019-08-09 11:42:36 -04:00
parent f1593f6ac7
commit 36bd33a59d
3 changed files with 10 additions and 8 deletions

View File

@ -21,7 +21,7 @@ metasprite.
///// METASPRITES ///// METASPRITES
#define TILE 0xd8 #define TILE 0xd8
#define ATTR 0 #define ATTR 0x0
// define a 2x2 metasprite // define a 2x2 metasprite
const unsigned char metasprite[]={ const unsigned char metasprite[]={

View File

@ -39,22 +39,21 @@ void setup_graphics() {
} }
// number of actors // number of actors
#define NUM_ACTORS 64 #define NUM_ACTORS 64 // 64 sprites (maximum)
// actor x/y positions // actor x/y positions
byte actor_x[NUM_ACTORS]; byte actor_x[NUM_ACTORS]; // horizontal coordinates
byte actor_y[NUM_ACTORS]; byte actor_y[NUM_ACTORS]; // vertical coordinates
// actor x/y deltas per frame (signed) // actor x/y deltas per frame (signed)
sbyte actor_dx[NUM_ACTORS]; sbyte actor_dx[NUM_ACTORS]; // horizontal velocity
sbyte actor_dy[NUM_ACTORS]; sbyte actor_dy[NUM_ACTORS]; // vertical velocity
// main program // main program
void main() { void main() {
char i; // actor index char i; // actor index
char oam_id; // sprite ID char oam_id; // sprite ID
// initialize PPU
setup_graphics();
// initialize actors with random values // initialize actors with random values
for (i=0; i<NUM_ACTORS; i++) { for (i=0; i<NUM_ACTORS; i++) {
actor_x[i] = rand(); actor_x[i] = rand();
@ -62,6 +61,8 @@ void main() {
actor_dx[i] = (rand() & 7) - 3; actor_dx[i] = (rand() & 7) - 3;
actor_dy[i] = (rand() & 7) - 3; actor_dy[i] = (rand() & 7) - 3;
} }
// initialize PPU
setup_graphics();
// loop forever // loop forever
while (1) { while (1) {
// start with OAMid/sprite 0 // start with OAMid/sprite 0

View File

@ -540,6 +540,7 @@ function setupFS(FS, name:string) {
}, '/share'); }, '/share');
// fix for slow Blob operations by caching typed arrays // fix for slow Blob operations by caching typed arrays
// https://github.com/kripken/emscripten/blob/incoming/src/library_workerfs.js // https://github.com/kripken/emscripten/blob/incoming/src/library_workerfs.js
// https://bugs.chromium.org/p/chromium/issues/detail?id=349304#c30
var reader = WORKERFS.reader; var reader = WORKERFS.reader;
var blobcache = {}; var blobcache = {};
WORKERFS.stream_ops.read = function (stream, buffer, offset, length, position) { WORKERFS.stream_ops.read = function (stream, buffer, offset, length, position) {