Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Miscellaneous stuff | Violet CLM | Multiple | N/A |
const array<uint> ImageWidths = {170, 250};
ANIM::Set RadarSet;
const uint LevelWidth = jjLayerWidth[4] * 32;
const uint LevelHeight = jjLayerHeight[4] * 32;
void onLevelLoad() {
uint8 customAnimSetID = 0;
while (jjAnimSets[RadarSet = ANIM::CUSTOM[customAnimSetID]] != 0)
customAnimSetID += 1;
jjAnimSets[RadarSet].allocate(array<uint> = {ImageWidths.length});
array<jjPIXELMAP@> tileImages(TILE::ANIMATED, null);
const auto layers = jjLayerOrderGet();
for (uint imageID = 0; imageID < ImageWidths.length; ++imageID) {
jjPIXELMAP image(
ImageWidths[imageID], LevelHeight * ImageWidths[imageID] / LevelWidth
/*LevelWidth >= LevelHeight ?
ImageWidths[imageID] :
LevelHeight * ImageWidths[imageID] / LevelWidth,
LevelWidth < LevelHeight ?
ImageWidths[imageID] :
LevelWidth * ImageWidths[imageID] / LevelHeight*/
);
//for (uint x = 0; x < image.width; ++x)
// for (uint y = 0; y < image.height; ++y)
// image[x,y] = 23; //black
for (int layerID = layers.length - 1; layerID >= 0; --layerID) {
const jjLAYER@ layer = layers[layerID];
if (int(layer.xSpeed) == 1 && int(layer.ySpeed) == 1 && int(layer.xAutoSpeed) == 0 && int(layer.yAutoSpeed) == 0 && layer.hasTileMap) {
for (uint x = 0; x < image.width; ++x) {
const uint levelX = uint(x * LevelWidth / image.width - layer.xOffset);
if (layer.tileWidth || levelX < uint(layer.width * 32))
for (uint y = 0; y < image.height; ++y) {
const uint levelY = uint(y * LevelHeight / image.height - layer.yOffset);
if (layer.tileHeight || levelY < uint(layer.height * 32)) {
const uint16 tileID = jjTiles[layer.tileGet((levelX / 32) % layer.width, (levelY / 32) % layer.height)].getFrames()[0];
if (tileImages[tileID] is null) @tileImages[tileID] = @jjPIXELMAP(tileID);
const uint8 color = tileImages[tileID][levelX & 31, levelY & 31];
if (color != 0)
image[x,y] = color;
}
}
}
}
}
jjANIMFRAME@ frame = jjAnimFrames[jjAnimations[jjAnimSets[RadarSet]] + imageID];
frame.hotSpotX = 0;
frame.hotSpotY = 0;
image.save(frame);
}
}
void onLevelBegin() {
if (jjIsServer)
jjChat("/antiradar off");
}
int ImageLeft = -1, ImageTop = -1;
bool onDrawAmmo(jjPLAYER@ play, jjCANVAS@ canvas) {
//if (play.localPlayerID > 0)
// return false;
//if (jjGameMode == GAME::RACE) {
if ((!jjAllowsMouseAim || !jjMouseAim) && (jjKey[1] || jjKey[2])) {
ImageLeft = jjMouseX; ImageTop = jjMouseY;
}
const int imageLeft = (ImageLeft == -1 ? (jjSubscreenWidth > 400 ? 150 : 70) : ImageLeft) - play.subscreenX;
const int imageTop = (ImageTop == -1 ? 5 : ImageTop) - play.subscreenY;
const uint imageID = (jjSubscreenWidth == 640) ? 0 : 1;
const uint imageFrameID = jjAnimations[jjAnimSets[RadarSet]] + imageID;
const jjANIMFRAME@ frame = jjAnimFrames[imageFrameID];
const float scale = jjSubscreenWidth / 800.f;
const uint imageWidth = (jjSubscreenWidth >= 640) ? frame.width : uint(frame.width * scale);
const uint imageHeight = (jjSubscreenWidth >= 640) ? frame.height : uint(frame.height * scale);
const float objectRepositioningScaleX = imageWidth / float(LevelWidth);
const float objectRepositioningScaleY = imageHeight / float(LevelHeight);
if (!jjKey[9])
canvas.drawRectangle(imageLeft - 2, imageTop - 2, imageWidth + 4, imageHeight + 4, 0, SPRITE::SHADOW);
if (jjSubscreenWidth >= 640)
canvas.drawSprite(
imageLeft, imageTop,
RadarSet, 0, imageID,
1, SPRITE::TRANSLUCENT
);
else {
canvas.drawResizedSprite(
imageLeft, imageTop,
RadarSet, 0, imageID,
scale,scale,
SPRITE::TRANSLUCENT
);
}
for (uint objectID = jjObjectCount - 1; objectID > 0; --objectID) {
const jjOBJ@ obj = jjObjects[objectID];
if (obj.behavior == BEHAVIOR::MONITOR || (obj.isActive && (obj.eventID == OBJECT::CARROT || obj.eventID == OBJECT::FULLENERGY))) {
const int x = int(imageLeft + obj.xPos * objectRepositioningScaleX);
const int y = int(imageTop + obj.yPos * objectRepositioningScaleY);
const int direction = obj.direction >= 1 ? 1 : -1;
canvas.drawResizedSpriteFromCurFrame(
x, y,
jjAnimations[obj.curAnim],
direction * 0.25, 0.25
);
}
}
for (uint otherPlayerID = 0; otherPlayerID < 32; ++otherPlayerID) {
const jjPLAYER@ otherPlay = jjPlayers[otherPlayerID];
if (otherPlay.isInGame) {
const int x = int(imageLeft + otherPlay.xPos * objectRepositioningScaleX);
const int y = int(imageTop + otherPlay.yPos * objectRepositioningScaleY);
const int direction = otherPlay.direction >= 1 ? 1 : -1;
canvas.drawResizedSprite(
x - direction * 8, y + 9,
ANIM::FACES, 3 + ((play.charOrig == CHAR::JAZZ) ? 0 : ((play.charOrig == CHAR::LORI || !jjIsTSF) ? 1 : 2)),
0, direction * 0.5, 0.5,
otherPlay.isLocal ? SPRITE::PLAYER : SPRITE::TRANSLUCENTPLAYER, otherPlayerID
);
}
}
//}
return false;
}
Jazz2Online © 1999-INFINITY (Site Credits). We have a Privacy Policy. Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats.
Eat your lima beans, Johnny.