Downloads containing ezstar.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Faster-Than-Light StarshipFeatured Download ThunDerDraGon Capture the flag 9 Download file

File preview

#include "MLLE-Include-1.4.asc"
const bool MLLESetupSuccessful = MLLE::Setup();
#pragma require "ezstar.j2l"

jjPAL standard; 

void onLevelLoad() {

	removeSpritePaletteReferences(); 
	standard.load("Diam2.j2t");   
        jjObjectPresets[OBJECT::FULLENERGY].behavior = StillPickup;
        jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
        jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
      
}

void onLevelBegin() {
	jjPalette.copyFrom(16, 40, 16, standard, 1);
	jjPalette.copyFrom(59, 37, 59, standard, 1); 
	jjPalette.apply();

}

void onMain() {
        
        if (jjGetModOrder() == 31 && jjMusicFileName == "babylon.s3m")
		jjSetModPosition(0, 0, false);
}

void removeSpritePaletteReferences() {
	array<int> mapping(256);
	for (int i = 1; i < 96; i++) {
		jjPALCOLOR color = jjPalette.color[i];
		int best = 0x40000;
		for (int j = 96; j < 256; j++) {
			jjPALCOLOR match = jjPalette.color[j];
			int red = int(match.red) - color.red;
			int green = int(match.green) - color.green;
			int blue = int(match.blue) - color.blue;
			int dist = red * red + green * green + blue * blue;
			if (dist < best) {
				best = dist;
				mapping[i] = j;
			}
		}
	}
	for (int i = 96; i < 256; i++) {
		mapping[i] = i;
	}
	for (uint i = 1; i < jjTileCount; i++) {
		jjPIXELMAP tile(i);
		for (int j = 0; j < 32; j++) {
			for (int k = 0; k < 32; k++) {
				tile[k, j] = mapping[tile[k, j]];
			}		
		}
		tile.save(i, true);
	}
}

void StillPickup(jjOBJ@ obj) {
        obj.behave(BEHAVIOR::PICKUP);
	obj.xPos = obj.xOrg;
}