Section 1
//KeyPoll (bigroom.input.KeyPoll)
package bigroom.input {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class KeyPoll {
private var states:ByteArray;
public var press:Boolean;// = false
public var click:Boolean;// = false
public var onscreen:Boolean;// = true
public var hasclicked:Boolean;// = false
private var dispObj:DisplayObject;
public function KeyPoll(obj:DisplayObject){
super();
states = new ByteArray();
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
dispObj = obj;
dispObj.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener, false, 0, true);
dispObj.addEventListener(KeyboardEvent.KEY_UP, keyUpListener, false, 0, true);
dispObj.addEventListener(Event.ACTIVATE, activateListener, false, 0, true);
dispObj.addEventListener(Event.DEACTIVATE, deactivateListener, false, 0, true);
dispObj.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownListener);
dispObj.addEventListener(MouseEvent.MOUSE_UP, mouseUpListener);
dispObj.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
dispObj.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
}
public function mouseOutHandler(e:MouseEvent):void{
onscreen = false;
}
public function isUp(keyCode:uint):Boolean{
return (((states[(keyCode >>> 3)] & (1 << (keyCode & 7))) == 0));
}
private function activateListener(ev:Event):void{
var i:int;
while (i < 8) {
states[i] = 0;
i++;
};
}
public function isDown(keyCode:uint):Boolean{
return (!(((states[(keyCode >>> 3)] & (1 << (keyCode & 7))) == 0)));
}
private function keyUpListener(ev:KeyboardEvent):void{
states[(ev.keyCode >>> 3)] = (states[(ev.keyCode >>> 3)] & ~((1 << (ev.keyCode & 7))));
}
private function deactivateListener(ev:Event):void{
var i:int;
while (i < 8) {
states[i] = 0;
i++;
};
}
public function mouseOverHandler(e:MouseEvent):void{
onscreen = true;
}
public function mouseUpListener(e:MouseEvent):void{
press = false;
click = false;
hasclicked = false;
}
public function mouseDownListener(e:MouseEvent):void{
press = true;
click = true;
hasclicked = true;
}
private function keyDownListener(ev:KeyboardEvent):void{
states[(ev.keyCode >>> 3)] = (states[(ev.keyCode >>> 3)] | (1 << (ev.keyCode & 7)));
}
}
}//package bigroom.input
Section 2
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "3.4.0.6955";
public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
super(bitmapData, pixelSnapping, smoothing);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(newWidth:Number, newHeight:Number):void{
width = newWidth;
height = newHeight;
}
public function move(x:Number, y:Number):void{
this.x = x;
this.y = y;
}
}
}//package mx.core
Section 3
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.4.0.6955";
public function FlexBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
var bitmapData = bitmapData;
var pixelSnapping = pixelSnapping;
var smoothing = smoothing;
super(bitmapData, pixelSnapping, smoothing);
name = NameUtil.createUniqueName(this);
//unresolved jump
var _slot1 = e;
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 4
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 5
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(void:Point):Point;
function get name():String;
function set width(flash.display:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(flash.display:String):void;
function set scaleX(flash.display:Number):void;
function set scaleY(flash.display:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(flash.display:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(void:Point):Point;
function get height():Number;
function set blendMode(flash.display:String):void;
function get parent():DisplayObjectContainer;
function getBounds(String:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(flash.display:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(flash.display:Number):void;
function set accessibilityProperties(flash.display:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(flash.display:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(flash.display:Number):void;
function set mask(flash.display:DisplayObject):void;
function getRect(String:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(flash.display:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean;
function set opaqueBackground(flash.display:Object):void;
function set visible(flash.display:Boolean):void;
function get mask():DisplayObject;
function set x(flash.display:Number):void;
function set y(flash.display:Number):void;
function get transform():Transform;
function set filters(flash.display:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(flash.display:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 6
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(C:\autobuild\3.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get isDocument():Boolean;
function set repeaters(C:\autobuild\3.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function initializeRepeaterArrays(C:\autobuild\3.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(C:\autobuild\3.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 7
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 8
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.4.0.6955";
public function SoundAsset(){
super();
}
}
}//package mx.core
Section 9
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.4.0.6955";
private static var counter:int = 0;
public function NameUtil(){
super();
}
public static function displayObjectToString(displayObject:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = displayObject;
o = displayObject;
while (o != null) {
if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){
break;
};
s = o.name;
if ((o is IRepeaterClient)){
indices = IRepeaterClient(o).instanceIndices;
if (indices){
s = (s + (("[" + indices.join("][")) + "]"));
};
};
result = ((result == null)) ? s : ((s + ".") + result);
o = o.parent;
};
//unresolved jump
var _slot1 = e;
return (result);
}
public static function createUniqueName(object:Object):String{
if (!object){
return (null);
};
var name:String = getQualifiedClassName(object);
var index:int = name.indexOf("::");
if (index != -1){
name = name.substr((index + 2));
};
var charCode:int = name.charCodeAt((name.length - 1));
if ((((charCode >= 48)) && ((charCode <= 57)))){
name = (name + "_");
};
return ((name + counter++));
}
}
}//package mx.utils
Section 10
//blockclass (blockclass)
package {
import flash.display.*;
import flash.geom.*;
public class blockclass extends Sprite {
public var hp:int;
public var rect:Rectangle;
public var active:Boolean;
public var yp:int;
public var xp:int;
public var wp:int;
public var type:int;
public var trigger:int;
public function blockclass():void{
super();
clear();
}
public function clear():void{
active = false;
type = 0;
trigger = 0;
xp = 0;
yp = 0;
wp = 0;
hp = 0;
rect = new Rectangle();
rect.x = xp;
rect.y = yp;
rect.width = wp;
rect.height = hp;
}
public function rectset(xi:int, yi:int, wi:int, hi:int):void{
rect.x = xi;
rect.y = yi;
rect.width = wi;
rect.height = hi;
}
}
}//package
Section 11
//dwgraphicsclass (dwgraphicsclass)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
public class dwgraphicsclass extends Sprite {
public var spriteWidth:int;
public var bfontmask:Array;
public var distPlayer:Number;
public var shade:Number;
public var spriteX:Number;
public var spriteY:Number;
public var cur:int;
public var drawEndX:int;
public var drawEndY:int;
public var buffer:BitmapData;
public var spriteHeight:int;
public var tempshape:Shape;
public var sprites:Array;
public var stripe:int;
public var sideDistX:Number;
public var sideDistY:Number;
public var tiles_rect:Rectangle;
public var cb:int;
public var invDet:Number;
public var cg:int;
public var ci:int;
public var i:int;
public var j:int;
public var k:int;
public var screen:Bitmap;
public var yoffset:int;
public var cr:int;
public var ct:ColorTransform;
public var transformX:Number;
public var tl:Point;
public var z:int;
public var mapX:int;
public var mapY:int;
public var images:Array;
public var temptile:BitmapData;
public var transformY:Number;
public var deltaDistX:Number;
public var shapematrix:Matrix;
public var perpWallDist:Number;
public var weight:Number;
public var currentFloorY:Number;
public var ciellingTexture:int;
public var distWall:Number;
public var drawStartX:int;
public var deltaDistY:Number;
public var currentFloorX:Number;
public var vMoveScreen:int;
public var rayDirX:Number;
public var rayDirY:Number;
public var updatebackground:Boolean;
public var currentDist:Number;
public var bfontlen:Array;
public var bfontmask_rect:Rectangle;
public var stemp:String;
public var temp2:int;
public var temp3:int;
public var drawStartY:int;
public var spriteScreenX:int;
public var drawEnd:int;
public var bfontpos:int;
public var backgrounds:Array;
public var xoffset:int;
public var stepX:int;
public var stepY:int;
public var texture:Array;
public var sprites_rect:Rectangle;
public var ZBuffer:Array;
public var rpgtiles:Array;
public var floorTexX:int;
public var floorTexY:int;
public var tbpos:int;
public var images_rect:Rectangle;
public var ntextbox:int;
public var side:int;
public var color:int;
public var floorTexture:int;
public var textbox:Array;
public var tiles:Array;
public var alphamult:uint;
public var hit:int;
public var bg_rect:Rectangle;
public var drawStart:int;
public var screenbuffer:BitmapData;
public var bfont:Array;
public var bfont_rect:Rectangle;
public var temprect:Rectangle;
public var rayPosY:Number;
public var rayheight:int;
public var cameraX:Number;
public var temp:int;
public var rayPosX:Number;
public var tst:Number;
public var wallX:Number;
public var texNum:int;
public var backbuffer:BitmapData;
public function dwgraphicsclass(){
backgrounds = new Array();
images = new Array();
tiles = new Array();
rpgtiles = new Array();
sprites = new Array();
bfont = new Array();
bfontmask = new Array();
bfontlen = new Array();
textbox = new Array();
tempshape = new Shape();
shapematrix = new Matrix();
texture = new Array();
ZBuffer = new Array();
super();
}
public function textboxactive():void{
i = 0;
while (i < ntextbox) {
if (z != i){
textbox[i].remove();
};
i++;
};
}
public function makespritearray():void{
var i:Number;
var t:BitmapData;
var temprect:Rectangle;
var j:Number = 0;
while (j < 15) {
i = 0;
while (i < 20) {
t = new BitmapData(32, 32, true, 0);
temprect = new Rectangle((i * 32), (j * 32), 32, 32);
t.copyPixels(buffer, temprect, tl);
sprites.push(t);
i++;
};
j++;
};
}
public function addline(t:String):void{
textbox[z].addline(t);
}
public function screenshake():void{
screenbuffer.lock();
screenbuffer.copyPixels(backbuffer, backbuffer.rect, tl, null, null, false);
screenbuffer.copyPixels(backbuffer, backbuffer.rect, new Point(((Math.random() * 5) - 3), ((Math.random() * 5) - 3)), null, null, false);
screenbuffer.unlock();
backbuffer.lock();
backbuffer.fillRect(backbuffer.rect, 0);
backbuffer.unlock();
}
public function RGB_shade(red:Number, green:Number, blue:Number, a:Number):Number{
blue = (blue * 0.5);
red = (red * a);
green = (green * 0.5);
return (((blue | (green << 8)) | (red << 16)));
}
public function len(t:String):int{
bfontpos = 0;
var i:int;
while (i < t.length) {
cur = t.charCodeAt(i);
bfontpos = (bfontpos + bfontlen[cur]);
i++;
};
return (bfontpos);
}
public function printtemptile(x:int, y:int, t:String, r:int, g:int, b:int, cen:Boolean=false):void{
if (r < 0){
r = 0;
};
if (g < 0){
g = 0;
};
if (b < 0){
b = 0;
};
if (r > 0xFF){
r = 0xFF;
};
if (g > 0xFF){
g = 0xFF;
};
if (b > 0xFF){
b = 0xFF;
};
ct.color = RGB(r, g, b);
if (cen){
x = (80 - (len(t) / 2));
};
bfontpos = 0;
var i:int;
while (i < t.length) {
cur = t.charCodeAt(i);
bfont[cur].colorTransform(bfont_rect, ct);
temptile.copyPixels(bfont[cur], bfont_rect, new Point((x + bfontpos), y));
bfontpos = (bfontpos + bfontlen[cur]);
i++;
};
}
public function maketilearray():void{
var i:Number;
var t:BitmapData;
var temprect:Rectangle;
var j:Number = 0;
while (j < 15) {
i = 0;
while (i < 20) {
t = new BitmapData(8, 8, true, 0);
temprect = new Rectangle((i * 8), (j * 8), 8, 8);
t.copyPixels(buffer, temprect, tl);
tiles.push(t);
i++;
};
j++;
};
}
public function drawrpgtile(x:int, y:int, t:int):void{
if ((((t >= 60)) && ((t <= 70)))){
backbuffer.copyPixels(rpgtiles[111], tiles_rect, new Point(x, y));
};
backbuffer.copyPixels(rpgtiles[t], tiles_rect, new Point(x, y));
}
public function raycast(game:gameclass, obj:entityclass, map:mapclass):void{
var texX:int;
var texY:int;
var d:int;
var x:int;
var y:int;
var floorXWall:Number;
var floorYWall:Number;
var w = 160;
var h:int = (120 + game.bobbing);
var texWidth = 8;
var texHeight = 8;
var uDiv:Number = 1;
var vDiv:Number = 1;
var vMove:Number = 0;
x = 0;
while (x < w) {
cameraX = (((2 * x) / Number(w)) - 1);
rayPosX = game.posX;
rayPosY = game.posY;
rayDirX = (game.dirX + (game.planeX * cameraX));
rayDirY = (game.dirY + (game.planeY * cameraX));
mapX = int(rayPosX);
mapY = int(rayPosY);
deltaDistX = Math.sqrt((1 + ((rayDirY * rayDirY) / (rayDirX * rayDirX))));
deltaDistY = Math.sqrt((1 + ((rayDirX * rayDirX) / (rayDirY * rayDirY))));
hit = 0;
if (rayDirX < 0){
stepX = -1;
sideDistX = ((rayPosX - mapX) * deltaDistX);
} else {
stepX = 1;
sideDistX = (((mapX + 1) - rayPosX) * deltaDistX);
};
if (rayDirY < 0){
stepY = -1;
sideDistY = ((rayPosY - mapY) * deltaDistY);
} else {
stepY = 1;
sideDistY = (((mapY + 1) - rayPosY) * deltaDistY);
};
while (hit == 0) {
if (sideDistX < sideDistY){
sideDistX = (sideDistX + deltaDistX);
mapX = (mapX + stepX);
side = 0;
} else {
sideDistY = (sideDistY + deltaDistY);
mapY = (mapY + stepY);
side = 1;
};
if (map.at(int(mapX), int(mapY)) > 0){
hit = 1;
};
};
if (side == 0){
perpWallDist = Math.abs((((mapX - rayPosX) + ((1 - stepX) / 2)) / rayDirX));
} else {
perpWallDist = Math.abs((((mapY - rayPosY) + ((1 - stepY) / 2)) / rayDirY));
};
rayheight = Math.abs(int((h / perpWallDist)));
drawStart = ((-(rayheight) / 2) + (h / 2));
if (drawStart < 0){
drawStart = 0;
};
drawEnd = ((rayheight / 2) + (h / 2));
if (drawEnd >= h){
drawEnd = (h - 1);
};
texNum = map.at(mapX, mapY);
if (side == 1){
wallX = (rayPosX + ((((mapY - rayPosY) + ((1 - stepY) / 2)) / rayDirY) * rayDirX));
} else {
wallX = (rayPosY + ((((mapX - rayPosX) + ((1 - stepX) / 2)) / rayDirX) * rayDirY));
};
wallX = (wallX - Math.floor(wallX));
texX = int((wallX * Number(texWidth)));
if ((((side == 0)) && ((rayDirX > 0)))){
texX = ((texWidth - texX) - 1);
};
if ((((side == 1)) && ((rayDirY < 0)))){
texX = ((texWidth - texX) - 1);
};
y = drawStart;
while (y < drawEnd) {
d = (((y * 0x0100) - (h * 128)) + (rayheight * 128));
texY = (((d * texHeight) / rayheight) / 0x0100);
ci = ((texWidth * texY) + texX);
cr = texture[texNum].rc[ci];
cg = texture[texNum].gc[ci];
cb = texture[texNum].bc[ci];
tst = (3 / perpWallDist);
if (side == 1){
tst = (tst * 0.5);
};
if (tst < 0){
tst = 0;
};
if (tst > 1){
tst = 1;
};
setrect(x, y, 4, 1);
backbuffer.fillRect(temprect, RGB_shade(cr, cg, cb, tst));
y++;
};
ZBuffer[x] = perpWallDist;
if ((((side == 0)) && ((rayDirX > 0)))){
floorXWall = mapX;
floorYWall = (mapY + wallX);
} else {
if ((((side == 0)) && ((rayDirX < 0)))){
floorXWall = (mapX + 1);
floorYWall = (mapY + wallX);
} else {
if ((((side == 1)) && ((rayDirY > 0)))){
floorXWall = (mapX + wallX);
floorYWall = mapY;
} else {
floorXWall = (mapX + wallX);
floorYWall = (mapY + 1);
};
};
};
distWall = perpWallDist;
distPlayer = 0;
color = 0;
if (drawEnd < 0){
drawEnd = h;
};
y = (drawEnd + 1);
while (y <= h) {
currentDist = (h / ((2 * y) - h));
weight = ((currentDist - distPlayer) / (distWall - distPlayer));
currentFloorX = ((weight * floorXWall) + ((1 - weight) * game.posX));
currentFloorY = ((weight * floorYWall) + ((1 - weight) * game.posY));
floorTexX = (int((currentFloorX * texWidth)) % texWidth);
floorTexY = (int((currentFloorY * texHeight)) % texHeight);
floorTexture = map.floorat(int(currentFloorX), int(currentFloorY));
ciellingTexture = map.ceilingat(int(currentFloorX), int(currentFloorY));
if (floorTexture > 0){
ci = ((texWidth * floorTexY) + floorTexX);
cr = texture[floorTexture].rc[ci];
cg = texture[floorTexture].gc[ci];
cb = texture[floorTexture].bc[ci];
tst = (0.8 / currentDist);
if (tst < 0){
tst = 0;
};
if (tst > 1){
tst = 1;
};
setrect(x, (y - 1), 4, 2);
backbuffer.fillRect(temprect, RGB_shade(cr, cg, cb, tst));
};
if (ciellingTexture > 0){
ci = ((texWidth * floorTexY) + floorTexX);
cr = texture[ciellingTexture].rc[ci];
cg = texture[ciellingTexture].gc[ci];
cb = texture[ciellingTexture].bc[ci];
tst = (0.8 / currentDist);
if (tst < 0){
tst = 0;
};
if (tst > 1){
tst = 1;
};
setrect(x, ((h - y) - 1), 4, 2);
backbuffer.fillRect(temprect, RGB_shade(cr, cg, cb, tst));
};
y = (y + 2);
};
x = (x + 4);
};
i = 0;
while (i < obj.nentity) {
obj.spriteOrder[i] = i;
obj.spriteDistance[i] = (((game.posX - obj.entities[i].xp) * (game.posX - obj.entities[i].xp)) + ((game.posY - obj.entities[i].yp) * (game.posY - obj.entities[i].yp)));
i++;
};
obj.combSort();
i = 0;
while (i < obj.nentity) {
if (obj.entities[obj.spriteOrder[i]].active){
spriteX = (obj.entities[obj.spriteOrder[i]].xp - game.posX);
spriteY = (obj.entities[obj.spriteOrder[i]].yp - game.posY);
invDet = (1 / ((game.planeX * game.dirY) - (game.dirX * game.planeY)));
transformX = (invDet * ((game.dirY * spriteX) - (game.dirX * spriteY)));
transformY = (invDet * ((-(game.planeY) * spriteX) + (game.planeX * spriteY)));
spriteScreenX = int(((w / 2) * (1 + (transformX / transformY))));
vMoveScreen = int((vMove / transformY));
spriteHeight = (Math.abs(int((h / transformY))) / vDiv);
drawStartY = (((-(spriteHeight) / 2) + (h / 2)) + vMoveScreen);
if (drawStartY < 0){
drawStartY = 0;
};
drawEndY = (((spriteHeight / 2) + (h / 2)) + vMoveScreen);
if (drawEndY >= h){
drawEndY = (h - 1);
};
spriteWidth = (Math.abs(int((h / transformY))) / uDiv);
drawStartX = ((-(spriteWidth) / 2) + spriteScreenX);
if (drawStartX < 0){
drawStartX = 0;
};
drawEndX = ((spriteWidth / 2) + spriteScreenX);
if (drawEndX >= w){
drawEndX = (w - 1);
};
stripe = drawStartX;
while (stripe < drawEndX) {
texX = (int((((0x0100 * (stripe - ((-(spriteWidth) / 2) + spriteScreenX))) * texWidth) / spriteWidth)) / 0x0100);
if ((((((((transformY > 0)) && ((stripe >= 0)))) && ((stripe < w)))) && ((transformY < ZBuffer[stripe])))){
y = drawStartY;
while (y < drawEndY) {
if (y > (drawEndY - 4)){
y = (drawEndY - 4);
};
d = ((((y - vMoveScreen) * 0x0100) - (h * 128)) + (spriteHeight * 128));
texY = (((d * texHeight) / spriteHeight) / 0x0100);
ci = ((texWidth * texY) + texX);
color = texture[obj.entities[obj.spriteOrder[i]].drawframe].contents[ci];
if ((color & 0xFFFFFF) != 0){
backbuffer.fillRect(new Rectangle(stripe, y, 4, 4), color);
};
y = (y + 4);
};
};
stripe++;
};
};
i++;
};
}
public function makebfont():void{
var maprow:Array;
var i:Number;
var t:BitmapData;
var temprect:Rectangle;
var j:Number = 0;
while (j < 16) {
i = 0;
while (i < 16) {
t = new BitmapData(8, 8, true, 0);
temprect = new Rectangle((i * 8), (j * 8), 8, 8);
t.copyPixels(buffer, temprect, tl);
bfont.push(t);
i++;
};
j++;
};
i = 0;
while (i < 0x0100) {
bfontlen.push(6);
i++;
};
var tstring:String = "4,3,5,7,6,7,6,3,4,4,7,7,3,5,2,5,6,5,6,6,6,6,6,6,6,6,2,3,5,5,5,6,7,6,6,6,6,5,5,6,6,3,6,6,5,7,7,6,6,6,6,6,5,6,7,7,7,7,5,4,5,4,5,6,4,6,6,6,6,5,5,6,6,3,6,6,5,7,7,6,6,6,6,6,5,6,7,7,7,7,5,5,3,5,6,4";
maprow = new Array();
maprow = tstring.split(",");
var k:int;
while (k < 96) {
bfontlen[(k + 32)] = int(maprow[k]);
k++;
};
}
public function textboxtimer(t:int):void{
textbox[z].timer = t;
}
public function addbackground():void{
var t:BitmapData = new BitmapData(160, 144, true, 0);
t.copyPixels(buffer, bg_rect, tl);
backgrounds.push(t);
}
public function drawimage(t:int, xp:int, yp:int, cent:Boolean=false):void{
if (cent){
backbuffer.copyPixels(images[t], new Rectangle(0, 0, images[t].width, images[t].height), new Point((80 - int((images[t].width / 2))), yp));
} else {
backbuffer.copyPixels(images[t], new Rectangle(0, 0, images[t].width, images[t].height), new Point(xp, yp));
};
}
public function printmasktemptile(x:int, y:int, t:String, cen:Boolean=false):void{
if (cen){
x = (80 - (len(t) / 2));
};
bfontpos = 0;
var i:int;
while (i < t.length) {
cur = t.charCodeAt(i);
temptile.copyPixels(bfontmask[cur], bfont_rect, new Point(((x + bfontpos) - 1), y));
bfontpos = (bfontpos + bfontlen[cur]);
i++;
};
}
public function heavyshake():void{
screenbuffer.lock();
screenbuffer.copyPixels(backbuffer, backbuffer.rect, tl, null, null, false);
screenbuffer.copyPixels(backbuffer, backbuffer.rect, new Point(((Math.random() * 50) - 25), ((Math.random() * 50) - 25)), null, null, false);
screenbuffer.unlock();
backbuffer.lock();
backbuffer.fillRect(backbuffer.rect, 0);
backbuffer.unlock();
}
public function RGB(red:Number, green:Number, blue:Number):Number{
return (((blue | (green << 8)) | (red << 16)));
}
public function print(x:int, y:int, t:String, r:int, g:int, b:int, cen:Boolean=false):void{
if (r < 0){
r = 0;
};
if (g < 0){
g = 0;
};
if (b < 0){
b = 0;
};
if (r > 0xFF){
r = 0xFF;
};
if (g > 0xFF){
g = 0xFF;
};
if (b > 0xFF){
b = 0xFF;
};
ct.color = RGB(r, g, b);
if (cen){
x = (80 - (len(t) / 2));
};
bfontpos = 0;
var i:int;
while (i < t.length) {
cur = t.charCodeAt(i);
bfont[cur].colorTransform(bfont_rect, ct);
backbuffer.copyPixels(bfont[cur], bfont_rect, new Point((x + bfontpos), y));
bfontpos = (bfontpos + bfontlen[cur]);
i++;
};
}
public function createtextbox(t:String, xp:int, yp:int, r:int=0xFF, g:int=0xFF, b:int=0xFF):void{
if (ntextbox == 0){
z = 0;
ntextbox++;
} else {
i = 0;
z = -1;
while (i < ntextbox) {
if (!textbox[i].active){
z = i;
i = ntextbox;
};
i++;
};
if (z == -1){
z = ntextbox;
ntextbox++;
};
};
if (z < 20){
textbox[z].clear();
textbox[z].line[0] = t;
textbox[z].xp = xp;
if (xp == -1){
textbox[z].xp = (160 - (((t.length / 2) + 1) * 8));
};
textbox[z].yp = yp;
textbox[z].initcol(r, g, b);
textbox[z].resize();
};
}
public function drawentities(obj:entityclass, help:helpclass):void{
var j:int;
var k:int;
var i:int;
while (i < obj.nentity) {
if (obj.entities[i].size == 1){
j = 0;
while (j < 2) {
k = 0;
while (k < 2) {
backbuffer.copyPixels(sprites[((obj.entities[i].drawframe + j) + (k * 20))], sprites_rect, new Point((obj.entities[i].xp + (j * 16)), (obj.entities[i].yp + (k * 16))));
k++;
};
j++;
};
} else {
if (obj.entities[i].size == 2){
if (((!(obj.entities[i].invis)) && (obj.entities[i].active))){
backbuffer.copyPixels(tiles[obj.entities[i].drawframe], tiles_rect, new Point(obj.entities[i].xp, obj.entities[i].yp));
backbuffer.copyPixels(tiles[(obj.entities[i].drawframe + 20)], tiles_rect, new Point(obj.entities[i].xp, (obj.entities[i].yp + 16)));
};
} else {
if (!obj.entities[i].invis){
backbuffer.copyPixels(sprites[obj.entities[i].drawframe], sprites_rect, new Point(obj.entities[i].xp, obj.entities[i].yp));
};
};
};
i++;
};
}
public function textboxremovebox(t:String):void{
i = 0;
while (i < ntextbox) {
if (textbox[i].boxname == t){
textbox[i].remove();
};
i++;
};
}
public function bprinttemptile(x:int, y:int, t:String, r:int, g:int, b:int, cen:Boolean=false):void{
printmasktemptile(x, y, t, cen);
printtemptile(x, y, t, r, g, b, cen);
}
public function init():void{
var t:textboxclass;
updatebackground = true;
tiles_rect = new Rectangle(0, 0, 16, 16);
sprites_rect = new Rectangle(0, 0, 32, 32);
bfont_rect = new Rectangle(0, 0, 8, 8);
bfontmask_rect = new Rectangle(0, 0, 9, 9);
bg_rect = new Rectangle(0, 0, 160, 120);
tl = new Point(0, 0);
ct = new ColorTransform(0, 0, 0, 1, 0xFF, 0xFF, 0xFF, 1);
temprect = new Rectangle(0, 0, 0, 0);
i = 0;
while (i < 20) {
t = new textboxclass();
textbox.push(t);
i++;
};
ntextbox = 0;
i = 0;
while (i < 100) {
texture.push(new texclass());
i++;
};
i = 0;
while (i < 160) {
ZBuffer.push(Number);
i++;
};
backbuffer = new BitmapData(160, 120, false, 0);
screenbuffer = new BitmapData(160, 120, false, 0);
temptile = new BitmapData(16, 16, false, 0);
screen = new Bitmap(screenbuffer);
screen.width = 640;
screen.height = 480;
addChild(screen);
}
public function printmask(x:int, y:int, t:String, cen:Boolean=false):void{
if (cen){
x = (160 - (len(t) / 2));
};
bfontpos = 0;
var i:int;
while (i < t.length) {
cur = t.charCodeAt(i);
backbuffer.copyPixels(bfontmask[cur], bfont_rect, new Point(((x + bfontpos) - 1), y));
bfontpos = (bfontpos + bfontlen[cur]);
i++;
};
}
public function drawplayer(game:gameclass):void{
game.playerframe = ((game.dir * 3) + game.playerwframe);
backbuffer.copyPixels(rpgtiles[(40 + game.playerframe)], tiles_rect, new Point((((game.playerx * 16) + (game.pxoff * 4)) + xoffset), (((game.playery * 16) + (game.pyoff * 4)) + yoffset)));
}
public function flashlight():void{
backbuffer.fillRect(backbuffer.rect, 0xFF0000);
}
public function drawbuffertile(x:int, y:int, t:int):void{
buffer.copyPixels(tiles[t], tiles_rect, new Point(x, y));
}
public function drawline(x1:int, y1:int, x2:int, y2:int, r:int, g:int, b:int):void{
if (x1 > x2){
drawline(x2, y1, x1, y2, r, g, b);
} else {
if (y1 > y2){
drawline(x1, y2, x2, y1, r, g, b);
} else {
tempshape.graphics.clear();
tempshape.graphics.lineStyle(1, RGB(r, g, b));
tempshape.graphics.lineTo((x2 - x1), (y2 - y1));
shapematrix.translate(x1, y1);
backbuffer.draw(tempshape, shapematrix);
shapematrix.translate(-(x1), -(y1));
};
};
}
public function setrect(x1:int, y1:int, w1:int, h1:int):void{
temprect.x = x1;
temprect.y = y1;
temprect.width = w1;
temprect.height = h1;
}
public function createbox(t:String):void{
if (t == "testbox"){
createtextbox("testbox", 40, 40, 0xFF, 0xFF, 0xFF);
createtextbox("yes!", 50, 90, 196, 196, 0xFF);
addline("no");
textboxsetmenu("shitbox");
} else {
if (t == "testbox2"){
createtextbox("testbox2", 90, 90, 0xFF, 0xFF, 0xFF);
createtextbox("yesyes", 90, 150, 196, 196, 0xFF);
addline("nono");
textboxsetmenu("shitbox2");
};
};
}
public function textboxcenter():void{
textbox[z].centerx();
textbox[z].centery();
}
public function addimage():void{
var t:BitmapData = new BitmapData(buffer.width, buffer.height, true, 0);
t.copyPixels(buffer, new Rectangle(0, 0, buffer.width, buffer.height), tl);
images.push(t);
}
public function textboxcleanup():void{
i = (ntextbox - 1);
while ((((i >= 0)) && (!(textbox[i].active)))) {
ntextbox--;
i--;
};
}
public function drawbackground(game:gameclass, map:mapclass):void{
var i:int;
if (game.mapscrollx > 0){
game.mapscrollx--;
};
if (game.mapscrollx < 0){
game.mapscrollx++;
};
if (game.mapscrolly > 0){
game.mapscrolly--;
};
if (game.mapscrolly < 0){
game.mapscrolly++;
};
xoffset = (game.mapscrollx * 8);
yoffset = (game.mapscrolly * 6);
var j:int;
while (j < 8) {
i = 0;
while (i < 10) {
drawrpgtile(((i * 16) + xoffset), ((j * 16) + yoffset), map.rpgcontents[(i + (j * 10))]);
i++;
};
j++;
};
if (xoffset > 0){
j = 0;
while (j < 8) {
i = 0;
while (i < 10) {
drawrpgtile((((i * 16) + xoffset) - 160), ((j * 16) + yoffset), map.rpgoldmap[(i + (j * 10))]);
i++;
};
j++;
};
} else {
if (xoffset < 0){
j = 0;
while (j < 8) {
i = 0;
while (i < 10) {
drawrpgtile((((i * 16) + xoffset) + 160), ((j * 16) + yoffset), map.rpgoldmap[(i + (j * 10))]);
i++;
};
j++;
};
};
};
if (yoffset > 0){
j = 0;
while (j < 8) {
i = 0;
while (i < 10) {
drawrpgtile(((i * 16) + xoffset), (((j * 16) + yoffset) - 120), map.rpgoldmap[(i + (j * 10))]);
i++;
};
j++;
};
} else {
if (yoffset < 0){
j = 0;
while (j < 8) {
i = 0;
while (i < 10) {
drawrpgtile(((i * 16) + xoffset), (((j * 16) + yoffset) + 120), map.rpgoldmap[(i + (j * 10))]);
i++;
};
j++;
};
};
};
}
public function drawgui(help:helpclass):void{
textboxcleanup();
i = 0;
while (i < ntextbox) {
textbox[i].update();
if (textbox[i].active){
if (textbox[i].ismenu){
backbuffer.fillRect(textbox[i].textrect, RGB((textbox[i].r / 6), (textbox[i].g / 6), (textbox[i].b / 6)));
j = 0;
while (j < textbox[i].numlines) {
if (textbox[i].highlighted == j){
print((textbox[i].xp + 2), ((textbox[i].yp + 8) + (j * 8)), ">", (0xFF - help.glow), (0xFF - help.glow), (0xFF - help.glow));
print((textbox[i].xp + 8), ((textbox[i].yp + 8) + (j * 8)), textbox[i].line[j], (0xFF - help.glow), (0xFF - help.glow), (0xFF - help.glow));
} else {
print((textbox[i].xp + 8), ((textbox[i].yp + 8) + (j * 8)), textbox[i].line[j], (textbox[i].r * 0.5), (textbox[i].g * 0.5), (textbox[i].b * 0.5));
};
j++;
};
} else {
backbuffer.fillRect(textbox[i].textrect, RGB((textbox[i].r / 6), (textbox[i].g / 6), (textbox[i].b / 6)));
j = 0;
while (j < textbox[i].numlines) {
print((textbox[i].xp + 8), ((textbox[i].yp + 8) + (j * 8)), textbox[i].line[j], textbox[i].r, textbox[i].g, textbox[i].b);
j++;
};
};
};
i++;
};
}
public function textboxremove():void{
i = 0;
while (i < ntextbox) {
textbox[i].remove();
i++;
};
}
public function textboxsetmenu(t:String):void{
textbox[z].boxname = t;
textbox[z].ismenu = true;
}
public function textboxcenterx():void{
textbox[z].centerx();
}
public function textboxcentery():void{
textbox[z].centery();
}
public function bprint(x:int, y:int, t:String, r:int, g:int, b:int, cen:Boolean=false):void{
printmask(x, y, t, cen);
print(x, y, t, r, g, b, cen);
}
public function makerpgtilearray():void{
var i:Number;
var t:BitmapData;
var temprect:Rectangle;
var j:Number = 0;
while (j < 15) {
i = 0;
while (i < 20) {
t = new BitmapData(16, 16, true, 0);
temprect = new Rectangle((i * 16), (j * 16), 16, 16);
t.copyPixels(buffer, temprect, tl);
rpgtiles.push(t);
i++;
};
j++;
};
}
public function render():void{
screenbuffer.lock();
screenbuffer.copyPixels(backbuffer, backbuffer.rect, tl, null, null, false);
screenbuffer.unlock();
backbuffer.lock();
backbuffer.fillRect(backbuffer.rect, 0);
backbuffer.unlock();
}
public function drawtransition(game:gameclass):void{
switch (game.transitionmode){
case 1:
case 4:
case 10:
backbuffer.fillRect(new Rectangle(0, 0, 160, game.transitiondelay), 0);
backbuffer.fillRect(new Rectangle(0, (120 - game.transitiondelay), 160, game.transitiondelay), 0);
break;
case 2:
case 5:
case 11:
backbuffer.fillRect(new Rectangle(0, 0, 160, 120), 0);
break;
case 3:
case 6:
case 12:
backbuffer.fillRect(new Rectangle(0, 0, 160, game.transitiondelay), 0);
backbuffer.fillRect(new Rectangle(0, (120 - game.transitiondelay), 160, game.transitiondelay), 0);
break;
case 7:
backbuffer.fillRect(new Rectangle(0, 0, 160, (game.transitiondelay * 2)), 0xFF0000);
break;
case 8:
backbuffer.fillRect(new Rectangle(0, 0, 160, 120), 0xFF0000);
break;
case 9:
backbuffer.fillRect(new Rectangle(0, 0, 160, game.transitiondelay), 0xFF0000);
break;
};
}
public function drawtextbox(t:int):void{
backbuffer.fillRect(new Rectangle(5, ((87 + Math.abs(tbpos)) - 15), 150, (39 + 8)), 0);
backbuffer.fillRect(new Rectangle(6, ((88 + Math.abs(tbpos)) - 15), 148, (37 + 8)), 5662835);
backbuffer.fillRect(new Rectangle(7, ((89 + Math.abs(tbpos)) - 15), 146, (35 + 8)), 0);
backbuffer.fillRect(new Rectangle(8, ((90 + Math.abs(tbpos)) - 15), 144, (33 + 8)), 3041475);
switch (t){
case 0:
print(9, ((90 + Math.abs(tbpos)) - 15), "My faithful darling, my", 234, 234, 230, true);
print(9, ((98 + Math.abs(tbpos)) - 15), "seet-eyed blackguard", 234, 234, 230, true);
print(9, ((106 + Math.abs(tbpos)) - 15), "schoolgirl, be my whore,", 234, 234, 230, true);
print(9, ((114 + Math.abs(tbpos)) - 15), "my mistress, as much as ", 234, 234, 230, true);
print(9, ((122 + Math.abs(tbpos)) - 15), "you like (my little frigging", 234, 234, 230, true);
break;
case 10:
print(9, ((90 + Math.abs(tbpos)) - 15), "mistress! My little fucking", 234, 234, 230, true);
print(9, ((98 + Math.abs(tbpos)) - 15), "whore!) you are always my", 234, 234, 230, true);
print(9, ((106 + Math.abs(tbpos)) - 15), "beautiful wild flower of", 234, 234, 230, true);
print(9, ((114 + Math.abs(tbpos)) - 15), "the hedges, my dark-blue", 234, 234, 230, true);
print(9, ((122 + Math.abs(tbpos)) - 15), "rain-drenched flower.", 234, 234, 230, true);
break;
case 1:
print(9, ((90 + Math.abs(tbpos)) - 15), "I have been trying to", 234, 234, 230, true);
print(9, ((98 + Math.abs(tbpos)) - 15), "picture you frigging your", 234, 234, 230, true);
print(9, ((106 + Math.abs(tbpos)) - 15), "cunt in the closet. How", 234, 234, 230, true);
print(9, ((114 + Math.abs(tbpos)) - 15), "do you do it?", 234, 234, 230, true);
print(9, ((122 + Math.abs(tbpos)) - 15), "", 234, 234, 230, true);
break;
case 20:
print(9, ((90 + Math.abs(tbpos)) - 15), "Do you stand against the", 234, 234, 230, true);
print(9, ((98 + Math.abs(tbpos)) - 15), "wall with your hand", 234, 234, 230, true);
print(9, ((106 + Math.abs(tbpos)) - 15), "tickling up under your", 234, 234, 230, true);
print(9, ((114 + Math.abs(tbpos)) - 15), "clothes or do you squat", 234, 234, 230, true);
print(9, ((122 + Math.abs(tbpos)) - 15), "down on the hole with", 234, 234, 230, true);
break;
case 21:
print(9, ((90 + Math.abs(tbpos)) - 15), "your skirts up and your", 234, 234, 230, true);
print(9, ((98 + Math.abs(tbpos)) - 15), "hand hard at work in ", 234, 234, 230, true);
print(9, ((106 + Math.abs(tbpos)) - 15), "through the slit of ", 234, 234, 230, true);
print(9, ((114 + Math.abs(tbpos)) - 15), "your drawers?", 234, 234, 230, true);
print(9, ((122 + Math.abs(tbpos)) - 15), "", 234, 234, 230, true);
break;
case 2:
print(9, ((90 + Math.abs(tbpos)) - 15), "I prefer your arse,", 234, 234, 230, true);
print(9, ((98 + Math.abs(tbpos)) - 15), "darling, to your bubbies", 234, 234, 230, true);
print(9, ((106 + Math.abs(tbpos)) - 15), "because it does such a", 234, 234, 230, true);
print(9, ((114 + Math.abs(tbpos)) - 15), "dirty thing. I love your", 234, 234, 230, true);
print(9, ((122 + Math.abs(tbpos)) - 15), "cunt not so much because", 234, 234, 230, true);
break;
case 30:
print(9, ((90 + Math.abs(tbpos)) - 15), "", 234, 234, 230, true);
print(9, ((98 + Math.abs(tbpos)) - 15), "it is the part I block", 234, 234, 230, true);
print(9, ((106 + Math.abs(tbpos)) - 15), "but because it does", 234, 234, 230, true);
print(9, ((114 + Math.abs(tbpos)) - 15), "another dirty thing.", 234, 234, 230, true);
print(9, ((122 + Math.abs(tbpos)) - 15), "", 234, 234, 230, true);
break;
case 3:
print(9, ((90 + Math.abs(tbpos)) - 15), "You had an arse full of", 234, 234, 230, true);
print(9, ((98 + Math.abs(tbpos)) - 15), "farts that night, darling,", 234, 234, 230, true);
print(9, ((106 + Math.abs(tbpos)) - 15), "and I fucked them out of", 234, 234, 230, true);
print(9, ((114 + Math.abs(tbpos)) - 15), "you, big fat fellows, long", 234, 234, 230, true);
print(9, ((122 + Math.abs(tbpos)) - 15), "windy ones, quick little", 234, 234, 230, true);
break;
case 40:
print(9, ((90 + Math.abs(tbpos)) - 15), "merry cracks and a lot", 234, 234, 230, true);
print(9, ((98 + Math.abs(tbpos)) - 15), "of tiny little naughty", 234, 234, 230, true);
print(9, ((106 + Math.abs(tbpos)) - 15), "farties ending in a long", 234, 234, 230, true);
print(9, ((114 + Math.abs(tbpos)) - 15), "gush from your hole.", 234, 234, 230, true);
print(9, ((122 + Math.abs(tbpos)) - 15), "", 234, 234, 230, true);
break;
};
if (tbpos > 0){
tbpos = (tbpos - 10);
};
if (tbpos < 0){
tbpos = (tbpos - 10);
};
}
public function inittextures():void{
k = 0;
while (k < 40) {
i = 0;
while (i < 8) {
j = 0;
while (j < 8) {
texture[k].contents[(i + (j * 8))] = tiles[k].getPixel(i, j);
texture[k].rc[(i + (j * 8))] = ((texture[k].contents[(i + (j * 8))] >> 16) & 0xFF);
texture[k].gc[(i + (j * 8))] = ((texture[k].contents[(i + (j * 8))] >> 8) & 0xFF);
texture[k].bc[(i + (j * 8))] = (texture[k].contents[(i + (j * 8))] & 0xFF);
j++;
};
i++;
};
k++;
};
}
public function makebfontmask():void{
var i:Number;
var t:BitmapData;
var temprect:Rectangle;
var j:Number = 0;
while (j < 16) {
i = 0;
while (i < 16) {
t = new BitmapData(9, 9, true, 0);
temprect = new Rectangle((i * 9), (j * 9), 9, 9);
t.copyPixels(buffer, temprect, tl);
bfontmask.push(t);
i++;
};
j++;
};
}
public function drawtile(x:int, y:int, t:int):void{
backbuffer.copyPixels(tiles[t], tiles_rect, new Point(x, y));
}
}
}//package
Section 12
//entclass (entclass)
package {
import flash.display.*;
public class entclass extends Sprite {
public var size:int;
public var rule:int;
public var active:Boolean;
public var hp:int;
public var onentity:Boolean;
public var jumpframe:int;
public var state:int;
public var statedelay:int;
public var walkingframe:int;
public var jumping:Boolean;
public var yp:Number;
public var newxp:int;
public var harmful:Boolean;
public var dir:int;
public var onxwall:int;
public var onwall:int;
public var onground:Boolean;
public var tile:int;
public var newyp:int;
public var ay:Number;
public var type:int;
public var cx:int;
public var framedelay:int;
public var ax:Number;
public var drawframe:int;
public var vx:Number;
public var vy:Number;
public var onywall:int;
public var hurtframe:int;
public var gravity:Boolean;
public var invis:Boolean;
public var ch:int;
public var h:int;
public var cw:int;
public var cy:int;
public var deathframe:int;
public var life:int;
public var w:int;
public var xp:Number;
public function entclass():void{
super();
clear();
}
public function clear():void{
active = false;
invis = false;
type = 0;
size = 0;
tile = 0;
rule = 0;
state = 0;
statedelay = 0;
life = 0;
hp = 10;
xp = 0;
yp = 0;
ax = 0;
ay = 0;
vx = 0;
vy = 0;
cw = 16;
ch = 16;
w = 16;
h = 16;
cx = 0;
cy = 0;
framedelay = 0;
drawframe = 0;
walkingframe = 0;
dir = 0;
hurtframe = 0;
deathframe = 0;
}
}
}//package
Section 13
//entityclass (entityclass)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
public class entityclass extends Sprite {
public var z:int;
public var blocks:Array;
public var flags:Array;
public var temph:int;
public var tempi:int;
public var nblocks:int;
public var tempn:Number;
public var colpoint1:Point;
public var tempw:int;
public var tempx:int;
public var tempy:int;
public var spriteOrder:Array;
public var colpoint2:Point;
public var temprect:Rectangle;
public var entities:Array;
public var nentity:int;
public var temp:int;
public var temp2:int;
public var spriteDistance:Array;
public var i:int;
public var j:int;
public var activetrigger:int;
public var tempxmove:Number;
public var temprect2:Rectangle;
public var tempymove:Number;
public static var TRIGGER:Number = 1;
public static var BLOCK:Number = 0;
public static var DAMAGE:Number = 2;
public function entityclass(){
entities = new Array();
blocks = new Array();
spriteOrder = new Array();
spriteDistance = new Array();
flags = new Array();
super();
}
public function removeblock(t:int):void{
blocks[t].clear();
i = (nblocks - 1);
while ((((i >= 0)) && (!(blocks[i].active)))) {
nblocks--;
i--;
};
}
public function updateentities(i:int, help:helpclass, game:gameclass, map:mapclass, music:musicclass):Boolean{
if (entities[i].active){
if (entities[i].statedelay <= 0){
switch (entities[i].type){
case 0:
if (entities[i].state == 0){
if (Math.abs((entities[i].xp - game.posX)) < 20){
if (Math.abs((entities[i].yp - game.posY)) < 20){
tempxmove = 0;
tempymove = 0;
if (entities[i].xp < (game.posX - 0.1)){
tempxmove = 0.05;
} else {
if (entities[i].xp > (game.posX + 0.1)){
tempxmove = -0.05;
};
};
if (entities[i].yp < (game.posY - 0.1)){
tempymove = 0.05;
} else {
if (entities[i].yp > (game.posY + 0.1)){
tempymove = -0.05;
};
};
moveentity(i, tempxmove, tempymove, map);
};
};
} else {
if (entities[i].state == 1){
moveentity(i, (game.dirX / 5), 0, map);
moveentity(i, 0, (game.dirY / 5), map);
entities[i].state = 0;
entities[i].statedelay = 5;
if (entities[i].hp <= 0){
entities[i].state = 2;
entities[i].deathframe = 10;
music.playef(13, 10);
} else {
music.playef(12, 10);
};
} else {
if (entities[i].state == 2){
entities[i].deathframe--;
if (entities[i].deathframe <= 1){
entities[i].active = false;
game.score++;
};
};
};
};
break;
};
} else {
entities[i].statedelay--;
if (entities[i].statedelay < 0){
entities[i].statedelay = 0;
};
};
};
return (true);
}
public function init():void{
var i:Number;
var entity:entclass;
var block:blockclass;
var t:int;
nentity = 0;
nblocks = 0;
temprect = new Rectangle();
temprect2 = new Rectangle();
colpoint1 = new Point();
colpoint2 = new Point();
var z:Number = 0;
while (z < 200) {
entity = new entclass();
entities.push(entity);
block = new blockclass();
blocks.push(block);
z++;
};
i = 0;
while (i < 500) {
spriteOrder.push(0);
spriteDistance.push(Number(0));
i++;
};
i = 0;
while (i < 300) {
t = 0;
flags.push(t);
i++;
};
}
public function createblock(t:int, xp:int=0, yp:int=0, w:int=0, h:int=0, trig:int=0):void{
if (nblocks == 0){
z = 0;
nblocks++;
} else {
i = 0;
z = -1;
while (i < nblocks) {
if (!blocks[i].active){
z = i;
i = nblocks;
};
i++;
};
if (z == -1){
z = nblocks;
nblocks++;
};
};
blocks[z].clear();
blocks[z].active = true;
switch (t){
case BLOCK:
blocks[z].type = BLOCK;
blocks[z].xp = xp;
blocks[z].yp = yp;
blocks[z].wp = w;
blocks[z].hp = h;
blocks[z].rectset(xp, yp, w, h);
nblocks++;
break;
case TRIGGER:
blocks[z].type = TRIGGER;
blocks[z].x = xp;
blocks[z].y = yp;
blocks[z].w = w;
blocks[z].h = h;
blocks[z].rectset(xp, yp, w, h);
blocks[z].trigger = trig;
nblocks++;
break;
case DAMAGE:
blocks[z].type = DAMAGE;
blocks[z].x = xp;
blocks[z].y = yp;
blocks[z].w = w;
blocks[z].h = h;
blocks[z].rectset(xp, yp, w, h);
nblocks++;
break;
};
}
public function gettype(t:int):Boolean{
var i:int;
while (i < nentity) {
if (entities[i].type == t){
return (true);
};
i++;
};
return (false);
}
public function resetflags():void{
var i:Number = 0;
while (i < 300) {
if (flags[i] == 2){
flags[i] = 0;
};
i++;
};
}
public function animateentities(i:int, help:helpclass):void{
if (entities[i].active){
if (entities[i].statedelay <= 0){
switch (entities[i].type){
case 0:
entities[i].drawframe = entities[i].tile;
entities[i].framedelay--;
if (entities[i].framedelay <= 0){
entities[i].drawframe++;
if (entities[i].framedelay <= -6){
entities[i].framedelay = 6;
};
};
entities[i].hurtframe--;
if (entities[i].hurtframe > 0){
entities[i].drawframe = (entities[i].tile + 2);
};
if (entities[i].deathframe > 0){
entities[i].drawframe = (entities[i].tile + 2);
if (entities[i].deathframe < 5){
entities[i].drawframe++;
};
if (entities[i].deathframe < 3){
entities[i].drawframe++;
};
};
break;
default:
entities[i].drawframe = entities[i].tile;
break;
};
} else {
entities[i].statedelay--;
if (entities[i].statedelay < 0){
entities[i].statedelay = 0;
};
};
};
}
public function checktrigger():int{
i = 0;
while (i < nentity) {
if (entities[i].rule == 0){
tempx = (entities[i].xp + entities[i].cx);
tempy = (entities[i].yp + entities[i].cy);
tempw = entities[i].cw;
temph = entities[i].ch;
rectset(tempx, tempy, tempw, temph);
j = 0;
while (j < nblocks) {
if (blocks[j].type == TRIGGER){
if (blocks[j].rect.intersects(temprect)){
return (blocks[j].trigger);
};
};
j++;
};
};
i++;
};
return (-1);
}
public function removetrigger(t:int):void{
i = 0;
while (i < nblocks) {
if (blocks[i].type == TRIGGER){
if (blocks[i].trigger == t){
removeblock(i);
};
};
i++;
};
}
public function getplayer():int{
var i:int;
while (i < nentity) {
if (entities[i].type == 0){
return (i);
};
i++;
};
return (-1);
}
public function entitycollisioncheck(dwgfx:dwgraphicsclass, game:gameclass, map:mapclass, music:musicclass):void{
i = 0;
while (i < nentity) {
if (entities[i].active){
j = 0;
while (j < nentity) {
if (entities[j].active){
if ((((((entities[i].rule == 0)) && ((entities[j].rule == 1)))) && (entities[j].harmful))){
if (entitycollide(i, j)){
if ((((entities[i].size == 0)) && ((entities[j].size == 0)))){
colpoint1.x = entities[i].xp;
colpoint1.y = entities[i].yp;
colpoint2.x = entities[j].xp;
colpoint2.y = entities[j].yp;
if (dwgfx.sprites[entities[i].drawframe].hitTest(colpoint1, 1, dwgfx.sprites[entities[j].drawframe], colpoint2, 1)){
game.deathseq = 30;
};
} else {
game.deathseq = 30;
};
};
};
if ((((entities[i].rule == 0)) && ((entities[j].rule == 2)))){
if (entities[j].onentity > 0){
if (entitycollide(i, j)){
entities[j].state = entities[j].onentity;
};
};
};
};
j++;
};
};
i++;
};
if (checkdamage()){
game.deathseq = 30;
};
activetrigger = -1;
if (checktrigger() > -1){
game.state = activetrigger;
};
}
public function combSort():void{
var gap:int = nentity;
var swapped:Boolean;
while ((((gap > 1)) || (swapped))) {
gap = ((gap * 10) / 13);
if ((((gap == 9)) || ((gap == 10)))){
gap = 11;
};
if (gap < 1){
gap = 1;
};
swapped = false;
i = 0;
while (i < (nentity - gap)) {
j = (i + gap);
if (spriteDistance[i] < spriteDistance[j]){
tempn = spriteDistance[i];
spriteDistance[i] = spriteDistance[j];
spriteDistance[j] = tempn;
tempi = spriteOrder[i];
spriteOrder[i] = spriteOrder[j];
spriteOrder[j] = tempi;
swapped = true;
};
i++;
};
};
}
public function testwallsx(t:int, tx:int, ty:int):Boolean{
tempx = (tx + entities[t].cx);
tempy = (ty + entities[t].cy);
tempw = entities[t].cw;
temph = entities[t].ch;
rectset(tempx, tempy, tempw, temph);
if (checkwall()){
if (entities[t].vx > 1){
entities[t].vx--;
entities[t].newxp = int((entities[t].xp + entities[t].vx));
return (testwallsx(t, entities[t].newxp, entities[t].yp));
};
if (entities[t].vx < -1){
entities[t].vx++;
entities[t].newxp = int((entities[t].xp + entities[t].vx));
return (testwallsx(t, entities[t].newxp, entities[t].yp));
};
entities[t].vx = 0;
return (false);
};
return (true);
}
public function testwallsy(t:int, tx:int, ty:int):Boolean{
tempx = (tx + entities[t].cx);
tempy = (ty + entities[t].cy);
tempw = entities[t].cw;
temph = entities[t].ch;
rectset(tempx, tempy, tempw, temph);
if (checkwall()){
if (entities[t].vy > 1){
entities[t].vy--;
entities[t].newyp = int((entities[t].yp + entities[t].vy));
return (testwallsy(t, entities[t].xp, entities[t].newyp));
};
if (entities[t].vy < -1){
entities[t].vy++;
entities[t].newyp = int((entities[t].yp + entities[t].vy));
return (testwallsy(t, entities[t].xp, entities[t].newyp));
};
entities[t].vy = 0;
return (false);
};
return (true);
}
public function confirmflags():void{
var i:Number = 0;
while (i < 300) {
if (flags[i] == 2){
flags[i] = 1;
};
i++;
};
}
public function checkwall():Boolean{
i = 0;
while (i < nblocks) {
if (blocks[i].type == BLOCK){
if (blocks[i].rect.intersects(temprect)){
return (true);
};
};
i++;
};
return (false);
}
public function rect2set(xi:int, yi:int, wi:int, hi:int):void{
temprect2.x = xi;
temprect2.y = yi;
temprect2.width = wi;
temprect2.height = hi;
}
public function pickupexists():Boolean{
i = 0;
while (i < nentity) {
if (entities[i].type == 1){
return (true);
};
i++;
};
return (false);
}
public function removeentityat(t:int, xp:int, yp:int):void{
i = 0;
while (i < nentity) {
if ((((entities[i].tile == t)) && (entities[i].active))){
if ((((int((entities[i].xp - 0.5)) == xp)) && ((int((entities[i].yp - 0.5)) == yp)))){
entities[i].active = false;
};
};
i++;
};
}
public function createentity(xp:Number, yp:Number, t:int, vx:Number=0, vy:Number=0, para:int=0):void{
if (nentity == 0){
z = 0;
nentity++;
} else {
i = 0;
z = -1;
while (i < nentity) {
if (!entities[i].active){
z = i;
i = nentity;
};
i++;
};
if (z == -1){
z = nentity;
nentity++;
};
};
entities[z].clear();
entities[z].active = true;
switch (t){
case 0:
entities[z].rule = 0;
entities[z].type = 0;
entities[z].tile = 17;
entities[z].xp = (xp + 0.5);
entities[z].yp = (yp + 0.5);
break;
case 1:
entities[z].rule = 1;
entities[z].type = 1;
entities[z].tile = (26 + vx);
entities[z].xp = (xp + 0.5);
entities[z].yp = (yp + 0.5);
break;
};
}
public function removeallblocks():void{
i = 0;
while (i < nblocks) {
blocks[i].clear();
i++;
};
nblocks = 0;
}
public function applyfriction(t:int, xrate:Number, yrate:Number):void{
if (Math.abs(entities[t].vy) <= yrate){
entities[t].vy = 0;
};
if (entities[t].vy > 0){
entities[t].vy = (entities[t].vy - yrate);
};
if (entities[t].vy < 0){
entities[t].vy = (entities[t].vy + yrate);
};
if (entities[t].vy > 4){
entities[t].vy = 4;
};
if (entities[t].vy < -3){
entities[t].vy = -3;
};
if (entities[t].vx > 3){
entities[t].vx = 3;
};
if (entities[t].vx < -3){
entities[t].vx = -3;
};
}
public function removeentitysprite(t:int):void{
i = 0;
while (i < nentity) {
if (entities[i].tile == t){
entities[i].active = false;
};
i++;
};
}
public function entitycollidefloor(t:int):Boolean{
tempx = (entities[t].xp + entities[t].cx);
tempy = ((entities[t].yp + entities[t].cy) + 1);
tempw = entities[t].cw;
temph = entities[t].ch;
rectset(tempx, tempy, tempw, temph);
if (checkwall()){
return (true);
};
return (false);
}
public function moveentity(t:int, xdiff:Number, ydiff:Number, map:mapclass):void{
if (map.at(int((entities[t].xp + xdiff)), int((entities[t].yp + ydiff))) == 0){
entities[t].xp = (entities[t].xp + xdiff);
entities[t].yp = (entities[t].yp + ydiff);
};
}
public function checkdamage():Boolean{
i = 0;
while (i < nentity) {
if (entities[i].rule == 0){
tempx = (entities[i].xp + entities[i].cx);
tempy = (entities[i].yp + entities[i].cy);
tempw = entities[i].cw;
temph = entities[i].ch;
rectset(tempx, tempy, tempw, temph);
j = 0;
while (j < nblocks) {
if (blocks[j].type == DAMAGE){
if (blocks[j].rect.intersects(temprect)){
return (true);
};
};
j++;
};
};
i++;
};
return (false);
}
public function entitycollide(a:int, b:int):Boolean{
tempx = (entities[a].xp + entities[a].cx);
tempy = (entities[a].yp + entities[a].cy);
tempw = entities[a].w;
temph = entities[a].h;
rectset(tempx, tempy, tempw, temph);
tempx = (entities[b].xp + entities[b].cx);
tempy = (entities[b].yp + entities[b].cy);
tempw = entities[b].w;
temph = entities[b].h;
rect2set(tempx, tempy, tempw, temph);
if (temprect.intersects(temprect2)){
return (true);
};
return (false);
}
public function removeblockat(x:int, y:int):void{
i = 0;
while (i < nblocks) {
if ((((blocks[i].x == x)) && ((blocks[i].y == y)))){
removeblock(i);
};
i++;
};
}
public function rectset(xi:int, yi:int, wi:int, hi:int):void{
temprect.x = xi;
temprect.y = yi;
temprect.width = wi;
temprect.height = hi;
}
}
}//package
Section 14
//gameclass (gameclass)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
public class gameclass extends Sprite {
public var ammomachinegun:int;
public var startspecial:Boolean;
public var screenshake:int;
public var teststring:String;
public var flashlight:int;
public var playerframe:int;
public var paused:Boolean;
public var oldDirX:Number;
public var oldDirY:Number;
public var bobbingstate:int;
public var startroom:int;
public var curtextbox:int;
public var numtriggers:int;
public var shootmode:int;
public var bg:int;
public var door_right:int;
public var transitiondelay:int;
public var globalsound:int;
public var startx:int;
public var starty:int;
public var showtitlemenu:int;
public var ammorpg:int;
public var jumpheld:Boolean;
public var pxoff:int;
public var i:int;
public var j:int;
public var dirX:Number;
public var dirY:Number;
public var triggertile:Array;
public var mapscrollx:int;
public var muted:Boolean;
public var objecttile:Array;
public var bobbing:int;
public var playerwframe:int;
public var readingtextbox:Boolean;
public var planeX:Number;
public var planeY:Number;
public var health:int;
public var mapscrolly:int;
public var hascontrol:Boolean;
public var posX:Number;
public var posY:Number;
public var currentmessage:String;
public var oldPlaneX:Number;
public var mutebutton:int;
public var dir:int;
public var state:int;
public var statedelay:int;
public var oldPlaneY:Number;
public var playerwdelay:int;
public var shootframedelay:int;
public var test:Boolean;
public var door_down:int;
public var newgun:int;
public var gunchangestate:int;
public var k:int;
public var transitionmode:int;
public var score:int;
public var mx:int;
public var my:int;
public var deathseq:int;
public var playerx:int;
public var playery:int;
public var damagetaker:int;
public var gunchangedelay:int;
public var findtarget:Boolean;
public var shootdelay:int;
public var gamestart:int;
public var door_up:int;
public var pyoff:int;
public var infocus:Boolean;
public var nextup:int;
public var finalbit:int;
public var encounterrate:int;
public var currentroom:int;
public var messagedelay:int;
public var gamestate:int;
public var pmoving:Boolean;
public var insights:int;
public var numobjects:int;
public var talkkeyheld:Boolean;
public var ammopistol:int;
public var gameover:int;
public var door_left:int;
public var shootweapon:int;
public static var GAMEMODE:Number = 0;
public static var TRIGGER:Number = 1;
public static var BLOCK:Number = 0;
public static var DAMAGE:Number = 2;
public function gameclass(obj:entityclass, help:helpclass, music:musicclass):void{
super();
infocus = true;
paused = false;
muted = false;
globalsound = 1;
addEventListener(Event.DEACTIVATE, windowNotActive);
addEventListener(Event.ACTIVATE, windowActive);
gamestate = GAMEMODE;
hascontrol = true;
jumpheld = false;
damagetaker = 0;
encounterrate = 0;
showtitlemenu = 0;
gamestart = 0;
messagedelay = 0;
currentmessage = "";
finalbit = 0;
deathseq = 0;
nextup = 0;
insights = -1;
bobbing = 0;
bobbingstate = 0;
shootmode = 0;
shootdelay = 0;
shootweapon = 0;
shootframedelay = 0;
findtarget = false;
newgun = 0;
gunchangestate = 0;
gunchangedelay = 0;
health = 100;
ammopistol = 12;
ammomachinegun = 0;
ammorpg = 0;
triggertile = new Array();
objecttile = new Array();
i = 0;
while (i < 1000) {
triggertile.push(new triggertileclass());
objecttile.push(new triggertileclass());
i++;
};
test = false;
teststring = "FUCK FUCK FUCK FUCK FUCK FUCK FUCK FUCK";
state = 0;
statedelay = 0;
posX = 15.5;
posY = 6.5;
dirX = -1;
dirY = 0;
planeX = 0;
planeY = 0.66;
}
public function removetriggeratpos(t:int, xp:int, yp:int):void{
i = 0;
while (i < numtriggers) {
if (triggertile[i].action == t){
if ((((triggertile[i].x == xp)) && ((triggertile[i].y == yp)))){
removetriggerat(i);
i--;
};
};
i++;
};
}
public function windowActive(e:Event):void{
infocus = true;
}
public function removetriggers(t:int, s:int):void{
i = 0;
while (i < numtriggers) {
if ((((triggertile[i].action >= t)) && ((triggertile[i].action <= s)))){
removetriggerat(i);
i--;
};
i++;
};
}
public function start(dwgfx:dwgraphicsclass, map:mapclass, obj:entityclass, music:musicclass):void{
damagetaker = 15;
obj.nentity = 0;
state = 0;
statedelay = 0;
numtriggers = 0;
map.loadlevel(0, obj);
map.loadfloor(0, obj);
map.loadceiling(0, obj);
addtrigger(9, 2, 1000);
gameover = 0;
finalbit = 0;
score = 0;
showtitlemenu = 0;
gamestart = 0;
insights = -1;
bobbing = 0;
bobbingstate = 0;
shootmode = 0;
shootdelay = 0;
shootweapon = 0;
shootframedelay = 0;
findtarget = false;
newgun = 0;
gunchangestate = 0;
gunchangedelay = 0;
health = 100;
ammopistol = 12;
ammomachinegun = 0;
ammorpg = 0;
posX = 15.5;
posY = 6.5;
dirX = -1;
dirY = 0;
planeX = 0;
planeY = 0.66;
messagedelay = 0;
currentmessage = "";
gotoroom(0, obj, music, map);
playerx = 4;
playery = 3;
dir = 0;
}
public function updatestate(obj:entityclass, map:mapclass, help:helpclass, music:musicclass):void{
statedelay--;
if (statedelay <= 0){
statedelay = 0;
};
if (statedelay <= 0){
switch (state){
case 0:
break;
case 100:
music.playef(2, 10);
messagedelay = 30;
currentmessage = "PISTOL AMMO +6";
ammopistol = (ammopistol + 6);
if (ammopistol == 6){
gunchangestate = 1;
newgun = 0;
};
removetriggeratpos(100, int(posX), int(posY));
state = 0;
obj.removeentityat(26, int(posX), int(posY));
break;
case 101:
if (ammomachinegun > 0){
music.playef(2, 10);
messagedelay = 30;
currentmessage = "MACHINE GUN AMMO +10";
ammomachinegun = (ammomachinegun + 10);
} else {
music.playef(1, 10);
messagedelay = 45;
currentmessage = "FOUND MACHINE GUN";
ammomachinegun = 10;
gunchangestate = 1;
newgun = 1;
};
removetriggeratpos(101, int(posX), int(posY));
state = 0;
obj.removeentityat(27, int(posX), int(posY));
break;
case 102:
music.playef(2, 10);
messagedelay = 30;
currentmessage = "MACHINE GUN AMMO +10";
if (ammomachinegun > 0){
ammomachinegun = (ammomachinegun + 10);
} else {
ammomachinegun = 10;
gunchangestate = 1;
newgun = 1;
};
removetriggeratpos(102, int(posX), int(posY));
state = 0;
obj.removeentityat(28, int(posX), int(posY));
if (finalbit == 1){
state = 1011;
};
break;
case 103:
music.playef(1, 10);
if (ammorpg > 0){
messagedelay = 30;
currentmessage = "RPG LAUNCHER AMMO +3";
ammorpg = (ammorpg + 3);
} else {
messagedelay = 45;
currentmessage = "FOUND RPG LAUNCHER";
ammorpg = 3;
gunchangestate = 1;
newgun = 2;
};
removetriggeratpos(103, int(posX), int(posY));
state = 0;
obj.removeentityat(29, int(posX), int(posY));
break;
case 104:
music.playef(3, 10);
messagedelay = 30;
currentmessage = "HEALTH +25";
health = (health + 25);
if (health > 100){
health = 100;
};
removetriggeratpos(104, int(posX), int(posY));
state = 0;
obj.removeentityat(30, int(posX), int(posY));
break;
case 1000:
damagetaker = 15;
removetrigger(1000);
obj.nentity = 0;
state = 0;
obj.createentity(3, 6, 0);
createpickup(2, 8, 0, obj);
createpickup(3, 8, 0, obj);
addtrigger(2, 11, 1001);
break;
case 1001:
damagetaker = 15;
removetrigger(1001);
obj.nentity = 0;
state = 0;
map.contents[(1 + map.vmult[10])] = 5;
addtrigger(4, 11, 1002);
break;
case 1002:
damagetaker = 15;
removetrigger(1002);
obj.nentity = 0;
state = 0;
obj.createentity(5, 14, 0);
obj.createentity(1, 17, 0);
obj.createentity(4, 20, 0);
obj.createentity(4, 32, 0);
addtrigger(3, 31, 1003);
break;
case 1003:
damagetaker = 15;
removetrigger(1003);
obj.nentity = 0;
state = 0;
map.contents[(3 + map.vmult[29])] = 1;
createpickup(10, 30, 1, obj);
addtrigger(13, 23, 1004);
break;
case 1004:
damagetaker = 15;
removetrigger(1004);
obj.nentity = 0;
state = 0;
map.contents[(11 + map.vmult[23])] = 1;
obj.createentity(18, 3, 0);
obj.createentity(15, 12, 0);
obj.createentity(20, 6, 0);
createpickup(16, 14, 0, obj);
createpickup(16, 13, 0, obj);
createpickup(18, 14, 4, obj);
createpickup(18, 13, 4, obj);
createpickup(13, 17, 2, obj);
createpickup(13, 16, 2, obj);
createpickup(13, 15, 2, obj);
addtrigger(22, 6, 1005);
break;
case 1005:
damagetaker = 15;
removetrigger(1005);
obj.nentity = 0;
state = 0;
map.contents[(21 + map.vmult[6])] = 6;
obj.createentity(27, 7, 0);
obj.createentity(31, 9, 0);
obj.createentity(34, 10, 0);
obj.createentity(36, 13, 0);
obj.createentity(27, 12, 0);
createpickup(36, 8, 4, obj);
addtrigger(38, 7, 1006);
break;
case 1006:
damagetaker = 15;
removetrigger(1006);
obj.nentity = 0;
state = 0;
map.contents[(37 + map.vmult[7])] = 1;
createpickup(41, 10, 3, obj);
addtrigger(40, 14, 1007);
break;
case 1007:
damagetaker = 15;
removetrigger(1007);
obj.nentity = 0;
state = 0;
map.contents[(39 + map.vmult[18])] = 1;
obj.createentity(43, 19, 0);
addtrigger(42, 20, 1008);
addtrigger(43, 20, 1008);
addtrigger(44, 20, 1008);
obj.createentity(44, 18, 0);
obj.createentity(42, 21, 0);
obj.createentity(43, 22, 0);
obj.createentity(44, 23, 0);
obj.createentity(42, 18, 0);
obj.createentity(44, 21, 0);
obj.createentity(42, 23, 0);
break;
case 1008:
damagetaker = 15;
removetrigger(1008);
obj.nentity = 0;
state = 0;
obj.createentity(38, 26, 0);
obj.createentity(37, 24, 0);
obj.createentity(39, 21, 0);
obj.createentity(35, 27, 0);
obj.createentity(34, 25, 0);
obj.createentity(35, 22, 0);
obj.createentity(33, 22, 0);
obj.createentity(34, 19, 0);
addtrigger(31, 19, 1009);
addtrigger(31, 20, 1009);
addtrigger(31, 21, 1009);
addtrigger(31, 22, 1009);
break;
case 1009:
damagetaker = 15;
removetrigger(1009);
obj.nentity = 0;
state = 0;
obj.createentity(27, 15, 0);
obj.createentity(25, 18, 0);
obj.createentity(22, 16, 0);
obj.createentity(20, 18, 0);
obj.createentity(20, 22, 0);
obj.createentity(20, 27, 0);
addtrigger(19, 37, 1010);
addtrigger(20, 37, 1010);
addtrigger(21, 37, 1010);
break;
case 1010:
damagetaker = 15;
removetrigger(1010);
obj.nentity = 0;
state = 0;
map.contents[(20 + map.vmult[36])] = 1;
music.fadeout();
finalbit = 1;
state = 1011;
statedelay = 35;
break;
case 1011:
damagetaker = 15;
state = 1011;
statedelay = 75;
music.play(2);
if (obj.nentity < 10){
i = (Math.random() * 100);
if (i < 33){
obj.createentity(14, 40, 0);
obj.createentity(26, 40, 0);
} else {
if (i < 66){
obj.createentity(26, 46, 0);
obj.createentity(14, 46, 0);
} else {
obj.createentity(20, 46, 0);
obj.createentity(20, 37, 0);
};
};
};
if (ammomachinegun < 4){
removetriggeratpos(102, 20, 40);
obj.removeentityat(28, 20, 40);
createpickup(20, 40, 2, obj);
};
break;
};
};
}
public function createpickup(xp:int, yp:int, t:int, obj:entityclass):void{
addtrigger(xp, yp, (t + 100));
obj.createentity(xp, yp, 1, t);
}
public function copytrigger(a:int, b:int):void{
triggertile[a].x = triggertile[b].x;
triggertile[a].y = triggertile[b].y;
triggertile[a].action = triggertile[b].action;
triggertile[a].name = triggertile[b].name;
}
public function windowNotActive(e:Event):void{
infocus = false;
}
public function checktrigger(xp:int, yp:int):void{
i = 0;
while (i < numtriggers) {
if (triggertile[i].x == int(xp)){
if (triggertile[i].y == int(yp)){
state = triggertile[i].action;
statedelay = 0;
};
};
i++;
};
}
public function removetrigger(t:int):void{
i = 0;
while (i < numtriggers) {
if (triggertile[i].action == t){
removetriggerat(i);
i--;
};
i++;
};
}
public function gotoroom(t:int, obj:entityclass, music:musicclass, map:mapclass):void{
if ((((t == currentroom)) || ((((t == startroom)) && ((startspecial == true)))))){
obj.resetflags();
} else {
obj.confirmflags();
};
obj.removeallblocks();
door_up = -2;
door_down = -2;
door_right = -2;
door_left = -2;
currentroom = t;
map.rpgloadlevel(t);
switch (t){
case 0:
bg = 0;
door_left = 2;
door_right = 1;
door_down = 4;
break;
case 1:
bg = 1;
door_left = 0;
door_down = 5;
break;
case 2:
bg = 2;
door_right = 0;
door_down = 3;
break;
case 3:
bg = 3;
door_right = 4;
door_up = 2;
door_down = 8;
break;
case 4:
bg = 4;
door_left = 3;
door_right = 5;
door_up = 0;
door_down = 7;
break;
case 5:
bg = 5;
door_left = 4;
door_up = 1;
door_down = 6;
break;
case 6:
bg = 6;
door_left = 7;
door_up = 5;
break;
case 7:
bg = 7;
door_left = 8;
door_up = 4;
door_right = 6;
break;
case 8:
bg = 8;
door_right = 7;
door_up = 3;
break;
};
}
public function updatetransition():void{
if (transitionmode == 1){
transitiondelay = (transitiondelay + 4);
if (transitiondelay >= 60){
transitionmode = 2;
};
} else {
if (transitionmode == 3){
transitiondelay = (transitiondelay - 4);
if (transitiondelay <= 0){
transitiondelay = 0;
transitionmode = 0;
};
} else {
if (transitionmode == 4){
transitiondelay = (transitiondelay + 4);
if (transitiondelay >= 60){
transitionmode = 5;
};
} else {
if (transitionmode == 6){
transitiondelay = (transitiondelay - 4);
if (transitiondelay <= 0){
transitiondelay = 0;
transitionmode = 0;
};
} else {
if (transitionmode == 7){
transitiondelay = (transitiondelay + 4);
if (transitiondelay >= 60){
transitionmode = 8;
};
} else {
if (transitionmode == 9){
transitiondelay = (transitiondelay - 4);
if (transitiondelay <= 0){
transitiondelay = 0;
transitionmode = 0;
};
} else {
if (transitionmode == 10){
transitiondelay = (transitiondelay + 4);
if (transitiondelay >= 60){
transitionmode = 11;
};
} else {
if (transitionmode == 12){
transitiondelay = (transitiondelay - 4);
if (transitiondelay <= 0){
transitiondelay = 0;
transitionmode = 0;
};
};
};
};
};
};
};
};
};
}
public function removetriggerat(t:int):void{
if (t == (numtriggers - 1)){
numtriggers--;
} else {
i = t;
while (i < numtriggers) {
copytrigger(i, (i + 1));
i++;
};
numtriggers--;
};
}
public function addtrigger(xp:int, yp:int, t:int):void{
triggertile[numtriggers].x = xp;
triggertile[numtriggers].y = yp;
triggertile[numtriggers].action = t;
triggertile[numtriggers].name = "trigger";
numtriggers++;
}
}
}//package
Section 15
//helpclass (helpclass)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
public class helpclass extends Sprite {
public var glowdir:int;
public var globaltemp3:int;
public var glow:int;
public var slowsine:int;
public var sine:Array;
public var globaltemp:int;
public var cosine:Array;
public var globaltemp2:int;
public function helpclass(){
super();
}
public function opa(t:int):int{
return (((t + 32) % 64));
}
public function removeObject(obj:Object, arr:Array):void{
var i:String;
for (i in arr) {
if (arr[i] == obj){
arr.splice(i, 1);
break;
};
};
}
public function number(t:int):String{
switch (t){
case 0:
return ("Zero");
case 1:
return ("One");
case 2:
return ("Two");
case 3:
return ("Three");
case 4:
return ("Four");
case 5:
return ("Five");
case 6:
return ("Six");
case 7:
return ("Seven");
case 8:
return ("Eight");
case 9:
return ("Nine");
case 10:
return ("Ten");
case 11:
return ("Eleven");
case 12:
return ("Twelve");
case 13:
return ("Thirteen");
case 14:
return ("Fourteen");
case 15:
return ("Fifteen");
case 16:
return ("Sixteen");
case 17:
return ("Seventeen");
case 18:
return ("Eighteen");
case 19:
return ("Nineteen");
case 20:
return ("Twenty");
case 21:
return ("Twenty One");
};
return ("Some");
}
public function init():void{
sine = new Array();
cosine = new Array();
var i:int;
while (i < 64) {
sine[i] = Math.sin(((i * 6.283) / 64));
cosine[i] = Math.cos(((i * 6.283) / 64));
i++;
};
glow = 0;
glowdir = 0;
slowsine = 0;
}
public function updateglow():void{
slowsine++;
if (slowsine >= 64){
slowsine = 0;
};
if (glowdir == 0){
glow = (glow + 2);
if (glow >= 62){
glowdir = 1;
};
} else {
glow = (glow - 2);
if (glow < 2){
glowdir = 0;
};
};
}
}
}//package
Section 16
//Main (Main)
package {
import bigroom.input.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
public class Main extends Sprite {
public var game:gameclass;
public var dwgfx:dwgraphicsclass;
private var ef_0:Class;
private var ef_2:Class;
private var ef_3:Class;
private var ef_4:Class;
private var ef_5:Class;
private var ef_7:Class;
private var ef_1:Class;
private var ef_9:Class;
private var ef_6:Class;
private var ef_8:Class;
public var music:musicclass;
private var im_sprites:Class;
public var CLICKTOSTART:int;// = 2
public var help:helpclass;
public var FOCUSMODE:int;// = 3
public var map:mapclass;
public var RPGGAMEMODE:int;// = 4
public var key:KeyPoll;
public var i:int;
public var k:int;
public var pixel2:uint;
public var j:int;
private var ef_10:Class;
private var ef_12:Class;
private var ef_13:Class;
private var ef_14:Class;
private var ef_11:Class;
public var pixel:uint;
public var GAMEMODE:int;// = 0
public var slogo:MovieClip;
private var im_tiles:Class;
private var im_image0:Class;
private var im_image2:Class;
private var im_image4:Class;
private var im_image5:Class;
private var im_image3:Class;
private var im_bfontmask:Class;
private var im_image1:Class;
public var temp:int;
public var logoposition:Matrix;
public var temp2:Number;
public var gamestate:int;
public var TITLEMODE:int;// = 1
public var tempstring:String;
public var obj:entityclass;
private var im_bfont:Class;
public var pi:uint;
public var pj:uint;
public static var TRIGGER:Number = 1;
public static var BLOCK:Number = 0;
public static var DAMAGE:Number = 2;
public function Main():void{
dwgfx = new dwgraphicsclass();
music = new musicclass();
map = new mapclass();
help = new helpclass();
obj = new entityclass();
im_tiles = Main_im_tiles;
im_sprites = Main_im_sprites;
im_bfont = Main_im_bfont;
im_bfontmask = Main_im_bfontmask;
im_image0 = Main_im_image0;
im_image1 = Main_im_image1;
im_image2 = Main_im_image2;
im_image3 = Main_im_image3;
im_image4 = Main_im_image4;
im_image5 = Main_im_image5;
ef_0 = Main_ef_0;
ef_1 = Main_ef_1;
ef_2 = Main_ef_2;
ef_3 = Main_ef_3;
ef_4 = Main_ef_4;
ef_5 = Main_ef_5;
ef_6 = Main_ef_6;
ef_7 = Main_ef_7;
ef_8 = Main_ef_8;
ef_9 = Main_ef_9;
ef_10 = Main_ef_10;
ef_11 = Main_ef_11;
ef_12 = Main_ef_12;
ef_13 = Main_ef_13;
ef_14 = Main_ef_14;
super();
if (stage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, gameinit);
};
}
private function gameinit(e:Event=null):void{
var tempbmp:Bitmap;
var rc_menu:ContextMenu;
var credit:ContextMenuItem;
removeEventListener(Event.ADDED_TO_STAGE, gameinit);
if (sitelock()){
rc_menu = new ContextMenu();
credit = new ContextMenuItem("Visit distractionware.com");
credit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_distractionware);
rc_menu.hideBuiltInItems();
rc_menu.customItems.push(credit);
this.contextMenu = rc_menu;
gamestate = CLICKTOSTART;
obj.init();
help.init();
key = new KeyPoll(stage);
SoundMixer.soundTransform = new SoundTransform(1);
music.currentsong = -1;
music.musicfade = 0;
music.initefchannels();
music.currentefchan = 0;
music.numplays = 0;
music.musicchan.push(new music_title());
music.musicchan.push(new music_fps());
music.musicchan.push(new music_boss());
music.musicchan.push(new music_rpg());
music.musicchan.push(new music_ending());
music.efchan.push(new ef_0());
music.efchan.push(new ef_1());
music.efchan.push(new ef_2());
music.efchan.push(new ef_3());
music.efchan.push(new ef_4());
music.efchan.push(new ef_5());
music.efchan.push(new ef_6());
music.efchan.push(new ef_7());
music.efchan.push(new ef_8());
music.efchan.push(new ef_9());
music.efchan.push(new ef_10());
music.efchan.push(new ef_11());
music.efchan.push(new ef_12());
music.efchan.push(new ef_13());
music.efchan.push(new ef_14());
game = new gameclass(obj, help, music);
map.rpginit();
game.start(dwgfx, map, obj, music);
dwgfx.init();
tempbmp = new im_tiles();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.maketilearray();
dwgfx.makerpgtilearray();
tempbmp = new im_sprites();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.makespritearray();
tempbmp = new im_bfont();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.makebfont();
tempbmp = new im_bfontmask();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.makebfontmask();
tempbmp = new im_image0();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_image1();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_image2();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_image3();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_image4();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
tempbmp = new im_image5();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.addimage();
dwgfx.inittextures();
dwgfx.buffer = new BitmapData(320, 240, false, 0);
addChild(dwgfx);
addEventListener(Event.ENTER_FRAME, mainloop);
} else {
dwgfx.init();
addChild(dwgfx);
tempbmp = new im_bfont();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.makebfont();
tempbmp = new im_bfontmask();
dwgfx.buffer = tempbmp.bitmapData;
dwgfx.makebfontmask();
dwgfx.buffer = new BitmapData(320, 240, false, 0);
addEventListener(Event.ENTER_FRAME, lockedloop);
};
}
public function titlelogic(key:KeyPoll, dwgfx:dwgraphicsclass, map:mapclass, game:gameclass, obj:entityclass, help:helpclass, music:musicclass):void{
help.updateglow();
game.updatetransition();
if (game.transitionmode == 11){
game.transitiondelay = (game.transitiondelay - 2);
if (game.transitiondelay <= 0){
game.transitiondelay = 60;
gamestate = GAMEMODE;
game.start(dwgfx, map, obj, music);
music.play(1, 0);
game.transitionmode = 12;
};
};
}
public function gamerender(key:KeyPoll, dwgfx:dwgraphicsclass, map:mapclass, game:gameclass, obj:entityclass, help:helpclass):void{
dwgfx.backbuffer.lock();
dwgfx.raycast(game, obj, map);
i = 0;
while (i < obj.nblocks) {
if ((((obj.blocks[i].type == 0)) && (obj.blocks[i].active))){
dwgfx.backbuffer.fillRect(obj.blocks[i].rect, 0xDDDDDD);
};
i++;
};
dwgfx.drawtile(5, 100, 22);
if (game.health >= 0){
dwgfx.print(18, 100, String(game.health), 0xFF, 16, 16);
} else {
dwgfx.print(18, 100, "0", 0xFF, 16, 16);
};
if (game.gunchangestate == 0){
switch (game.shootweapon){
case 0:
dwgfx.drawtile(5, 110, 23);
dwgfx.print(18, 110, String(game.ammopistol), 64, 64, 0xFF);
break;
case 1:
dwgfx.drawtile(5, 110, 24);
dwgfx.print(18, 110, String(game.ammomachinegun), 0xFF, 0xFF, 16);
break;
case 2:
dwgfx.drawtile(5, 110, 25);
dwgfx.print(18, 110, String(game.ammorpg), 0xFF, 0xFF, 16);
break;
};
};
if (game.shootweapon > -1){
dwgfx.drawimage((game.shootmode + (game.shootweapon * 2)), 0, (game.gunchangedelay * 2));
};
dwgfx.drawgui(help);
if (game.messagedelay > 0){
game.messagedelay--;
dwgfx.backbuffer.fillRect(new Rectangle(0, 55, 160, 9), 0);
if (((game.messagedelay / 2) % 2) == 0){
dwgfx.print(-1, 55, game.currentmessage, 0xFF, 0xFF, 0xFF, true);
} else {
dwgfx.print(-1, 55, game.currentmessage, 164, 164, 164, true);
};
};
dwgfx.drawtransition(game);
if (game.test){
dwgfx.bprint(5, 5, game.teststring, 196, 196, 196, false);
};
if (game.flashlight > 0){
game.flashlight--;
dwgfx.flashlight();
};
if (game.screenshake > 8){
game.screenshake--;
dwgfx.heavyshake();
} else {
if (game.screenshake > 0){
game.screenshake--;
dwgfx.screenshake();
} else {
dwgfx.render();
};
};
dwgfx.backbuffer.unlock();
}
public function gameinput(key:KeyPoll, dwgfx:dwgraphicsclass, map:mapclass, game:gameclass, obj:entityclass, help:helpclass, music:musicclass):void{
game.mx = (mouseX / 2);
game.my = (mouseY / 2);
if (((key.isDown(Keyboard.UP)) || (key.isDown(87)))){
if (map.at(int((game.posX + (game.dirX * 0.2))), int(game.posY)) == 0){
game.posX = (game.posX + (game.dirX * 0.2));
};
if (map.at(int(game.posX), int((game.posY + (game.dirY * 0.2)))) == 0){
game.posY = (game.posY + (game.dirY * 0.2));
};
game.bobbingstate++;
if (game.bobbingstate >= 2){
game.bobbingstate = 0;
game.bobbing++;
if (game.bobbing > 3){
game.bobbing = 0;
};
};
} else {
if (((key.isDown(Keyboard.DOWN)) || (key.isDown(83)))){
if (map.at(int((game.posX - (game.dirX * 0.2))), int(game.posY)) == 0){
game.posX = (game.posX - (game.dirX * 0.2));
};
if (map.at(int(game.posX), int((game.posY - (game.dirY * 0.2)))) == 0){
game.posY = (game.posY - (game.dirY * 0.2));
};
game.bobbingstate++;
if (game.bobbingstate >= 2){
game.bobbingstate = 0;
game.bobbing++;
if (game.bobbing > 3){
game.bobbing = 0;
};
};
} else {
game.bobbing = 0;
game.bobbingstate = 0;
};
};
if (((key.isDown(Keyboard.RIGHT)) || (key.isDown(68)))){
game.oldDirX = game.dirX;
game.dirX = ((game.dirX * Math.cos(-0.15)) - (game.dirY * Math.sin(-0.15)));
game.dirY = ((game.oldDirX * Math.sin(-0.15)) + (game.dirY * Math.cos(-0.15)));
game.oldPlaneX = game.planeX;
game.planeX = ((game.planeX * Math.cos(-0.15)) - (game.planeY * Math.sin(-0.15)));
game.planeY = ((game.oldPlaneX * Math.sin(-0.15)) + (game.planeY * Math.cos(-0.15)));
};
if (((key.isDown(Keyboard.LEFT)) || (key.isDown(65)))){
game.oldDirX = game.dirX;
game.dirX = ((game.dirX * Math.cos(0.15)) - (game.dirY * Math.sin(0.15)));
game.dirY = ((game.oldDirX * Math.sin(0.15)) + (game.dirY * Math.cos(0.15)));
game.oldPlaneX = game.planeX;
game.planeX = ((game.planeX * Math.cos(0.15)) - (game.planeY * Math.sin(0.15)));
game.planeY = ((game.oldPlaneX * Math.sin(0.15)) + (game.planeY * Math.cos(0.15)));
};
game.shootframedelay--;
if (game.shootframedelay <= 0){
game.shootmode = 0;
};
game.shootdelay--;
if (game.gameover == 0){
if (((key.isDown(90)) || (key.isDown(32)))){
if (game.gunchangestate == 0){
if (game.shootweapon == 0){
if (game.shootdelay <= 0){
music.playef(8, 10);
game.shootdelay = 10;
game.shootframedelay = 5;
game.screenshake = 5;
game.shootmode = 1;
game.findtarget = true;
game.ammopistol--;
if (game.ammopistol < 1){
game.gunchangestate = 1;
game.newgun = -1;
};
};
} else {
if (game.shootweapon == 1){
if (game.shootdelay <= 0){
music.playef(7, 10);
game.shootdelay = 5;
game.shootframedelay = 2;
game.screenshake = 4;
game.shootmode = 1;
game.findtarget = true;
game.ammomachinegun--;
if (game.ammomachinegun < 1){
game.gunchangestate = 1;
game.newgun = -1;
if (game.ammopistol > 0){
game.newgun = 0;
};
};
};
} else {
if (game.shootweapon == 2){
if (game.shootdelay <= 0){
music.playef(9, 10);
game.shootdelay = 10;
game.transitionmode = 1;
game.screenshake = 20;
music.playef(13, 10);
i = (obj.nentity - 1);
while (i >= 0) {
if (obj.entities[i].state == 0){
if (obj.entities[i].type == 0){
if (obj.entities[i].hp > 0){
obj.entities[i].hp = 0;
obj.entities[i].state = 2;
obj.entities[i].deathframe = 10;
};
};
};
i--;
};
game.ammorpg--;
if (game.ammorpg < 1){
game.gunchangestate = 1;
game.newgun = -1;
if (game.ammopistol > 0){
game.newgun = 0;
};
if (game.ammomachinegun > 0){
game.newgun = 1;
};
};
};
};
};
};
};
};
};
}
public function visit_sponsor_logo():void{
var sponsor_link:URLRequest = new URLRequest("http://www.kongregate.com/?gamereferral=dontlookback");
navigateToURL(sponsor_link, "_blank");
}
public function visit_sponsor(e:Event):void{
var sponsor_link:URLRequest = new URLRequest("http://www.kongregate.com/?gamereferral=dontlookback");
navigateToURL(sponsor_link, "_blank");
}
public function visit_distractionware(e:Event):void{
var distractionware_link:URLRequest = new URLRequest("http://www.distractionware.com");
navigateToURL(distractionware_link, "_blank");
}
public function rpggameinput(key:KeyPoll, dwgfx:dwgraphicsclass, map:mapclass, game:gameclass, obj:entityclass, help:helpclass, music:musicclass):void{
game.mx = (mouseX / 4);
game.my = (mouseY / 4);
if (((((((!(game.pmoving)) && ((game.mapscrollx == 0)))) && ((game.mapscrolly == 0)))) && (!(game.readingtextbox)))){
if (((key.isDown(Keyboard.UP)) || (key.isDown(87)))){
game.dir = 1;
if (map.rpgcollide(map.rpgat(game.playerx, (game.playery - 1)))){
game.pyoff = 4;
game.playery--;
game.pmoving = true;
game.encounterrate--;
};
} else {
if (((key.isDown(Keyboard.DOWN)) || (key.isDown(83)))){
game.dir = 0;
if (map.rpgcollide(map.rpgat(game.playerx, (game.playery + 1)))){
game.pyoff = -4;
game.playery++;
game.pmoving = true;
game.encounterrate--;
};
} else {
if (((key.isDown(Keyboard.LEFT)) || (key.isDown(65)))){
game.dir = 3;
if (map.rpgcollide(map.rpgat((game.playerx - 1), game.playery))){
game.pxoff = 4;
game.playerx--;
game.pmoving = true;
game.encounterrate--;
};
} else {
if (((key.isDown(Keyboard.RIGHT)) || (key.isDown(68)))){
game.dir = 2;
if (map.rpgcollide(map.rpgat((game.playerx + 1), game.playery))){
game.pxoff = -4;
game.playerx++;
game.pmoving = true;
game.encounterrate--;
};
};
};
};
};
if (((key.isUp(90)) && (key.isUp(32)))){
game.talkkeyheld = false;
};
if (((((key.isDown(90)) || (key.isDown(32)))) && ((game.talkkeyheld == false)))){
if (map.talking(game.playerx, game.playery, game.dir) > -1){
music.playef(10, 10);
game.curtextbox = map.talking(game.playerx, game.playery, game.dir);
game.readingtextbox = true;
game.talkkeyheld = true;
dwgfx.tbpos = 50;
};
};
};
if (((game.readingtextbox) && ((dwgfx.tbpos >= 0)))){
if (((key.isUp(90)) && (key.isUp(32)))){
game.talkkeyheld = false;
};
if (((((key.isDown(90)) || (key.isDown(32)))) && ((game.talkkeyheld == false)))){
dwgfx.tbpos = -1;
game.talkkeyheld = true;
};
};
if (dwgfx.tbpos <= -50){
if (game.nextup > 0){
music.playef(10, 10);
game.curtextbox = game.nextup;
game.readingtextbox = true;
game.talkkeyheld = true;
dwgfx.tbpos = 50;
} else {
game.readingtextbox = false;
};
};
switch (game.curtextbox){
case 0:
game.nextup = 10;
break;
case 1:
game.nextup = 20;
break;
case 20:
game.nextup = 21;
break;
case 2:
game.nextup = 30;
break;
case 3:
game.nextup = 40;
break;
default:
game.nextup = 0;
break;
};
}
public function titleinput(key:KeyPoll, dwgfx:dwgraphicsclass, map:mapclass, game:gameclass, obj:entityclass, help:helpclass, music:musicclass):void{
game.mx = (mouseX / 4);
game.my = (mouseY / 4);
if (!((key.isDown(90)) || (key.isDown(32)))){
game.jumpheld = false;
};
if (((((key.isDown(90)) || (key.isDown(32)))) && (!(game.jumpheld)))){
if (game.showtitlemenu == 0){
game.showtitlemenu = 1;
game.jumpheld = true;
music.playef(5, 10);
} else {
if (game.transitionmode == 0){
game.transitionmode = 10;
game.jumpheld = true;
music.playef(6, 10);
};
};
};
}
public function inbox(xc:int, yc:int, x1:int, y1:int, x2:int, y2:int):Boolean{
if ((((xc >= x1)) && ((xc <= x2)))){
if ((((yc >= y1)) && ((yc <= y2)))){
return (true);
};
};
return (false);
}
public function gamelogic(key:KeyPoll, dwgfx:dwgraphicsclass, map:mapclass, game:gameclass, obj:entityclass, help:helpclass, music:musicclass):void{
help.updateglow();
game.updatetransition();
if (game.transitionmode == 2){
game.transitiondelay = (game.transitiondelay - 2);
if (game.transitiondelay <= 0){
game.transitiondelay = 60;
gamestate = RPGGAMEMODE;
music.play(3);
game.transitionmode = 3;
game.encounterrate = 25;
};
} else {
if (game.transitionmode == 8){
game.transitiondelay = (game.transitiondelay - 2);
if (game.transitiondelay <= 0){
game.transitiondelay = 60;
gamestate = TITLEMODE;
music.play(4);
game.transitionmode = 9;
};
};
};
if ((((game.health < 0)) && ((game.gameover == 0)))){
music.playef(14, 10);
game.gameover = 1;
game.transitionmode = 7;
};
game.updatestate(obj, map, help, music);
game.checktrigger(int(game.posX), int(game.posY));
if (game.gunchangestate == 1){
game.gunchangedelay = (game.gunchangedelay + 4);
if (game.gunchangedelay >= 32){
game.gunchangestate = 2;
game.shootweapon = game.newgun;
};
} else {
if (game.gunchangestate == 2){
game.gunchangedelay = (game.gunchangedelay - 4);
if (game.gunchangedelay <= 0){
game.gunchangestate = 0;
game.gunchangedelay = 0;
};
};
};
if (((game.findtarget) && ((game.gunchangestate == 0)))){
game.findtarget = false;
game.insights = -1;
i = (obj.nentity - 1);
while (i >= 0) {
if (game.insights == -1){
if (obj.spriteDistance[i] < 30){
temp = obj.spriteOrder[i];
if (obj.entities[temp].state == 0){
if (obj.entities[temp].hp > 0){
temp2 = Math.atan2((game.posY - obj.entities[temp].yp), (game.posX - obj.entities[temp].xp));
temp2 = (temp2 - Math.atan2(game.dirY, game.dirX));
temp2 = (temp2 + Math.PI);
if (temp2 < 0){
temp2 = (temp2 + (Math.PI * 2));
};
if (temp2 > (Math.PI * 2)){
temp2 = (temp2 - (Math.PI * 2));
};
if ((((temp2 > 5.6)) || ((temp2 < 0.7)))){
game.insights = temp;
};
};
};
};
};
i--;
};
if (game.insights > -1){
if (game.shootweapon == 0){
obj.entities[game.insights].state = 1;
obj.entities[game.insights].hurtframe = 5;
obj.entities[game.insights].hp = (obj.entities[game.insights].hp - 4);
} else {
if (game.shootweapon == 1){
obj.entities[game.insights].state = 1;
obj.entities[game.insights].hurtframe = 5;
obj.entities[game.insights].hp = (obj.entities[game.insights].hp - 5);
};
};
};
};
temp = 0;
i = (obj.nentity - 1);
while (i >= 0) {
if (obj.spriteDistance[i] < 3){
if (obj.entities[obj.spriteOrder[i]].active){
if (obj.entities[obj.spriteOrder[i]].type == 0){
temp = 1;
};
};
};
i--;
};
if (temp == 1){
if (game.damagetaker == 0){
game.damagetaker = 15;
game.flashlight = 5;
game.screenshake = 10;
game.health = (game.health - (10 + (Math.random() * 8)));
music.playef(11, 10);
} else {
game.damagetaker--;
};
};
i = 0;
while (i < obj.nentity) {
obj.updateentities(i, help, game, map, music);
obj.animateentities(i, help);
i++;
};
i = (obj.nentity - 1);
while ((((i >= 0)) && (!(obj.entities[i].active)))) {
obj.nentity--;
i--;
};
}
public function lockedloop(e:Event):void{
dwgfx.backbuffer.lock();
dwgfx.bprint(5, 110, "Sorry! This game can only by played on", (196 - help.glow), (196 - help.glow), (0xFF - help.glow), true);
dwgfx.bprint(5, 120, "www.distractionware.com", (196 - help.glow), (196 - help.glow), (0xFF - help.glow), true);
dwgfx.render();
dwgfx.backbuffer.unlock();
help.updateglow();
}
public function rpggamerender(key:KeyPoll, dwgfx:dwgraphicsclass, map:mapclass, game:gameclass, obj:entityclass, help:helpclass):void{
dwgfx.backbuffer.lock();
dwgfx.drawbackground(game, map);
dwgfx.drawplayer(game);
if (game.readingtextbox){
dwgfx.drawtextbox(game.curtextbox);
};
dwgfx.drawtransition(game);
if (game.flashlight > 0){
game.flashlight--;
dwgfx.flashlight();
};
if (game.screenshake > 8){
game.screenshake--;
dwgfx.heavyshake();
} else {
if (game.screenshake > 0){
game.screenshake--;
dwgfx.screenshake();
} else {
dwgfx.render();
};
};
dwgfx.backbuffer.unlock();
}
public function inboxw(xc:int, yc:int, x1:int, y1:int, x2:int, y2:int):Boolean{
if ((((xc >= x1)) && ((xc <= (x1 + x2))))){
if ((((yc >= y1)) && ((yc <= (y1 + y2))))){
return (true);
};
};
return (false);
}
public function mainloop(e:Event):void{
if (!game.infocus){
if (game.globalsound > 0){
game.globalsound = 0;
SoundMixer.soundTransform = new SoundTransform(0);
};
music.processmusic();
dwgfx.backbuffer.lock();
dwgfx.bprint(5, 50, "Game paused", 164, 164, 164, true);
dwgfx.bprint(5, 60, "[click to resume]", 164, 164, 164, true);
dwgfx.bprint(5, 110, "Press M to mute in game", 164, 164, 164, true);
dwgfx.render();
dwgfx.backbuffer.unlock();
help.updateglow();
} else {
switch (gamestate){
case TITLEMODE:
titlerender(key, dwgfx, map, game, obj, help);
titleinput(key, dwgfx, map, game, obj, help, music);
titlelogic(key, dwgfx, map, game, obj, help, music);
break;
case RPGGAMEMODE:
rpggamerender(key, dwgfx, map, game, obj, help);
rpggameinput(key, dwgfx, map, game, obj, help, music);
rpggamelogic(key, dwgfx, map, game, obj, help, music);
break;
case GAMEMODE:
gamerender(key, dwgfx, map, game, obj, help);
gameinput(key, dwgfx, map, game, obj, help, music);
gamelogic(key, dwgfx, map, game, obj, help, music);
break;
case CLICKTOSTART:
dwgfx.backbuffer.lock();
dwgfx.bprint(5, 55, "[Click to start]", 164, 164, 164, true);
dwgfx.render();
dwgfx.backbuffer.unlock();
help.updateglow();
if (key.click){
music.play(0);
gamestate = TITLEMODE;
};
break;
};
music.processmusic();
if (((key.isDown(77)) && ((game.mutebutton <= 0)))){
game.mutebutton = 8;
if (game.muted){
game.muted = false;
} else {
game.muted = true;
};
};
if (game.mutebutton > 0){
game.mutebutton--;
};
if (game.muted){
if (game.globalsound == 1){
game.globalsound = 0;
SoundMixer.soundTransform = new SoundTransform(0);
};
};
if (((!(game.muted)) && ((game.globalsound == 0)))){
game.globalsound = 1;
SoundMixer.soundTransform = new SoundTransform(1);
};
};
if (key.hasclicked){
key.click = false;
};
}
public function rpggamelogic(key:KeyPoll, dwgfx:dwgraphicsclass, map:mapclass, game:gameclass, obj:entityclass, help:helpclass, music:musicclass):void{
help.updateglow();
game.updatetransition();
if (game.transitionmode == 5){
game.transitiondelay = (game.transitiondelay - 2);
if (game.transitiondelay <= 0){
game.transitiondelay = 60;
gamestate = GAMEMODE;
if (game.finalbit > 0){
music.play(2);
} else {
music.play(1);
};
game.transitionmode = 6;
};
};
if (game.encounterrate <= 0){
music.playef(0, 10);
game.encounterrate = 100;
game.transitionmode = 4;
game.screenshake = 30;
};
if (game.pmoving){
game.playerwdelay--;
if (game.playerwdelay <= 0){
game.playerwdelay = 2;
if (game.dir == 0){
game.pyoff++;
game.playerwframe = (Math.abs(game.pyoff) / 2);
if (game.pyoff >= 0){
game.pmoving = false;
game.playerwframe = 0;
};
} else {
if (game.dir == 1){
game.pyoff--;
game.playerwframe = (Math.abs(game.pyoff) / 2);
if (game.pyoff <= 0){
game.pmoving = false;
game.playerwframe = 0;
};
} else {
if (game.dir == 2){
game.pxoff++;
game.playerwframe = (Math.abs(game.pxoff) / 2);
if (game.pxoff >= 0){
game.pmoving = false;
game.playerwframe = 0;
};
} else {
if (game.dir == 3){
game.pxoff--;
game.playerwframe = (Math.abs(game.pxoff) / 2);
if (game.pxoff <= 0){
game.pmoving = false;
game.playerwframe = 0;
};
};
};
};
};
};
if (!game.pmoving){
if (game.playerx < 0){
if (game.door_left >= 0){
game.gotoroom(game.door_left, obj, music, map);
game.mapscrollx = -20;
game.playerx = (game.playerx + 10);
};
} else {
if (game.playerx >= 10){
if (game.door_right >= 0){
game.gotoroom(game.door_right, obj, music, map);
game.mapscrollx = 20;
game.playerx = (game.playerx - 10);
};
} else {
if (game.playery < 0){
if (game.door_up >= 0){
game.gotoroom(game.door_up, obj, music, map);
game.mapscrolly = -20;
game.playery = (game.playery + 8);
};
} else {
if (game.playery >= 8){
if (game.door_down >= 0){
game.gotoroom(game.door_down, obj, music, map);
game.mapscrolly = 20;
game.playery = (game.playery - 8);
};
};
};
};
};
};
};
}
public function sitelock():Boolean{
var currUrl:String = stage.loaderInfo.url.toLowerCase();
if ((((((currUrl.indexOf("distractionware.com") <= 0)) && ((currUrl.indexOf("ungrounded.net") <= 0)))) && ((currUrl.indexOf("increpare.com") <= 0)))){
return (true);
};
return (true);
}
public function titlerender(key:KeyPoll, dwgfx:dwgraphicsclass, map:mapclass, game:gameclass, obj:entityclass, help:helpclass):void{
dwgfx.backbuffer.lock();
if (game.gameover == 1){
if (game.finalbit == 0){
dwgfx.print(-1, 50, "My prick is still hot", 164, 164, 164, true);
dwgfx.print(-1, 60, "and stiff and quivering.", 164, 164, 164, true);
} else {
dwgfx.print(-1, 20, "I have come now and", 164, 164, 164, true);
dwgfx.print(-1, 30, "the foolery is over.", 164, 164, 164, true);
tempstring = (String(game.score) + " hail marys");
dwgfx.print(-1, 50, tempstring, 0xFF, (164 - help.glow), (164 - (help.glow * 2)), true);
dwgfx.print(-1, 70, "To bed - to bed!", 164, 164, 164, true);
dwgfx.print(-1, 80, "Goodnight, Nora mia!", 164, 164, 164, true);
};
if (game.showtitlemenu){
dwgfx.backbuffer.fillRect(new Rectangle(30, 105, 100, 9), 0xFFFFFF);
dwgfx.print(-1, 105, "-= NEW GAME =-", 0, help.glow, (help.glow * 2), true);
};
} else {
dwgfx.drawimage(5, 0, 0);
if (game.showtitlemenu){
dwgfx.backbuffer.fillRect(new Rectangle(30, 60, 100, 9), 0);
dwgfx.print(-1, 60, "-= NEW GAME =-", 0xFF, (0xFF - help.glow), (0xFF - (help.glow * 2)), true);
};
};
dwgfx.drawgui(help);
if (game.test){
dwgfx.print(5, 5, game.teststring, 196, 196, 196, false);
};
dwgfx.drawtransition(game);
dwgfx.render();
dwgfx.backbuffer.unlock();
}
}
}//package
Section 17
//Main_ef_0 (Main_ef_0)
package {
import mx.core.*;
public class Main_ef_0 extends SoundAsset {
}
}//package
Section 18
//Main_ef_1 (Main_ef_1)
package {
import mx.core.*;
public class Main_ef_1 extends SoundAsset {
}
}//package
Section 19
//Main_ef_10 (Main_ef_10)
package {
import mx.core.*;
public class Main_ef_10 extends SoundAsset {
}
}//package
Section 20
//Main_ef_11 (Main_ef_11)
package {
import mx.core.*;
public class Main_ef_11 extends SoundAsset {
}
}//package
Section 21
//Main_ef_12 (Main_ef_12)
package {
import mx.core.*;
public class Main_ef_12 extends SoundAsset {
}
}//package
Section 22
//Main_ef_13 (Main_ef_13)
package {
import mx.core.*;
public class Main_ef_13 extends SoundAsset {
}
}//package
Section 23
//Main_ef_14 (Main_ef_14)
package {
import mx.core.*;
public class Main_ef_14 extends SoundAsset {
}
}//package
Section 24
//Main_ef_2 (Main_ef_2)
package {
import mx.core.*;
public class Main_ef_2 extends SoundAsset {
}
}//package
Section 25
//Main_ef_3 (Main_ef_3)
package {
import mx.core.*;
public class Main_ef_3 extends SoundAsset {
}
}//package
Section 26
//Main_ef_4 (Main_ef_4)
package {
import mx.core.*;
public class Main_ef_4 extends SoundAsset {
}
}//package
Section 27
//Main_ef_5 (Main_ef_5)
package {
import mx.core.*;
public class Main_ef_5 extends SoundAsset {
}
}//package
Section 28
//Main_ef_6 (Main_ef_6)
package {
import mx.core.*;
public class Main_ef_6 extends SoundAsset {
}
}//package
Section 29
//Main_ef_7 (Main_ef_7)
package {
import mx.core.*;
public class Main_ef_7 extends SoundAsset {
}
}//package
Section 30
//Main_ef_8 (Main_ef_8)
package {
import mx.core.*;
public class Main_ef_8 extends SoundAsset {
}
}//package
Section 31
//Main_ef_9 (Main_ef_9)
package {
import mx.core.*;
public class Main_ef_9 extends SoundAsset {
}
}//package
Section 32
//Main_im_bfont (Main_im_bfont)
package {
import mx.core.*;
public class Main_im_bfont extends BitmapAsset {
}
}//package
Section 33
//Main_im_bfontmask (Main_im_bfontmask)
package {
import mx.core.*;
public class Main_im_bfontmask extends BitmapAsset {
}
}//package
Section 34
//Main_im_image0 (Main_im_image0)
package {
import mx.core.*;
public class Main_im_image0 extends BitmapAsset {
}
}//package
Section 35
//Main_im_image1 (Main_im_image1)
package {
import mx.core.*;
public class Main_im_image1 extends BitmapAsset {
}
}//package
Section 36
//Main_im_image2 (Main_im_image2)
package {
import mx.core.*;
public class Main_im_image2 extends BitmapAsset {
}
}//package
Section 37
//Main_im_image3 (Main_im_image3)
package {
import mx.core.*;
public class Main_im_image3 extends BitmapAsset {
}
}//package
Section 38
//Main_im_image4 (Main_im_image4)
package {
import mx.core.*;
public class Main_im_image4 extends BitmapAsset {
}
}//package
Section 39
//Main_im_image5 (Main_im_image5)
package {
import mx.core.*;
public class Main_im_image5 extends BitmapAsset {
}
}//package
Section 40
//Main_im_sprites (Main_im_sprites)
package {
import mx.core.*;
public class Main_im_sprites extends BitmapAsset {
}
}//package
Section 41
//Main_im_tiles (Main_im_tiles)
package {
import mx.core.*;
public class Main_im_tiles extends BitmapAsset {
}
}//package
Section 42
//mapclass (mapclass)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
public class mapclass extends Sprite {
public var mapheight:int;
public var rpgoldmap:Array;
public var rpgcontents:Array;
public var floor:Array;
public var contents:Array;
public var ddelay:int;
public var vmult:Array;
public var dcounter:int;
public var background:int;
public var ceiling:Array;
public var temp:int;
public var rpgvmult:Array;
public var temp2:int;
public var tmap:Array;
public var j:int;
public var i:int;
public var mapwidth:int;
public function mapclass():void{
contents = new Array();
floor = new Array();
ceiling = new Array();
vmult = new Array();
tmap = new Array();
rpgcontents = new Array();
rpgoldmap = new Array();
rpgvmult = new Array();
super();
mapwidth = 50;
mapheight = 50;
i = 0;
while (i < 50) {
vmult.push(int((i * 50)));
i++;
};
j = 0;
while (j < 50) {
i = 0;
while (i < 50) {
contents.push(0);
floor.push(0);
ceiling.push(0);
i++;
};
j++;
};
}
public function rpgfillcontent(tmap:Array):void{
var maprow:Array;
var i:int;
var j:int;
while (j < 8) {
maprow = new Array();
maprow = tmap[j].split(",");
i = 0;
while (i < 10) {
rpgoldmap[(i + (j * 10))] = rpgcontents[(i + (j * 10))];
rpgcontents[(i + (j * 10))] = tiletransform(maprow[i]);
i++;
};
j++;
};
}
public function rpgloadlevel(t:int):void{
switch (t){
case 0:
tmap = new Array();
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 7, 7, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 7, 7, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 7, 7, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 7, 7, 9, 9, 9, 9");
tmap.push(" 9, 9, 8, 8, 7, 7, 8, 9, 9, 9");
tmap.push(" 9, 9, 8, 8, 7, 7, 8, 8, 9, 9");
rpgfillcontent(tmap);
break;
case 1:
tmap = new Array();
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
rpgfillcontent(tmap);
break;
case 2:
tmap = new Array();
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
rpgfillcontent(tmap);
break;
case 3:
tmap = new Array();
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 5, 8, 61, 8, 8, 8, 8, 8, 8, 8");
tmap.push(" 8, 6, 7, 7, 7, 7, 7, 7, 7, 7");
tmap.push(" 8, 5, 8, 8, 8, 8, 8, 7, 8, 8");
tmap.push(" 8, 6, 5, 8, 8, 8, 8, 7, 8, 8");
tmap.push(" 6, 8, 8, 5, 8, 8, 8, 7, 8, 8");
tmap.push(" 8, 6, 8, 8, 8, 8, 8, 7, 8, 8");
tmap.push(" 5, 8, 8, 8, 8, 8, 8, 7, 8, 8");
rpgfillcontent(tmap);
break;
case 4:
tmap = new Array();
tmap.push(" 9, 9, 8, 8, 7, 7, 8, 8, 9, 9");
tmap.push(" 8, 8, 8, 8, 7, 7, 8, 8, 8, 8");
tmap.push(" 7, 7, 7, 7, 7, 7, 7, 7, 7, 7");
tmap.push(" 8, 8, 60, 7, 1, 2, 7, 8, 8, 8");
tmap.push(" 8, 6, 8, 7, 3, 3, 7, 8, 5, 8");
tmap.push(" 8, 8, 8, 7, 4, 1, 7, 8, 8, 8");
tmap.push(" 8, 5, 8, 7, 1, 2, 7, 8, 6, 8");
tmap.push(" 8, 8, 8, 7, 1, 3, 7, 8, 8, 8");
rpgfillcontent(tmap);
break;
case 5:
tmap = new Array();
tmap.push(" 9, 9, 9, 9, 9, 9, 9, 9, 9, 9");
tmap.push(" 8, 8, 8, 8, 8, 8, 8, 8, 8, 9");
tmap.push(" 7, 7, 7, 7, 7, 7, 7, 7, 8, 9");
tmap.push(" 8, 8, 8, 8, 8, 8, 8, 7, 8, 9");
tmap.push(" 8, 8, 8, 8, 8, 8, 8, 7, 8, 9");
tmap.push(" 8, 8, 8, 8, 8, 8, 8, 7, 8, 9");
tmap.push(" 8, 8, 8, 8, 8, 8, 8, 7, 8, 9");
tmap.push(" 8, 8, 8, 8, 8, 8, 8, 7, 8, 9");
rpgfillcontent(tmap);
break;
case 6:
tmap = new Array();
tmap.push(" 7, 7, 8, 8, 8, 8, 8, 7, 8, 9");
tmap.push(" 8, 7, 7, 7, 7, 7, 7, 7, 8, 9");
tmap.push(" 8, 7, 1, 7, 4, 7, 62, 8, 9, 9");
tmap.push(" 8, 7, 2, 7, 1, 7, 8, 9, 9, 9");
tmap.push(" 8, 7, 7, 7, 7, 7, 8, 9, 9, 9");
tmap.push(" 8, 7, 3, 7, 3, 7, 8, 9, 9, 9");
tmap.push(" 7, 7, 1, 7, 2, 7, 8, 9, 9, 9");
tmap.push(" 2, 1, 4, 3, 2, 1, 2, 9, 9, 9");
rpgfillcontent(tmap);
break;
case 7:
tmap = new Array();
tmap.push(" 7, 7, 7, 7, 7, 7, 7, 7, 7, 7");
tmap.push(" 7, 1, 7, 3, 7, 4, 7, 1, 7, 8");
tmap.push(" 7, 3, 7, 1, 7, 2, 7, 4, 7, 8");
tmap.push(" 7, 2, 7, 3, 7, 1, 7, 7, 7, 8");
tmap.push(" 7, 7, 7, 7, 7, 3, 7, 3, 7, 8");
tmap.push(" 7, 1, 7, 3, 7, 3, 7, 1, 7, 8");
tmap.push(" 7, 2, 7, 4, 7, 2, 7, 4, 7, 7");
tmap.push(" 1, 2, 3, 4, 1, 2, 3, 4, 1, 2");
rpgfillcontent(tmap);
break;
case 8:
tmap = new Array();
tmap.push(" 5, 8, 8, 8, 8, 8, 8, 8, 8, 8");
tmap.push(" 6, 8, 8, 8, 4, 8, 1, 8, 3, 8");
tmap.push(" 5, 6, 63, 7, 7, 7, 7, 7, 7, 7");
tmap.push(" 6, 8, 5, 8, 8, 8, 8, 8, 8, 8");
tmap.push(" 5, 6, 8, 8, 1, 8, 2, 8, 3, 8");
tmap.push(" 6, 8, 8, 7, 7, 7, 7, 7, 7, 7");
tmap.push(" 5, 5, 8, 8, 8, 8, 8, 8, 8, 8");
tmap.push(" 6, 8, 5, 5, 5, 6, 5, 6, 6, 5");
rpgfillcontent(tmap);
break;
};
}
public function fillcontent(tmap:Array):void{
var maprow:Array;
j = 0;
while (j < mapheight) {
maprow = new Array();
maprow = tmap[j].split(",");
i = 0;
while (i < mapwidth) {
contents[(i + (j * mapwidth))] = maprow[i];
i++;
};
j++;
};
}
public function loadceiling(r:int, obj:entityclass):void{
switch (r){
case 0:
tmap = new Array();
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
tmap.push("11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11");
fillceiling(tmap);
break;
};
}
public function ceilingat(xp:int, yp:int):int{
if ((((((((xp >= 0)) && ((yp >= 0)))) && ((xp < mapwidth)))) && ((yp < mapheight)))){
return (ceiling[(xp + (yp * mapwidth))]);
};
return (0);
}
public function rpgcollide(t:int):Boolean{
switch (t){
case 104:
case 105:
case 106:
case 107:
case 108:
case 109:
case 112:
return (false);
};
if ((((t >= 60)) && ((t <= 70)))){
return (false);
};
return (true);
}
public function talking(x:int, y:int, dir:int):int{
if (dir == 0){
y++;
};
if (dir == 1){
y--;
};
if (dir == 2){
x++;
};
if (dir == 3){
x--;
};
if ((((((((x >= 0)) && ((x < 10)))) && ((y >= 0)))) && ((y < 8)))){
if ((((rpgcontents[(x + (y * 10))] >= 60)) && ((rpgcontents[(x + (y * 10))] <= 70)))){
return ((rpgcontents[(x + (y * 10))] - 60));
};
};
return (-1);
}
public function collide(x:int, y:int):Boolean{
if (y == -1){
return (collide(x, (y + 1)));
};
if (y == 29){
return (collide(x, (y - 1)));
};
if ((((((((x < 0)) || ((y < 0)))) || ((x >= 50)))) || ((y >= 50)))){
return (false);
};
if (contents[(x + vmult[y])] == 1){
return (true);
};
if ((((contents[(x + vmult[y])] >= 80)) && ((contents[(x + vmult[y])] < 680)))){
return (true);
};
return (false);
}
public function floorat(xp:int, yp:int):int{
if ((((((((xp >= 0)) && ((yp >= 0)))) && ((xp < mapwidth)))) && ((yp < mapheight)))){
return (floor[(xp + (yp * mapwidth))]);
};
return (0);
}
public function at(xp:int, yp:int):int{
if ((((((((xp >= 0)) && ((yp >= 0)))) && ((xp < mapwidth)))) && ((yp < mapheight)))){
return (contents[(xp + (yp * mapwidth))]);
};
return (1);
}
public function fillceiling(tmap:Array):void{
var maprow:Array;
j = 0;
while (j < mapheight) {
maprow = new Array();
maprow = tmap[j].split(",");
i = 0;
while (i < mapwidth) {
ceiling[(i + (j * mapwidth))] = maprow[i];
i++;
};
j++;
};
}
public function loadlevel(r:int, obj:entityclass):void{
switch (r){
case 0:
tmap = new Array();
tmap.push("0,0,0,0,1,2,1,2,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,2,0,0,0,1,0,2,0,0,0,0,0,0,2,1,5,6,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,1,0,0,0,2,0,1,0,0,0,0,0,0,1,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("2,3,1,2,1,0,0,0,1,0,2,1,2,2,1,1,2,2,0,2,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("2,0,0,0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,0,0,0,0,2,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,2,0,0,0,0,0,1,0,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,1,1,0,0,0,0,0,1,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,0,0,0,0,0,0,0,2,1,2,1,2,3,1,1,2,2,2,1,2,2,1,2,2,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
fillcontent(tmap);
break;
};
}
public function loadfloor(r:int, obj:entityclass):void{
switch (r){
case 0:
tmap = new Array();
tmap.push("0,0,0,0,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0");
tmap.push("0,0,0,0,7,7,7,7,7,7,7,0,0,0,0,0,0,7,7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map:Array):void{
var maprow:Array;
j = 0;
while (j < mapheight) {
maprow = new Array();
maprow = tmap[j].split(",");
i = 0;
while (i < mapwidth) {
floor[(i + (j * mapwidth))] = maprow[i];
i++;
};
j++;
};
}
public function rpgat(x:int, y:int):int{
if ((((((((x >= 0)) && ((x < 10)))) && ((y >= 0)))) && ((y < 8)))){
return (rpgcontents[(x + (y * 10))]);
};
return (0);
}
public function rpginit():void{
var i:int;
while (i < 8) {
rpgvmult.push((i * 10));
i++;
};
var j:int;
while (j < 8) {
i = 0;
while (i < 10) {
rpgoldmap.push(0);
rpgcontents.push(0);
i++;
};
j++;
};
}
public function tiletransform(t:int):int{
if (t < 60){
return ((103 + t));
};
return (t);
}
}
}//package
Section 43
//music_boss (music_boss)
package {
import flash.media.*;
public dynamic class music_boss extends Sound {
}
}//package
Section 44
//music_ending (music_ending)
package {
import flash.media.*;
public dynamic class music_ending extends Sound {
}
}//package
Section 45
//music_fps (music_fps)
package {
import flash.media.*;
public dynamic class music_fps extends Sound {
}
}//package
Section 46
//music_rpg (music_rpg)
package {
import flash.media.*;
public dynamic class music_rpg extends Sound {
}
}//package
Section 47
//music_title (music_title)
package {
import flash.media.*;
public dynamic class music_title extends Sound {
}
}//package
Section 48
//musicclass (musicclass)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
public class musicclass extends Sprite {
public var musicchannel:SoundChannel;
public var musicstopother:int;
public var musicfadein:int;
public var currentsong:int;
public var efchannel:Array;
public var currentmusicchan:int;
public var musicchancur:int;
public var currentefchan:int;
public var musicfade:int;
public var efchan:Array;
public var musicchan:Array;
public var numplays:int;
public var musicchannel2:SoundChannel;
public var musicchanlen:int;
public function musicclass(){
musicchan = new Array();
efchannel = new Array();
efchan = new Array();
super();
}
public function loopmusic(e:Event):void{
musicchannel.removeEventListener(Event.SOUND_COMPLETE, loopmusic);
if (currentsong > -1){
musicchannel = musicchan[currentsong].play();
musicchannel.addEventListener(Event.SOUND_COMPLETE, loopmusic);
};
}
public function processmusicfadein():void{
musicfadein--;
if (musicfadein > 0){
musicchannel.soundTransform = new SoundTransform(((60 - musicfadein) / 60));
} else {
musicchannel.soundTransform = new SoundTransform(1);
};
}
public function initefchannels():void{
var i:int;
while (i < 16) {
efchannel.push(new SoundChannel());
i++;
};
}
public function playef(t:int, offset:int=0):void{
efchannel[currentefchan] = efchan[t].play(offset);
currentefchan++;
if (currentefchan > 15){
currentefchan = (currentefchan - 16);
};
}
public function processmusic():void{
if (musicfade > 0){
processmusicfade();
};
if (musicfadein > 0){
processmusicfadein();
};
musicstopother--;
if (musicstopother == 1){
musicstopother = 0;
if (currentmusicchan == 0){
musicchannel2.stop();
};
if (currentmusicchan == 1){
musicchannel.stop();
};
};
if (musicstopother < 0){
musicstopother = 0;
};
musicchancur--;
if ((((((musicchancur <= 0)) && ((currentsong > -1)))) && ((musicchanlen > 0)))){
musicchancur = musicchanlen;
if (currentmusicchan == 0){
musicchannel2 = musicchan[currentsong].play();
musicstopother = 3;
currentmusicchan = 1;
} else {
musicchannel = musicchan[currentsong].play();
musicstopother = 3;
currentmusicchan = 0;
};
};
}
public function fadeout():void{
if ((((currentsong == 1)) || ((currentsong == 3)))){
if (musicfade == 0){
musicchannel.removeEventListener(Event.SOUND_COMPLETE, stopmusic);
musicfade = 31;
};
} else {
if (currentsong == 0){
if (musicfade == 0){
musicfade = 31;
};
};
};
}
public function processmusicfade():void{
musicfade--;
if (musicfade > 0){
if (currentmusicchan == 0){
musicchannel.soundTransform = new SoundTransform((musicfade / 30));
};
if (currentmusicchan == 1){
musicchannel2.soundTransform = new SoundTransform((musicfade / 30));
};
} else {
if (currentmusicchan == 0){
musicchannel.stop();
};
if (currentmusicchan == 1){
musicchannel2.stop();
};
currentsong = -1;
};
}
public function stopmusic(e:Event):void{
musicchannel.removeEventListener(Event.SOUND_COMPLETE, stopmusic);
musicchannel.stop();
currentsong = -1;
}
public function play(t:int, optstart:int=0):void{
if (currentsong != t){
if (currentsong != -1){
currentmusicchan = 0;
musicchannel.stop();
musicchannel.removeEventListener(Event.SOUND_COMPLETE, loopmusic);
};
if (t != -1){
currentsong = t;
if (currentsong == 1){
musicfadein = 30;
if ((((numplays == 0)) || ((optstart == 0)))){
musicchannel = musicchan[currentsong].play(0);
} else {
switch (int((Math.random() * 3))){
case 0:
musicchannel = musicchan[currentsong].play(47477);
break;
case 1:
musicchannel = musicchan[currentsong].play(27477);
break;
case 2:
musicchannel = musicchan[currentsong].play(60410);
break;
default:
musicchannel = musicchan[currentsong].play(0);
break;
};
};
numplays++;
} else {
musicchannel = musicchan[currentsong].play(0);
};
musicchannel.addEventListener(Event.SOUND_COMPLETE, loopmusic);
} else {
currentsong = -1;
};
};
}
}
}//package
Section 49
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import flash.ui.*;
import flash.net.*;
import flash.utils.*;
public dynamic class Preloader extends MovieClip {
private var im_loading:Class;
public var showctp:Boolean;
public var startgame:Boolean;
public var adson:Boolean;
public var loading:Bitmap;
public function Preloader(){
im_loading = Preloader_im_loading;
super();
if (checksite()){
adson = false;
} else {
adson = true;
};
adson = false;
var rc_menu:ContextMenu = new ContextMenu();
var credit:ContextMenuItem = new ContextMenuItem("Visit distractionware.com");
var credit2:ContextMenuItem = new ContextMenuItem("Visit kongregate.com");
credit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_distractionware);
credit2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_sponsor);
credit2.separatorBefore = false;
rc_menu.hideBuiltInItems();
rc_menu.customItems.push(credit);
rc_menu.customItems.push(credit2);
this.contextMenu = rc_menu;
addEventListener(Event.ENTER_FRAME, checkFrame);
if (!adson){
loading = new im_loading();
loading.x = (320 - (loading.width / 2));
loading.y = 316;
addChild(loading);
};
showctp = false;
startgame = false;
}
private function checkFrame(e:Event):void{
var w:int;
var p:Number = (this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal);
if (!adson){
graphics.clear();
graphics.beginFill(0);
graphics.drawRect(0, 0, 640, 480);
graphics.endFill();
graphics.beginFill(16642357);
graphics.drawRect(120, 279, 400, 18);
graphics.endFill();
};
if (p < 1){
if (!adson){
graphics.beginFill(0);
w = int(Math.round((p * 391)));
graphics.drawRect((125 + w), 283, (391 - w), 10);
graphics.endFill();
};
} else {
if (!showctp){
showctp = true;
startgame = true;
};
};
if (currentFrame == totalFrames){
if (startgame){
startup();
};
};
}
public function visit_sponsor(e:Event):void{
var sponsor_link:URLRequest = new URLRequest("http://www.kongregate.com/?gamereferral=dontlookback");
navigateToURL(sponsor_link, "_blank");
}
public function visit_distractionware(e:Event):void{
var distractionware_link:URLRequest = new URLRequest("http://www.distractionware.com");
navigateToURL(distractionware_link, "_blank");
}
public function checksite():Boolean{
var currUrl:String = stage.loaderInfo.url.toLowerCase();
if ((((((((currUrl.indexOf("distractionware.com") <= 0)) && ((currUrl.indexOf("flashgamelicense.com") <= 0)))) && ((currUrl.indexOf("kongregate.com") <= 0)))) && ((currUrl.indexOf("chat.kongregate.com") <= 0)))){
return (false);
};
return (true);
}
private function startup():void{
removeEventListener(Event.ENTER_FRAME, checkFrame);
var mainClass:Class = (getDefinitionByName("Main") as Class);
addChild((new (mainClass) as DisplayObject));
}
}
}//package
Section 50
//Preloader_im_loading (Preloader_im_loading)
package {
import mx.core.*;
public class Preloader_im_loading extends BitmapAsset {
}
}//package
Section 51
//texclass (texclass)
package {
import flash.display.*;
public class texclass extends Sprite {
public var bc:Array;
public var rc:Array;
public var i:int;
public var contents:Array;
public var gc:Array;
public function texclass():void{
contents = new Array();
rc = new Array();
gc = new Array();
bc = new Array();
super();
firstcreate();
}
public function firstcreate():void{
i = 0;
while (i < 64) {
contents.push(int(0));
rc.push(int(0));
gc.push(int(0));
bc.push(int(0));
i++;
};
}
}
}//package
Section 52
//textboxclass (textboxclass)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
public class textboxclass extends Sprite {
public var tr:int;
public var active:Boolean;
public var ismenu:Boolean;
public var lw:int;
public var textrect:Rectangle;
public var yp:int;
public var iter:int;
public var numlines:int;
public var timer:int;
public var highlighted:int;
public var boxname:String;
public var b:int;
public var g:int;
public var h:int;
public var max:int;
public var r:int;
public var tg:int;
public var line:Array;
public var tb:int;
public var tl:Number;
public var tm:int;
public var w:int;
public var xp:int;
public function textboxclass():void{
line = new Array();
super();
firstcreate();
}
public function remove():void{
tm = 2;
tl = 1;
}
public function addline(t:String):void{
line[numlines] = t;
numlines++;
resize();
if (numlines >= 10){
numlines = 0;
};
}
public function firstcreate():void{
var t:String;
iter = 0;
while (iter < 10) {
t = new String();
t = "";
line.push(t);
iter++;
};
x = 0;
y = 0;
w = 0;
h = 0;
numlines = 0;
lw = 0;
tl = 0;
tm = 0;
active = false;
timer = 0;
ismenu = false;
boxname = "textbox";
highlighted = 1;
}
public function resize():void{
max = 0;
iter = 0;
while (iter < numlines) {
if (line[iter].length > max){
max = line[iter].length;
};
iter++;
};
lw = max;
w = ((max + 2) * 6);
h = ((numlines + 2) * 8);
textrect.x = xp;
textrect.y = yp;
textrect.width = w;
textrect.height = h;
}
public function centerx():void{
resize();
xp = (160 - (w / 2));
resize();
}
public function centery():void{
resize();
yp = (120 - (h / 2));
resize();
}
public function update():void{
if (tm == 0){
tl = (tl + 0.1);
if (tl >= 1){
tl = 1;
tm = 1;
};
setcol(int((tr * tl)), int((tg * tl)), int((tb * tl)));
} else {
if (tm == 2){
tl = (tl - 0.1);
if (tl <= 0.5){
tl = 0.5;
active = false;
};
setcol(int((tr * tl)), int((tg * tl)), int((tb * tl)));
};
};
if (timer > 0){
timer--;
if (timer == 0){
tm = 2;
};
};
}
public function clear():void{
iter = 0;
while (iter < 10) {
line[iter] = "";
iter++;
};
textrect = new Rectangle();
xp = 0;
yp = 0;
w = 0;
h = 0;
numlines = 1;
lw = 0;
tl = 0;
tm = 0;
active = true;
timer = 0;
}
public function setcol(rr:int, gg:int, bb:int):void{
r = rr;
g = gg;
b = bb;
}
public function initcol(rr:int, gg:int, bb:int):void{
tr = rr;
tg = gg;
tb = bb;
r = 0;
g = 0;
b = 0;
tl = 0.5;
}
}
}//package
Section 53
//triggertileclass (triggertileclass)
package {
public class triggertileclass {
public var action:int;
public var x:int;
public var y:int;
public var name:String;
public function triggertileclass():void{
super();
clear();
}
public function clear():void{
x = 0;
y = 0;
action = 0;
}
}
}//package