1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-28 23:49:20 +00:00

updated presets

This commit is contained in:
Steven Hugg 2017-05-09 22:43:42 -04:00
parent 5da7f48d1e
commit 59cd5f78fa
2 changed files with 13 additions and 5 deletions

View File

@ -132,8 +132,8 @@ void init_game() {
memset(players, 0, sizeof(players)); memset(players, 0, sizeof(players));
players[0].head_attr = CHAR('1'); players[0].head_attr = CHAR('1');
players[1].head_attr = CHAR('2'); players[1].head_attr = CHAR('2');
players[0].tail_attr = 254; players[0].tail_attr = '~';
players[1].tail_attr = 254; players[1].tail_attr = '@';
frames_per_move = START_SPEED; frames_per_move = START_SPEED;
} }

View File

@ -1,7 +1,5 @@
"use strict"; "use strict";
var palette;
function PixelEditor(parentDiv, fmt, palette, initialData, thumbnails) { function PixelEditor(parentDiv, fmt, palette, initialData, thumbnails) {
var self = this; var self = this;
var width = fmt.w; var width = fmt.w;
@ -295,6 +293,9 @@ function convertPaletteBytes(arr,r0,r1,g0,g1,b0,b1) {
return result; return result;
} }
var palette;
var paletteSets;
var paletteSetIndex=0;
var currentPixelEditor; var currentPixelEditor;
var parentSource; var parentSource;
var parentOrigin; var parentOrigin;
@ -306,7 +307,6 @@ var currentPaletteFmt;
var allthumbs; var allthumbs;
function pixelEditorDecodeMessage(e) { function pixelEditorDecodeMessage(e) {
console.log(e.data);
parentSource = e.source; parentSource = e.source;
parentOrigin = e.origin; parentOrigin = e.origin;
currentFormat = e.data.fmt; currentFormat = e.data.fmt;
@ -326,6 +326,14 @@ function pixelEditorDecodeMessage(e) {
palette = convertPaletteBytes(palbytes, 0, rr, rr, gg, rr+gg, bb); palette = convertPaletteBytes(palbytes, 0, rr, rr, gg, rr+gg, bb);
else else
palette = convertPaletteBytes(palbytes, rr+gg, bb, rr, gg, 0, rr); palette = convertPaletteBytes(palbytes, rr+gg, bb, rr, gg, 0, rr);
if (currentPaletteFmt.n) {
paletteSets = [];
for (var i=0; i<palette.length; i+=currentPaletteFmt.n) {
paletteSets.push(palette.slice(i, i+currentPaletteFmt.n));
}
palette = paletteSets[paletteSetIndex = 0];
// TODO: swap palettes
}
} else { } else {
// TODO: default palette? // TODO: default palette?
} }