Section 1
//Mouse (common.Mouse)
package common {
import flash.events.*;
import flash.display.*;
public class Mouse {
public static var press:Boolean = false;
public static var release:Boolean = false;
public static var down:Boolean = false;
private static var isDown:Boolean = false;
public static var x:Number = 0;
public static var y:Number = 0;
public static function main():void{
if (isDown == true){
if (down == false){
press = true;
} else {
press = false;
};
down = true;
release = false;
} else {
if (down == true){
release = true;
} else {
release = false;
};
down = false;
press = false;
};
}
private static function onMouseUp(_arg1:Event):void{
isDown = false;
}
private static function onMouseDown(_arg1:Event):void{
isDown = true;
}
public static function setListener(_arg1:Stage):void{
_arg1.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
_arg1.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
private static function onMouseMove(_arg1:Event):void{
x = _arg1.target.mouseX;
y = _arg1.target.mouseY;
}
}
}//package common
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 = "2.0.1.0";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
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(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//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 = "2.0.1.0";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
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.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function set height(_arg1:Number):void;
function get scaleY():Number;
function move(_arg1:Number, _arg2:Number):void;
function get scaleX():Number;
function set mask(_arg1:DisplayObject):void;
function set scaleX(_arg1:Number):void;
function set name(_arg1:String):void;
function set scaleY(_arg1:Number):void;
function get visible():Boolean;
function get measuredWidth():Number;
function set visible(_arg1:Boolean):void;
function get alpha():Number;
function get height():Number;
function get width():Number;
function get parent():DisplayObjectContainer;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set y(_arg1:Number):void;
function get x():Number;
function get y():Number;
function set alpha(_arg1:Number):void;
}
}//package mx.core
Section 6
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function get repeaters():Array;
function get instanceIndices():Array;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function set repeaterIndices(_arg1: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
//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 = "2.0.1.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local3:DisplayObject;
var _local4:String;
var _local5:Array;
_local3 = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
var _local2:String;
var _local3:int;
var _local4:int;
if (!_arg1){
return (null);
};
_local2 = getQualifiedClassName(_arg1);
_local3 = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
_local4 = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 9
//Actor (Actor)
package {
public class Actor {
public var exist:Boolean;
public var position:Vec3;
public static var DRAW_PRIORITY:Object = {FIRST:0, BACK:1, NORMAL:2, FRONT:3, LAST:4};
public function Actor(){
exist = false;
}
public function draw(_arg1:int=2):void{
}
public function move():void{
}
}
}//package
Section 10
//ActorPool (ActorPool)
package {
public class ActorPool {
private var index:int;// = 0
private var count:int;// = 0
public var actors:Array;
public function ActorPool(_arg1:int){
var _local2:int;
index = 0;
count = 0;
super();
actors = new Array();
_local2 = 0;
while (_local2 < _arg1) {
actors.push(new Character());
_local2++;
};
index = 0;
count = _arg1;
}
public function getInstanceForced(){
index--;
if (index < 0){
index = (actors.length - 1);
};
return (actors[index]);
}
public function countExist():int{
var _local1:int;
var _local2:*;
_local1 = 0;
for each (_local2 in actors) {
if (_local2.exist){
_local1++;
};
};
return (_local1);
}
public function draw():void{
var _local1:*;
for each (_local1 in actors) {
if (_local1.exist){
_local1.draw();
};
};
}
public function move():void{
var _local1:*;
for each (_local1 in actors) {
if (_local1.exist){
_local1.move();
};
};
}
public function getNearest(_arg1:Vec3){
var _local2:Number;
var _local3:*;
var _local4:*;
_local2 = 99999999.9;
_local3 = null;
for each (_local4 in actors) {
if (_local4.exist == false){
} else {
if (_local4.position.getDist(_arg1) < _local2){
_local2 = _local4.position.getDist(_arg1);
_local3 = _local4;
};
};
};
return (_local3);
}
public function getCount():int{
return (count);
}
public function getInstance(){
var _local1:int;
_local1 = 0;
while (_local1 < actors.length) {
index--;
if (index < 0){
index = (actors.length - 1);
};
if (!actors[index].exist){
return (actors[index]);
};
_local1++;
};
return (null);
}
}
}//package
Section 11
//Character (Character)
package {
public class Character extends Actor {
public var direction:int;
public var gamemain:GameMain;
public var move_fraction:Number;
public var motion:String;
public var type:int;
public var timer:int;
public var keypad:Keypad;
public var motion_wait:int;
public var vecx:Array;
public var vecy:Array;
public var life:int;
public static const type_shake:Array = [false, true, true, false, false, true, true];
public static const type_shadow:Array = [false, true, true, false, false, true, true];
public static const type_life_max:Array = [0, 20, 9999, 0, 0, 20, 20];
public static const type_dead_grass:Array = [false, true, false, false, false, false, false];
public static const type_life_dec:Array = [0, 40, 0, 0, 0, 40, 40];
public static const motion_interval:Array = [0, 999, 20, 2, 24, 40, 20, 80];
public static const type_movespeed:Array = [0, 0.03, 0.1, 0.5, 0, 0.03, 0.03];
public static const type_blocking:Array = [false, true, true, false, false, true, true];
public static const DIRECTION:Object = {DOWN:0, RIGHT:1, LEFT:2, UP:3, MAX:4};
public static var type_name:Array = ["SHADOW", "NICOCHU", "SOWAKA", "RAINBOW_RAY", "EXPLODE", "UP_NUSHI", "ARASHI", "MAX"];
public static var MOTION:Object = {NORMAL:0, WALK:1, DAMAGED:2, SHOOTING:3, VANISH:4, DYING:5, EATING:6, EATING2:7};
public static var TYPE:Object = {NONE:0, SHADOW:0, NICOCHU:1, VC_MK:2, RAINBOW_RAY:3, EXPLODE:4, UP_NUSHI:5, ARASHI:6, MAX:7};
public function Character(){
vecx = [0, 1, -1, 0];
vecy = [1, 0, 0, -1];
super();
position = new Vec3();
type = TYPE.NICOCHU;
move_fraction = 0;
timer = 0;
direction = DIRECTION.DOWN;
motion = MOTION.NORMAL;
life = 0;
}
public function actBreed():void{
var _local1:int;
var _local2:Character;
if (move_fraction != 0){
return;
};
_local1 = TYPE.NONE;
switch (type){
case TYPE.NICOCHU:
_local1 = TYPE.NICOCHU;
if (Hell.randInt(0, 1000) < ConfigParser.getint("ARASHI_TRANSFORM_RATIO")){
_local1 = TYPE.ARASHI;
};
break;
case TYPE.ARASHI:
_local1 = TYPE.ARASHI;
break;
default:
break;
};
if (((!((_local1 == TYPE.NONE))) && ((life >= type_life_max[type])))){
life = (life / 2);
_local2 = gamemain.charpool.set(new Vec3(position.x, position.y, 0), _local1);
if (_local2){
_local2.life = life;
while (_local2.direction == direction) {
_local2.direction = Hell.randInt(0, DIRECTION.MAX);
};
};
};
}
public function destroyMap(_arg1:int, _arg2:int, _arg3:int=1, _arg4:Boolean=false):void{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Array;
var _local10:Character;
_local5 = -(_arg3);
while (_local5 <= _arg3) {
_local6 = -(_arg3);
while (_local6 <= _arg3) {
_local7 = (_arg1 + _local5);
_local8 = (_arg2 + _local6);
if (((gamemain.map.isMap(_local7, _local8, MapChip.TYPE.MOVIE)) || (((_arg4) && (!(gamemain.map.isMap(_local7, _local8, MapChip.TYPE.NONE))))))){
gamemain.map.set(_local7, _local8, MapChip.TYPE.NONE);
_local10 = gamemain.charpool.set(new Vec3(_local7, _local8, 0), TYPE.EXPLODE);
if (_local10){
_local10.setMotion(MOTION.VANISH);
};
};
gamemain.map.setGrass(_local7, _local8, 0);
_local9 = gamemain.charpool.getCharacterAtMap(_local7, _local8);
for each (_local10 in _local9) {
if (((((((_local10) && (_local10.exist))) && (!((_local10.type == TYPE.VC_MK))))) && ((type_life_max[_local10.type] > 0)))){
_local10.destroy();
};
};
_local6++;
};
_local5++;
};
}
public function destroyNeighbor():void{
destroyMap(position.x, position.y);
}
public function init(_arg1:GameMain, _arg2:Vec3, _arg3:int):void{
this.gamemain = _arg1;
this.position = _arg2;
this.type = _arg3;
this.exist = true;
this.motion = MOTION.NORMAL;
this.move_fraction = 0;
this.keypad = null;
this.timer = 0;
if (_arg3 == TYPE.VC_MK){
this.keypad = new Keypad();
};
this.life = type_life_max[_arg3];
}
public function getPosition():Vec3{
return (position);
}
public function toMapXf():Number{
return ((position.x + (move_fraction * vecx[direction])));
}
public function eatCharacter(_arg1:int, _arg2:Boolean=false):Boolean{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Array;
var _local9:Character;
_local3 = position.x;
_local4 = position.y;
if (move_fraction != 0){
return (false);
};
_local5 = 0;
while (_local5 < DIRECTION.MAX) {
if ((((_arg2 == false)) && (!((direction == _local5))))){
} else {
_local6 = (_local3 + vecx[_local5]);
_local7 = (_local4 + vecy[_local5]);
_local8 = gamemain.charpool.getCharacterAtMap(_local6, _local7);
for each (_local9 in _local8) {
if (((((_local9) && (_local9.exist))) && ((_local9.type == _arg1)))){
direction = _local5;
life = (life + _local9.life);
_local9.destroy();
return (true);
};
};
};
_local5++;
};
return (false);
}
public function actCharacter():void{
if (motion == MOTION.WALK){
move_fraction = (move_fraction + type_movespeed[type]);
if (move_fraction >= 1){
move_fraction = 1;
position.x = toMapXf();
position.y = toMapYf();
move_fraction = 0;
setMotion(MOTION.NORMAL);
};
if (((!(gamemain.map.isMovable(getDestX(), getDestY()))) && (isBlocking()))){
move_fraction = 0;
setMotion(MOTION.NORMAL);
};
};
}
public function eatMovie(_arg1:Boolean=false):Boolean{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Character;
_local2 = position.x;
_local3 = position.y;
if (move_fraction != 0){
return (false);
};
_local4 = 0;
while (_local4 < DIRECTION.MAX) {
if ((((_arg1 == false)) && (!((direction == _local4))))){
} else {
_local5 = (_local2 + vecx[_local4]);
_local6 = (_local3 + vecy[_local4]);
if (gamemain.map.isMap(_local5, _local6, MapChip.TYPE.MOVIE)){
direction = _local4;
life = (life + ConfigParser.getint("ARASHI_EAT_MOVIE_LIFE_GAIN"));
gamemain.map.set(_local5, _local6, MapChip.TYPE.NONE);
_local7 = gamemain.charpool.set(new Vec3(_local5, _local6, 0), TYPE.EXPLODE);
if (_local7){
_local7.setMotion(MOTION.VANISH);
};
return (true);
};
};
_local4++;
};
return (false);
}
public function eatGrass():Boolean{
var _local1:int;
var _local2:int;
_local1 = position.x;
_local2 = position.y;
if (move_fraction != 0){
return (false);
};
if (gamemain.map.getGrassLevel(_local1, _local2) < 1){
return (false);
};
life = (life + (gamemain.map.getGrassLevel(_local1, _local2) * 2));
gamemain.map.setGrass(_local1, _local2, 0);
return (true);
}
public function setMotion(_arg1:String):void{
this.motion = _arg1;
this.motion_wait = motion_interval[_arg1];
}
public function getDestX():int{
return ((position.x + vecx[direction]));
}
public function getDestY():int{
return ((position.y + vecy[direction]));
}
override public function draw(_arg1:int=2):void{
var _local2:Map;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
if (_arg1 == DRAW_PRIORITY.NORMAL){
_local2 = gamemain.map;
_local3 = toMapXf();
_local4 = toMapYf();
_local5 = 0xFF;
if (motion == MOTION.DYING){
_local5 = ((0xFF * motion_wait) / motion_interval[motion]);
};
if (type_shadow[type]){
Hell.drawGraphic("SHADOW", _local2.toViewX(_local3, _local4), (_local2.toViewY(_local3, _local4) + (MapChip.CHIP_SIZE / 2)));
};
_local6 = (type_shake[type]) ? ((timer / 8) % 2) : 0;
_local7 = ((((direction == DIRECTION.RIGHT)) || ((direction == DIRECTION.UP)))) ? -1 : 1;
if ((((motion == MOTION.NORMAL)) || ((motion == MOTION.WALK)))){
Hell.drawGraphic((type_name[type] + direction), _local2.toViewX(_local3, _local4), (_local2.toViewY(_local3, _local4) + _local6));
} else {
if (motion == MOTION.DAMAGED){
if ((timer % 4) < 2){
Hell.drawGraphic((type_name[type] + direction), _local2.toViewX(_local3, _local4), _local2.toViewY(_local3, _local4));
};
} else {
if (motion == MOTION.SHOOTING){
Hell.drawGraphic(("SHAGEKI" + direction), _local2.toViewX(_local3, _local4), _local2.toViewY(_local3, _local4));
} else {
if (motion == MOTION.VANISH){
Hell.drawGraphic(("EXPLODE" + Math.floor((timer / 6))), _local2.toViewX(_local3, _local4), _local2.toViewY(_local3, _local4));
} else {
if (motion == MOTION.DYING){
_local8 = (motion_interval[MOTION.DYING] - motion_wait);
Hell.drawGraphicEx("RING", _local2.toViewX(_local3, _local4), ((_local2.toViewY(_local3, _local4) - (MapChip.CHIP_SIZE / 4)) - _local8), 0xFF, 0xFF, 0xFF, _local5);
Hell.drawGraphicEx((type_name[type] + direction), _local2.toViewX(_local3, _local4), (_local2.toViewY(_local3, _local4) - _local8), 0xFF, 0xFF, 0xFF, _local5);
} else {
if (motion == MOTION.EATING){
Hell.drawGraphic((type_name[type] + direction), _local2.toViewX(_local3, _local4), (_local2.toViewY(_local3, _local4) - (((timer / 3) % 2) * 2)));
} else {
if (motion == MOTION.EATING2){
Hell.drawGraphic(((type_name[type] + "_EAT") + direction), _local2.toViewX(_local3, _local4), (_local2.toViewY(_local3, _local4) - (((timer / 3) % 2) * 2)));
};
};
};
};
};
};
};
};
}
public function controlCharacter():void{
var _local1:Character;
if (((keypad.isPressEnter()) && (!((motion == MOTION.SHOOTING))))){
_local1 = gamemain.charpool.set(new Vec3(position), TYPE.RAINBOW_RAY, direction);
if (_local1){
_local1.move_fraction = move_fraction;
setMotion(MOTION.SHOOTING);
};
};
if (motion == MOTION.NORMAL){
if (move_fraction != 0){
setMotion(MOTION.WALK);
return;
};
if (keypad.isPressDown()){
direction = DIRECTION.DOWN;
setMotion(MOTION.WALK);
};
if (keypad.isPressRight()){
direction = DIRECTION.RIGHT;
setMotion(MOTION.WALK);
};
if (keypad.isPressUp()){
direction = DIRECTION.UP;
setMotion(MOTION.WALK);
};
if (keypad.isPressLeft()){
direction = DIRECTION.LEFT;
setMotion(MOTION.WALK);
};
};
}
public function toMapYf():Number{
return ((position.y + (move_fraction * vecy[direction])));
}
override public function move():void{
var _local1:Map;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Character;
timer++;
_local1 = gamemain.map;
_local2 = position.x;
_local3 = position.y;
if ((((((((_local2 < 0)) || ((_local3 < 0)))) || ((_local2 >= _local1.width)))) || ((_local3 >= _local1.height)))){
exist = false;
};
if ((((type_life_dec[type] > 0)) && (((timer % type_life_dec[type]) == 0)))){
life--;
};
motion_wait--;
if (motion_wait < 1){
motion_wait = 0;
if ((((motion == MOTION.VANISH)) || ((motion == MOTION.DYING)))){
exist = false;
};
if ((((motion == MOTION.DYING)) && (type_dead_grass[type]))){
if (_local1.getGrassLevel(_local2, _local3) < 2){
_local1.setGrass(_local2, _local3, 20);
};
};
motion = MOTION.NORMAL;
};
if ((((((((life < 0)) && (!((motion == MOTION.VANISH))))) && (!((motion == MOTION.DYING))))) && ((type_life_max[type] > 0)))){
setMotion(MOTION.DYING);
life = 0;
};
if (motion == MOTION.DYING){
return;
};
switch (type){
case TYPE.NICOCHU:
if ((((motion == MOTION.NORMAL)) && ((Hell.randInt(0, 10) < 5)))){
if (eatGrass()){
setMotion(MOTION.EATING);
selectNewDirection();
};
};
if (motion == MOTION.EATING){
_local1.setGrass(_local2, _local3, 0);
};
if (motion == MOTION.NORMAL){
_local4 = Hell.randInt(0, 100);
if (_local4 < ConfigParser.getint("NICOCHU_TURN_RATIO")){
_local5 = _local1.getGrassLevel((_local2 - 1), _local3);
_local6 = _local1.getGrassLevel((_local2 + 1), _local3);
_local7 = _local1.getGrassLevel(_local2, (_local3 - 1));
_local8 = _local1.getGrassLevel(_local2, (_local3 + 1));
if ((((_local5 + _local6) + _local7) + _local8) == 0){
selectNewDirection();
} else {
_local9 = Hell.randInt(0, (((_local5 + _local6) + _local7) + _local8));
if (_local9 < _local5){
direction = DIRECTION.LEFT;
} else {
if (_local9 < (_local5 + _local6)){
direction = DIRECTION.RIGHT;
} else {
if (_local9 < ((_local5 + _local6) + _local7)){
direction = DIRECTION.UP;
} else {
direction = DIRECTION.DOWN;
};
};
};
};
};
setMotion(MOTION.WALK);
};
if (((((timer % (ConfigParser.getint("UPNUSHI_TRANSFORM_INTERVAL") * 40)) == 0)) && ((Hell.randInt(0, 100) < ConfigParser.getint("UPNUSHI_TRANSFORM_RATIO"))))){
exist = false;
_local10 = gamemain.charpool.set(new Vec3(position), TYPE.UP_NUSHI, direction);
};
break;
case TYPE.VC_MK:
controlCharacter();
life = type_life_max[type];
break;
case TYPE.RAINBOW_RAY:
if (motion == MOTION.NORMAL){
setMotion(MOTION.WALK);
};
if (gamemain.map.isMap(getDestX(), getDestY(), MapChip.TYPE.FENCE)){
exist = false;
};
destroyNeighbor();
break;
case TYPE.EXPLODE:
break;
case TYPE.UP_NUSHI:
if (motion == MOTION.NORMAL){
if (Hell.randInt(0, 10) < ConfigParser.getint("UPNUSHI_TURN_RATIO")){
selectNewDirection();
};
setMotion(MOTION.WALK);
};
if (life < 1){
_local1.set(position.x, position.y, MapChip.TYPE.MOVIE);
setMotion(MOTION.DYING);
};
break;
case TYPE.ARASHI:
if (motion == MOTION.NORMAL){
if (eatCharacter(TYPE.UP_NUSHI, ConfigParser.getboolean("ARASHI_EAT_UPNUSHI_IS_ALLDIR"))){
setMotion(MOTION.EATING2);
} else {
if (eatCharacter(TYPE.NICOCHU, ConfigParser.getboolean("ARASHI_EAT_NICOCHU_IS_ALLDIR"))){
setMotion(MOTION.EATING2);
} else {
if (eatMovie(ConfigParser.getboolean("ARASHI_EAT_MOVIE_IS_ALLDIR"))){
setMotion(MOTION.EATING2);
} else {
if (Hell.randInt(0, 100) < ConfigParser.getint("ARASHI_TURN_RATIO")){
selectNewDirection();
};
setMotion(MOTION.WALK);
};
};
};
};
_local1.setGrass(_local2, _local3, 0);
break;
default:
break;
};
actBreed();
actCharacter();
}
public function getDestination():Vec3{
if (motion != MOTION.WALK){
return (position);
};
return (new Vec3((position.x + vecx[direction]), (position.y + vecy[direction]), 0));
}
public function selectNewDirection():void{
var _local1:Boolean;
var _local2:int;
_local2 = 0;
do {
_local2++;
direction = Math.floor((Math.random() * 4));
_local1 = gamemain.map.isMovable(getDestX(), getDestY());
} while (((!(_local1)) && ((_local2 < 32))));
}
public function drawStatus():void{
var _local1:Map;
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:int;
_local1 = gamemain.map;
_local2 = toMapXf();
_local3 = toMapYf();
_local4 = _local1.toViewX(_local2, _local3);
_local5 = _local1.toViewY(_local2, _local3);
Hell.drawFont(type_name[type], (_local4 - (8 * 10)), (_local5 - 8));
Hell.drawFont(("LIFE:" + life), (_local4 - (8 * 10)), (_local5 + 2));
Hell.drawFont(("TIME:" + Math.floor((timer / 40))), (_local4 - (8 * 10)), (_local5 + 10));
Hell.drawFont(("MOT:" + motion), (_local4 - (8 * 10)), (_local5 + 10));
Hell.drawFont(("MOW:" + motion_wait), (_local4 - (8 * 10)), (_local5 + 18));
}
public function destroy():void{
var _local1:Character;
exist = false;
_local1 = gamemain.charpool.set(new Vec3(position), TYPE.EXPLODE, direction);
if (_local1){
_local1.move_fraction = move_fraction;
_local1.setMotion(MOTION.VANISH);
};
}
public function isBlocking():Boolean{
return (type_blocking[type]);
}
}
}//package
Section 12
//CharacterPool (CharacterPool)
package {
public class CharacterPool extends ActorPool {
public var width:int;
public var height:int;
public var gamemain:GameMain;
public var charbacket:Array;
public function CharacterPool(_arg1:GameMain, _arg2:int, _arg3:int, _arg4:int){
var _local5:int;
this.gamemain = _arg1;
this.width = _arg3;
this.height = _arg4;
charbacket = new Array();
_local5 = 0;
while (_local5 < (_arg3 * _arg4)) {
charbacket.push(new CharacterBacket());
_local5++;
};
super(_arg2);
}
public function drawAtMap(_arg1:int, _arg2:int):void{
if (!inRange(_arg1, _arg2)){
return;
};
charbacket[(_arg1 + (_arg2 * width))].draw();
}
public function count(_arg1:int=0):int{
var _local2:int;
var _local3:*;
_local2 = 0;
for each (_local3 in actors) {
if ((((_local3.exist == true)) && ((((_arg1 == Character.TYPE.NONE)) || ((_local3.type == _arg1)))))){
_local2++;
};
};
return (_local2);
}
override public function move():void{
super.move();
updateBacket();
}
public function removeCharacter(_arg1:int):void{
var _local2:*;
for each (_local2 in actors) {
if (((_local2.exist) && ((_local2.type == _arg1)))){
_local2.exist = false;
};
};
}
public function drawStatus():void{
var _local1:*;
for each (_local1 in actors) {
if (_local1.exist){
_local1.drawStatus();
};
};
}
public function entryFromMapBorder(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Character;
_local4 = Hell.randInt(0, (width + height));
_local5 = set(new Vec3(), _arg1);
if (!_local5){
return;
};
if (_local4 > width){
_local5.position.y = (_local4 - width);
if (Hell.randInt(0, 10) < 5){
_local5.position.x = 0;
_local5.direction = Character.DIRECTION.RIGHT;
} else {
_local5.position.x = (width - 1);
_local5.direction = Character.DIRECTION.LEFT;
};
} else {
_local5.position.x = _local4;
if (Hell.randInt(0, 10) < 5){
_local5.position.y = 0;
_local5.direction = Character.DIRECTION.DOWN;
} else {
_local5.position.y = (height - 1);
_local5.direction = Character.DIRECTION.UP;
};
};
}
public function inRange(_arg1:int, _arg2:int):Boolean{
if ((((((((_arg1 < 0)) || ((_arg2 < 0)))) || ((_arg1 >= width)))) || ((_arg2 >= height)))){
return (false);
};
return (true);
}
public function set(_arg1:Vec3, _arg2:int, _arg3:int=0):Character{
var _local4:Character;
_local4 = getInstance();
if (_local4){
_local4.init(gamemain, _arg1, _arg2);
_local4.direction = _arg3;
return (_local4);
};
return (null);
}
public function getCharacterAtMap(_arg1:int, _arg2:int):Array{
if (!inRange(_arg1, _arg2)){
return (null);
};
return (charbacket[(_arg1 + (_arg2 * width))].char_ptr);
}
public function updateBacket():void{
var _local1:CharacterBacket;
var _local2:*;
var _local3:int;
var _local4:int;
for each (_local1 in charbacket) {
_local1.init();
};
for each (_local2 in actors) {
if (_local2.exist){
_local3 = _local2.toMapXf();
_local4 = _local2.toMapYf();
if (!inRange(_local3, _local4)){
} else {
charbacket[(_local3 + (_local4 * width))].entry(_local2);
};
};
};
}
}
}//package
class CharacterBacket {
public var char_ptr:Array;
public static const BACKET_MAX:int = 4;
private function CharacterBacket(){
char_ptr = new Array(BACKET_MAX);
init();
}
public function init():void{
var _local1:int;
_local1 = 0;
while (_local1 < BACKET_MAX) {
char_ptr[_local1] = null;
_local1++;
};
}
public function entry(_arg1:Character):void{
var _local2:int;
_local2 = 0;
while (_local2 < BACKET_MAX) {
if (!char_ptr[_local2]){
char_ptr[_local2] = _arg1;
return;
};
_local2++;
};
}
public function draw():void{
var _local1:int;
_local1 = 0;
while (_local1 < BACKET_MAX) {
if (char_ptr[_local1]){
char_ptr[_local1].draw();
};
_local1++;
};
}
}
Section 13
//ClickablePool (ClickablePool)
package {
public class ClickablePool {
public var clist:Array;
public var none_enable:Boolean;
public var count:int;
public var selected:String;
public static const MAX_COUNT:int = 32;
public function ClickablePool(_arg1:Boolean=true){
clist = new Array();
this.count = count;
this.selected = "";
this.none_enable = _arg1;
}
public function getMouseOver():String{
var _local1:Clickable;
for each (_local1 in clist) {
if (((!((_local1 == null))) && (_local1.onMouse()))){
return (_local1.str);
};
};
return ("");
}
public function draw():void{
var _local1:Clickable;
for each (_local1 in clist) {
if (_local1){
if (_local1.str == selected){
_local1.selected = true;
} else {
_local1.selected = false;
};
_local1.draw();
};
};
}
public function add(_arg1:String, _arg2:Vec3, _arg3):void{
var _local4:ImageButton;
var _local5:Vec3;
var _local6:Clickable;
var _local7:int;
if ((_arg3 is Vec3)){
clist.push(new Clickable(_arg1, _arg2, _arg3));
} else {
_local4 = new ImageButton(_arg3);
_local5 = new Vec3(_local4.getWidth(), _local4.getHeight(), 0);
_local6 = new Clickable(_arg1, _arg2, _local5, 0, _local4);
_local7 = 0;
while (_local7 < MAX_COUNT) {
if (!clist[_local7]){
clist[_local7] = _local6;
if ((((selected == "")) && ((none_enable == false)))){
selected = _arg1;
};
return;
};
_local7++;
};
};
}
public function getSelected():String{
return (selected);
}
public function getMouseClick():String{
var _local1:String;
if (Hell.isPushMouse()){
_local1 = getMouseOver();
if (_local1 != ""){
if ((((selected == _local1)) && ((none_enable == true)))){
selected = "";
} else {
selected = _local1;
};
};
return (_local1);
};
return ("");
}
}
}//package
class Clickable {
public var size:Vec3;
public var position:Vec3;
public var imagebutton:ImageButton;
public var str:String;
public var zoom:Number;
public var selected:Boolean;
private function Clickable(_arg1:String, _arg2:Vec3, _arg3:Vec3, _arg4:Number=2, _arg5:ImageButton=null){
this.str = _arg1;
this.position = _arg2;
this.size = _arg3;
this.zoom = _arg4;
this.imagebutton = _arg5;
this.selected = false;
if (_arg5){
_arg5.setPosition(_arg2);
};
}
public function draw():void{
if ((imagebutton is ImageButton) == false){
if (onMouse()){
Hell.drawFont(str, position.x, position.y);
} else {
Hell.drawFont(str, position.x, position.y);
};
} else {
imagebutton.draw(selected, onMouse());
};
}
public function onMouse():Boolean{
if ((((((((position.x <= Hell.getMouseX())) && (((position.x + size.x) >= Hell.getMouseX())))) && ((position.y <= Hell.getMouseY())))) && (((position.y + size.y) >= Hell.getMouseY())))){
return (true);
};
return (false);
}
}
Section 14
//ConfigParser (ConfigParser)
package {
public class ConfigParser {
private static var CONFIG:Object = {MAP_WIDTH:32, MAP_HEIGHT:32, MAP_BORDER_IS_WALL:true, MAP_GRASS_AFFECT:0.9, MAP_GRASS_AFFECT_LIMIT:0.5, MAP_REFRESH_INTERVAL:10, MAP_MOVIE_GRASS_FEED:200, NICOCHU_TURN_RATIO:50, UPNUSHI_TRANSFORM_INTERVAL:60, UPNUSHI_TRANSFORM_RATIO:20, UPNUSHI_TURN_RATIO:20, ARASHI_TRANSFORM_RATIO:8, ARASHI_EAT_MOVIE_LIFE_GAIN:10, ARASHI_TURN_RATIO:30, ARASHI_EAT_NICOCHU_IS_ALLDIR:true, ARASHI_EAT_UPNUSHI_IS_ALLDIR:true, ARASHI_EAT_MOVIE_IS_ALLDIR:true};
public static function getint(_arg1:String):int{
return (CONFIG[_arg1]);
}
public static function getfloat(_arg1:String):Number{
return (CONFIG[_arg1]);
}
public static function getboolean(_arg1:String):Boolean{
return (CONFIG[_arg1]);
}
}
}//package
Section 15
//GameMain (GameMain)
package {
public class GameMain extends GameState {
public var shake_power:int;
public var target:Character;
public var mray_timer:int;
public var speed_switch:ClickablePool;
public var chart_switch:ClickablePool;
public var timer:int;
public var cursor_x:int;
public var cursor_y:int;
public var keypad:Keypad;
public var economy_switch:ClickablePool;
public var map:Map;
public var mouse_x:int;
public var menu:ClickablePool;
public var mouse_y:int;
public var chart:PlayChart;
public var view_point_x:Number;
public var view_point_y:Number;
public var charpool:CharacterPool;
public var config_reload_timer:int;
public static const MRAY_TIMER_FIRST_WAIT:int = 40;
public static const CONFIG_RELOAD_CHECK_INTERVAL:int = 200;
public static const CONFIG_RELOAD_SHOW_INTERVAL:int = 120;
public static const MRAY_TIMER_SECOND_TARGET:int = 80;
public function GameMain(){
var _local1:int;
var _local2:int;
super();
timer = 0;
config_reload_timer = 0;
mray_timer = 0;
shake_power = 0;
_local1 = ConfigParser.getint("MAP_WIDTH");
_local2 = ConfigParser.getint("MAP_HEIGHT");
map = new Map(this, _local1, _local2);
charpool = new CharacterPool(this, 0x0200, _local1, _local2);
view_point_x = ((getScreenWidth() / 2) - map.toViewX((_local1 / 2), (_local2 / 2)));
view_point_y = ((getScreenHeight() / 2) - map.toViewY((_local1 / 2), (_local2 / 2)));
keypad = new Keypad();
chart = new PlayChart(this);
target = null;
menu = new ClickablePool(false);
menu.add("del", new Vec3((getScreenWidth() - (ImageButton.BUTTON_WIDTH * 4)), (getScreenHeight() - ImageButton.BUTTON_HEIGHT), 0), ImageButton.TYPE.DEL);
menu.add("fence", new Vec3((getScreenWidth() - (ImageButton.BUTTON_WIDTH * 3)), (getScreenHeight() - ImageButton.BUTTON_HEIGHT), 0), ImageButton.TYPE.FENCE);
menu.add("up", new Vec3((getScreenWidth() - (ImageButton.BUTTON_WIDTH * 2)), (getScreenHeight() - ImageButton.BUTTON_HEIGHT), 0), ImageButton.TYPE.UP);
menu.add("call_nico", new Vec3((getScreenWidth() - (ImageButton.BUTTON_WIDTH * 1)), (getScreenHeight() - ImageButton.BUTTON_HEIGHT), 0), ImageButton.TYPE.CALL_NICO);
chart_switch = new ClickablePool();
economy_switch = new ClickablePool();
speed_switch = new ClickablePool(false);
speed_switch.add("play", new Vec3((getScreenWidth() - (32 * 3)), 0, 0), ImageButton.TYPE.PLAY);
speed_switch.add("stop", new Vec3((getScreenWidth() - (32 * 4)), 0, 0), ImageButton.TYPE.STOP);
speed_switch.add("ksk", new Vec3((getScreenWidth() - (32 * 2)), 0, 0), ImageButton.TYPE.KSK);
speed_switch.add("danger", new Vec3((getScreenWidth() - (32 * 1)), 0, 0), ImageButton.TYPE.DANGER);
}
public function getScreenWidth():int{
return (koke.g_width);
}
public function getScreenHeight():int{
return (koke.g_height);
}
override public function draw():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:String;
var _local6:String;
var _local7:String;
var _local8:MapChip;
Hell.begin();
_local1 = 0;
_local2 = 0;
if (shake_power > 0){
_local1 = Hell.randInt(-(shake_power), shake_power);
_local2 = (Hell.randInt(-(shake_power), shake_power) / 2);
};
map.draw_ofs_x = (map.draw_ofs_x + _local1);
map.draw_ofs_y = (map.draw_ofs_y + _local2);
map.draw();
if (onMouseMap()){
MapChip.drawCursor(map.toViewX(cursor_x, cursor_y), map.toViewY(cursor_x, cursor_y), ((timer / 5) % 4));
Hell.drawFont(("X:" + cursor_x), (mouse_x + 16), (mouse_y - 32));
Hell.drawFont(("Y:" + cursor_y), (mouse_x + 16), (mouse_y - 24));
if (map.inRange(cursor_x, cursor_y)){
_local8 = map.toMap(cursor_x, cursor_y);
Hell.drawFont(("G:" + _local8.grass), (mouse_x + 16), (mouse_y - 16));
Hell.drawFont(("GL:" + _local8.getGrassLevel()), (mouse_x + 16), (mouse_y - 8));
Hell.drawFont(("TYPE:" + MapChip.name[_local8.type]), (mouse_x + 16), (mouse_y - 0));
};
if (((target) && (target.exist))){
target.drawStatus();
};
};
_local3 = 0;
while (_local3 < Character.TYPE.MAX) {
if (_local3 == Character.TYPE.NONE){
} else {
Hell.drawFont(((Character.type_name[_local3] + ":") + charpool.count(_local3)), 8, (8 * _local3));
};
_local3++;
};
menu.draw();
chart_switch.draw();
economy_switch.draw();
speed_switch.draw();
if (chart_switch.getSelected() != ""){
chart.draw();
};
if ((((config_reload_timer > 0)) && (((timer % 11) < 10)))){
Hell.drawFont("CONFIG RELOADED", ((getScreenWidth() - (8 * 15)) / 2), (getScreenHeight() / 2));
};
map.draw_ofs_x = (map.draw_ofs_x - _local1);
map.draw_ofs_y = (map.draw_ofs_y - _local2);
_local4 = (timer / 40);
_local5 = zfill(Math.floor(((_local4 / 60) % 12)).toString(), 2);
_local6 = zfill(Math.floor((_local4 % 60)).toString(), 2);
_local7 = "AM";
if (((_local4 / 60) % 24) > 11){
_local7 = "PM";
};
Hell.drawFont(((((_local7 + " ") + _local5) + ":") + _local6), 8, (getScreenHeight() - 16));
}
override public function move():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Character;
var _local9:Array;
_local1 = 0;
if (speed_switch.getSelected() == "stop"){
_local1 = 0;
};
if (speed_switch.getSelected() == "play"){
_local1 = 1;
};
if (speed_switch.getSelected() == "ksk"){
_local1 = 5;
};
if (speed_switch.getSelected() == "danger"){
_local1 = 25;
};
if (_local1 > 0){
_local5 = 0;
while (_local5 < _local1) {
timer++;
if ((timer % (40 * 5)) == 0){
chart.addChart(charpool, map);
};
map.update();
charpool.move();
_local5++;
};
} else {
charpool.updateBacket();
};
_local2 = cursor_x;
_local3 = cursor_y;
mouse_x = Hell.getMouseX();
mouse_y = Hell.getMouseY();
cursor_x = map.toMapX(mouse_x, mouse_y);
cursor_y = map.toMapY(mouse_x, mouse_y);
menu.getMouseClick();
chart_switch.getMouseClick();
economy_switch.getMouseClick();
speed_switch.getMouseClick();
_local4 = menu.getSelected();
if (((Hell.isPressMouse()) && (onMouseMap()))){
switch (_local4){
case "del":
map.set(cursor_x, cursor_y, MapChip.TYPE.NONE);
break;
case "herbicide":
_local6 = -4;
while (_local6 < 5) {
_local7 = -4;
while (_local7 < 5) {
map.setGrass((cursor_x + _local6), (cursor_y + _local7), 0);
_local7++;
};
_local6++;
};
break;
case "manage_ray":
mray_timer++;
if ((((mray_timer > MRAY_TIMER_SECOND_TARGET)) && (((mray_timer % 3) == 0)))){
shake_power = 16;
_local8 = charpool.set(new Vec3(cursor_x, cursor_y, 0), Character.TYPE.EXPLODE);
if (_local8){
_local8.destroyMap(cursor_x, cursor_y, Hell.randInt(0, 5), true);
_local8.setMotion(Character.MOTION.VANISH);
};
};
break;
case "call_nico":
if (!Hell.isPushMouse()){
break;
};
if (map.inRange(cursor_x, cursor_y)){
_local8 = charpool.set(new Vec3(cursor_x, cursor_y, 0), Character.TYPE.NICOCHU);
if (_local8){
_local8.selectNewDirection();
};
} else {
charpool.entryFromMapBorder(Character.TYPE.NICOCHU);
};
break;
case "up":
map.set(cursor_x, cursor_y, MapChip.TYPE.MOVIE);
break;
case "fence":
map.set(cursor_x, cursor_y, MapChip.TYPE.FENCE);
break;
default:
Hell.write("Unknown menu command");
break;
};
} else {
mray_timer = 0;
if (shake_power > 0){
shake_power--;
};
};
if (keypad.isPushCancel()){
if (charpool.count(Character.TYPE.VC_MK) < 1){
if (map.inRange(cursor_x, cursor_y)){
charpool.set(new Vec3(cursor_x, cursor_y, 0), Character.TYPE.VC_MK);
};
} else {
charpool.removeCharacter(Character.TYPE.VC_MK);
};
};
map.draw_ofs_x = ((map.draw_ofs_x * 0.9) + (view_point_x * 0.1));
map.draw_ofs_y = ((map.draw_ofs_y * 0.9) + (view_point_y * 0.1));
if (((!((cursor_x == _local2))) || (!((cursor_y == _local3))))){
_local9 = charpool.getCharacterAtMap(cursor_x, cursor_y);
if (((_local9) && (_local9[0]))){
target = _local9[0];
};
};
}
public function onMouseMap():Boolean{
if ((((((((menu.getMouseOver() == "")) && ((economy_switch.getMouseOver() == "")))) && ((chart_switch.getMouseOver() == "")))) && ((speed_switch.getMouseOver() == "")))){
return (true);
};
return (false);
}
public function zfill(_arg1:String, _arg2:int):String{
var _local3:int;
_local3 = _arg1.length;
while (_local3 < _arg2) {
_arg1 = ("0" + _arg1);
_local3++;
};
return (_arg1);
}
}
}//package
Section 16
//GameState (GameState)
package {
public class GameState {
public var msg:String;// = "none"
public static var MSG_REQ_GAME:String = "req_game";
public static var MSG_NONE:String = "none";
public static var MSG_REQ_TITLE:String = "req_title";
public function GameState(){
msg = "none";
super();
}
public function move():void{
}
public function draw():void{
}
public function setMsg(_arg1:String):void{
msg = _arg1;
}
public function getMsg():String{
return (msg);
}
}
}//package
Section 17
//Hell (Hell)
package {
import flash.display.*;
import common.*;
import flash.geom.*;
import flash.ui.*;
public class Hell {
public static const ESCAPE:int = 0;
public static const LEFT:int = 0;
public static const UP:int = 0;
public static const DOWN:int = 0;
private static const WIDTH:int = 8;
private static const HEIGHT:int = 8;
public static const J_UP:int = 0;
public static const RETURN:int = 0;
public static const J_RIGHT:int = 2;
public static const J_MAX:int = 4;
public static const J_LEFT:int = 3;
private static const COLUMN:int = 16;
public static const c:int = 0;
public static const SPACE:int = 0;
private static const decoder:String = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.()[]#$%&'"!?^+-*/=;:";
public static const J_DOWN:int = 1;
public static const x:int = 0;
public static const z:int = 0;
public static const RIGHT:int = 0;
private static var g_poolTexture:Object = new Object();
private static var point:Point = new Point();
private static var matrix:Matrix = new Matrix();
private static var g_poolGraphic:Object = new Object();
private static var root:Sprite;
private static var rect:Rectangle = new Rectangle();
private static var fps:Number;
private static var screen:BitmapData;
private static var stage:Stage;
public static function drawGraphic(_arg1:String, _arg2:int, _arg3:int):void{
point.x = _arg2;
point.y = _arg3;
screen.copyPixels(g_poolGraphic[_arg1], g_poolGraphic[_arg1].rect, point);
}
public static function randInt(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = (_arg2 - _arg1);
if (_local3 < 1){
return (-1);
};
return (Math.floor((_arg1 + (Math.random() * _local3))));
}
public static function init(_arg1:Sprite, _arg2:int=640, _arg3:int=480):void{
var _local4:Bitmap;
root = _arg1;
stage = _arg1.stage;
fps = stage.frameRate;
stage.quality = StageQuality.LOW;
stage.stageFocusRect = false;
Mouse.setListener(stage);
root.contextMenu = new ContextMenu();
root.contextMenu.hideBuiltInItems();
_local4 = new Bitmap(new BitmapData(_arg2, _arg3, false, 0));
screen = _local4.bitmapData;
_arg1.addChild(_local4);
}
public static function isPushJKey(_arg1:int, _arg2:int):Boolean{
return (false);
}
public static function isPushMouse():Boolean{
return (Mouse.press);
}
public static function divideGraphic(_arg1:String, _arg2:String, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:Boolean=false):void{
var _local8:BitmapData;
var _local9:BitmapData;
point.x = 0;
point.y = 0;
rect.x = _arg3;
rect.y = _arg4;
rect.width = _arg5;
rect.height = _arg6;
_local8 = new BitmapData(_arg5, _arg6, g_poolTexture[_arg1].transparent, 0);
_local8.copyPixels(g_poolTexture[_arg1], rect, point);
if (_arg7 == true){
_local9 = new BitmapData(_arg5, _arg6, _local8.transparent, 0);
matrix.identity();
matrix.scale(-1, 1);
matrix.translate(_arg5, 0);
_local9.draw(_local8, matrix);
g_poolGraphic[_arg2] = _local9;
} else {
g_poolGraphic[_arg2] = _local8;
};
}
public static function drawFont(_arg1:String, _arg2:int, _arg3:int):void{
var _local4:int;
var _local5:String;
var _local6:int;
point.x = _arg2;
point.y = _arg3;
rect.width = WIDTH;
rect.height = HEIGHT;
_local4 = 0;
while (_local4 < _arg1.length) {
_local5 = _arg1.charAt(_local4);
_local6 = decoder.indexOf(_local5);
if (_local5 == " "){
_arg2 = (_arg2 + WIDTH);
} else {
rect.x = (WIDTH * (_local6 % COLUMN));
rect.y = (HEIGHT * Math.floor((_local6 / COLUMN)));
screen.copyPixels(g_poolTexture["font"], rect, point);
point.x = (point.x + WIDTH);
};
_local4++;
};
}
public static function drawTexture(_arg1:String, _arg2:Number, _arg3:Number, _arg4:int, _arg5:int, _arg6:int, _arg7:int):void{
point.x = _arg2;
point.y = _arg3;
rect.x = _arg4;
rect.y = _arg5;
rect.width = _arg6;
rect.height = _arg7;
screen.copyPixels(g_poolTexture[_arg1], rect, point);
}
public static function isPushJButton(_arg1:int, _arg2:int):Boolean{
return (false);
}
public static function isPressJButton(_arg1:int, _arg2:int):Boolean{
return (false);
}
public static function update():void{
Mouse.main();
}
public static function getMouseY():int{
return (Mouse.y);
}
public static function getMouseX():int{
return (Mouse.x);
}
public static function drawTextureEx(_arg1:String, _arg2:Number, _arg3:Number, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int=0xFF, _arg9:int=0xFF, _arg10:int=0xFF, _arg11:int=0xFF):void{
var _local12:BitmapData;
point.x = 0;
point.y = 0;
rect.x = _arg4;
rect.y = _arg5;
rect.width = _arg6;
rect.height = _arg7;
_local12 = new BitmapData(_arg6, _arg7, g_poolTexture[_arg1].transparent, 0);
_local12.copyPixels(g_poolTexture[_arg1], rect, point);
_local12.colorTransform(_local12.rect, new ColorTransform((_arg8 / 0xFF), (_arg9 / 0xFF), (_arg10 / 0xFF), (_arg11 / 0xFF)));
point.x = _arg2;
point.y = _arg3;
screen.copyPixels(_local12, _local12.rect, point);
}
public static function loadTexture(_arg1:String, _arg2:BitmapData):void{
g_poolTexture[_arg1] = _arg2;
}
public static function begin():void{
screen.fillRect(screen.rect, 0);
}
public static function drawRect(_arg1:int=0, _arg2:int=0, _arg3:int=0, _arg4:int=0, _arg5:int=0, _arg6:int=0, _arg7:int=0):void{
rect.x = _arg1;
rect.y = _arg2;
rect.width = _arg3;
rect.height = _arg4;
screen.fillRect(rect, (((_arg5 << 16) + (_arg6 << 8)) + _arg7));
}
public static function isPushKey(_arg1:int):Boolean{
return (false);
}
public static function drawGraphicEx(_arg1:String, _arg2:int, _arg3:int, _arg4:int=0xFF, _arg5:int=0xFF, _arg6:int=0xFF, _arg7:int=0xFF):void{
var _local8:BitmapData;
_local8 = g_poolGraphic[_arg1].clone();
g_poolGraphic[_arg1].clone().colorTransform(_local8.rect, new ColorTransform((_arg4 / 0xFF), (_arg5 / 0xFF), (_arg6 / 0xFF), (_arg7 / 0xFF)));
point.x = _arg2;
point.y = _arg3;
screen.copyPixels(_local8, _local8.rect, point);
}
public static function write(_arg1:String):void{
trace(_arg1);
}
public static function isPressKey(_arg1:int):Boolean{
return (false);
}
public static function isPressMouse():Boolean{
return (Mouse.down);
}
public static function isPressJKey(_arg1:int, _arg2:int):Boolean{
return (false);
}
}
}//package
Section 18
//ImageButton (ImageButton)
package {
public class ImageButton {
public var position:Vec3;
public var type:int;
public static const BUTTON_WIDTH:int = 80;
public static const LRG:int = 0;
public static const SML:int = 1;
public static const BUTTON_HEIGHT:int = 32;
public static const MIN:int = 2;
public static var type_height:Array = [32, 32, 32, 32, 32, 32, 16, 16, 16, 16, 16, 16];
public static var type_width:Array = [80, 80, 80, 80, 80, 80, 64, 64, 32, 32, 32, 32];
public static var type_style:Array = [LRG, LRG, LRG, LRG, LRG, LRG, SML, SML, MIN, MIN, MIN, MIN];
public static var TYPE:Object = {DEL:0, HERBICIDE:1, MANAGE_RAY:2, CALL_NICO:3, UP:4, FENCE:5, ECONOMY:6, CHART:7, STOP:8, PLAY:9, KSK:10, DANGER:11};
public function ImageButton(_arg1:int){
this.type = _arg1;
}
public function getWidth():int{
return (type_width[type]);
}
public function setPosition(_arg1:Vec3):void{
position = _arg1;
}
public function draw(_arg1:Boolean, _arg2:Boolean):void{
var _local3:int;
if (type_style[type] == LRG){
if (_arg1){
Hell.drawTexture("menu", position.x, position.y, (getWidth() * 2), 0, getWidth(), getHeight());
Hell.drawTextureEx("menu", position.x, position.y, 0, ((type + 1) * getHeight()), getWidth(), getHeight(), 0xFF, 0xFF, 0xFF);
} else {
if (_arg2){
Hell.drawTexture("menu", position.x, position.y, getWidth(), 0, getWidth(), getHeight());
Hell.drawTextureEx("menu", position.x, position.y, 0, ((type + 1) * getHeight()), getWidth(), getHeight(), 64, 64, 64);
} else {
Hell.drawTexture("menu", position.x, position.y, 0, 0, getWidth(), getHeight());
Hell.drawTextureEx("menu", position.x, position.y, 0, ((type + 1) * getHeight()), getWidth(), getHeight(), 64, 64, 64);
};
};
} else {
if (type_style[type] == SML){
_local3 = (((_arg2) || (_arg1))) ? 0xFF : 128;
if (_arg1){
Hell.drawTextureEx("menu", position.x, position.y, 242, ((type - TYPE.ECONOMY) * getHeight()), getWidth(), getHeight(), 0xFF, 0xFF, 0xFF, _local3);
} else {
Hell.drawTextureEx("menu", position.x, position.y, 242, ((type - TYPE.ECONOMY) * getHeight()), getWidth(), getHeight(), 128, 128, 128, _local3);
};
} else {
if (type_style[type] == MIN){
_local3 = (((_arg2) || (_arg1))) ? 0xFF : 128;
if (_arg1){
Hell.drawTextureEx("menu", position.x, position.y, 306, ((type - TYPE.STOP) * getHeight()), getWidth(), getHeight(), 0xFF, 0xFF, 0xFF, _local3);
} else {
Hell.drawTextureEx("menu", position.x, position.y, 306, ((type - TYPE.STOP) * getHeight()), getWidth(), getHeight(), 128, 128, 128, _local3);
};
};
};
};
}
public function getHeight():int{
return (type_height[type]);
}
}
}//package
Section 19
//Keypad (Keypad)
package {
public class Keypad {
public var player:int;// = -1
public function Keypad(_arg1:int=0){
player = -1;
super();
this.player = _arg1;
}
public function isPressLeft():Boolean{
if (((Hell.isPressKey(Hell.LEFT)) && ((player == 0)))){
return (true);
};
if (Hell.isPressJKey(Hell.J_LEFT, player)){
return (true);
};
return (false);
}
public function isPressRight():Boolean{
if (((Hell.isPressKey(Hell.RIGHT)) && ((player == 0)))){
return (true);
};
if (Hell.isPressJKey(Hell.J_RIGHT, player)){
return (true);
};
return (false);
}
public function isPushUp():Boolean{
if (((Hell.isPushKey(Hell.UP)) && ((player == 0)))){
return (true);
};
if (Hell.isPushJKey(Hell.J_UP, player)){
return (true);
};
return (false);
}
public function isPressDown():Boolean{
if (((Hell.isPressKey(Hell.DOWN)) && ((player == 0)))){
return (true);
};
if (Hell.isPressJKey(Hell.J_DOWN, player)){
return (true);
};
return (false);
}
public function isPushLeft():Boolean{
if (((Hell.isPushKey(Hell.LEFT)) && ((player == 0)))){
return (true);
};
if (Hell.isPushJKey(Hell.J_LEFT, player)){
return (true);
};
return (false);
}
public function isPushDown():Boolean{
if (((Hell.isPushKey(Hell.DOWN)) && ((player == 0)))){
return (true);
};
if (Hell.isPushJKey(Hell.J_DOWN, player)){
return (true);
};
return (false);
}
public function isPushEnter():Boolean{
if (((Hell.isPushKey(Hell.z)) && ((player == 0)))){
return (true);
};
if (((Hell.isPushKey(Hell.SPACE)) && ((player == 0)))){
return (true);
};
if (Hell.isPushJButton(0, player)){
return (true);
};
return (false);
}
public function isPushRight():Boolean{
if (((Hell.isPushKey(Hell.RIGHT)) && ((player == 0)))){
return (true);
};
if (Hell.isPushJKey(Hell.J_RIGHT, player)){
return (true);
};
return (false);
}
public function isPressUp():Boolean{
if (((Hell.isPressKey(Hell.UP)) && ((player == 0)))){
return (true);
};
if (Hell.isPressJKey(Hell.J_UP, player)){
return (true);
};
return (false);
}
public function isPushCancel():Boolean{
if (((Hell.isPushKey(Hell.x)) && ((player == 0)))){
return (true);
};
if (((Hell.isPushKey(Hell.RETURN)) && ((player == 0)))){
return (true);
};
if (Hell.isPushJButton(1, player)){
return (true);
};
return (false);
}
public function isPressEnter():Boolean{
if (((Hell.isPressKey(Hell.z)) && ((player == 0)))){
return (true);
};
if (((Hell.isPressKey(Hell.SPACE)) && ((player == 0)))){
return (true);
};
if (Hell.isPressJButton(0, player)){
return (true);
};
return (false);
}
}
}//package
Section 20
//koke (koke)
package {
import flash.events.*;
import flash.display.*;
public class koke extends Sprite {
private var BMP_Font:Class;
private var g_gamestate:GameState;// = null
private var BMP_Char:Class;
private var BMP_Menu:Class;
public static var g_width:int;
public static var g_height:int;
public function koke(){
g_gamestate = null;
BMP_Font = koke_BMP_Font;
BMP_Char = koke_BMP_Char;
BMP_Menu = koke_BMP_Menu;
super();
g_width = 0x0200;
g_height = 384;
Hell.init(this, g_width, g_height);
load();
addEventListener(Event.ENTER_FRAME, main);
}
private function loop():void{
if (g_gamestate){
switch (g_gamestate.msg){
case GameState.MSG_NONE:
break;
case GameState.MSG_REQ_GAME:
g_gamestate = new GameMain();
break;
default:
Hell.write("Unknown msg at loop.");
};
} else {
g_gamestate = new GameMain();
Hell.write("Exec loop.\n");
};
g_gamestate.move();
g_gamestate.draw();
}
private function main(_arg1:Event):void{
loop();
Hell.update();
}
private function load():void{
var _local1:int;
Hell.loadTexture("font", new BMP_Font().bitmapData);
Hell.loadTexture("char", new BMP_Char().bitmapData);
Hell.loadTexture("menu", new BMP_Menu().bitmapData);
_local1 = MapChip.CHIP_SIZE;
Hell.divideGraphic("char", "CURSOR0", (_local1 * 1), (_local1 / 2), _local1, (_local1 / 2), false);
Hell.divideGraphic("char", "CURSOR1", (_local1 * 2), (_local1 / 2), _local1, (_local1 / 2), false);
Hell.divideGraphic("char", "CURSOR2", (_local1 * 3), (_local1 / 2), _local1, (_local1 / 2), false);
Hell.divideGraphic("char", "CURSOR3", (_local1 * 4), (_local1 / 2), _local1, (_local1 / 2), false);
Hell.divideGraphic("char", "BASE", (_local1 * 0), (_local1 / 2), _local1, (_local1 / 2));
Hell.divideGraphic("char", "GRASS1", 0, ((_local1 * 1) + (_local1 / 2)), _local1, (_local1 / 2));
Hell.divideGraphic("char", "GRASS2", 0, ((_local1 * 2) + (_local1 / 2)), _local1, (_local1 / 2));
Hell.divideGraphic("char", "GRASS3", 0, ((_local1 * 3) + (_local1 / 2)), _local1, (_local1 / 2));
Hell.divideGraphic("char", "GRASS4", 0, ((_local1 * 4) + (_local1 / 2)), _local1, (_local1 / 2));
Hell.divideGraphic("char", "MOVIE0", (_local1 * 1), (_local1 * 1), _local1, _local1);
Hell.divideGraphic("char", "MOVIE1", (_local1 * 2), (_local1 * 1), _local1, _local1);
Hell.divideGraphic("char", "MOVIE2", (_local1 * 3), (_local1 * 1), _local1, _local1);
Hell.divideGraphic("char", "MOVIE3", (_local1 * 4), (_local1 * 1), _local1, _local1);
Hell.divideGraphic("char", "FENCE0", (_local1 * 1), (_local1 * 2), _local1, _local1);
Hell.divideGraphic("char", "FENCE1", (_local1 * 2), (_local1 * 2), _local1, _local1);
Hell.divideGraphic("char", "FENCE2", (_local1 * 3), (_local1 * 2), _local1, _local1);
Hell.divideGraphic("char", "FENCE3", (_local1 * 4), (_local1 * 2), _local1, _local1);
Hell.divideGraphic("char", "SHADOW", (_local1 * 5), (_local1 / 2), _local1, (_local1 / 2), false);
Hell.divideGraphic("char", "RING", (_local1 * 6), (_local1 * 0), _local1, _local1, false);
Hell.divideGraphic("char", "NICOCHU0", (_local1 * 5), (_local1 * 1), _local1, _local1, false);
Hell.divideGraphic("char", "NICOCHU1", (_local1 * 5), (_local1 * 1), _local1, _local1, true);
Hell.divideGraphic("char", "NICOCHU2", (_local1 * 6), (_local1 * 1), _local1, _local1, false);
Hell.divideGraphic("char", "NICOCHU3", (_local1 * 6), (_local1 * 1), _local1, _local1, true);
Hell.divideGraphic("char", "UP_NUSHI0", (_local1 * 5), (_local1 * 5), _local1, _local1, false);
Hell.divideGraphic("char", "UP_NUSHI1", (_local1 * 5), (_local1 * 5), _local1, _local1, true);
Hell.divideGraphic("char", "UP_NUSHI2", (_local1 * 6), (_local1 * 5), _local1, _local1, false);
Hell.divideGraphic("char", "UP_NUSHI3", (_local1 * 6), (_local1 * 5), _local1, _local1, true);
Hell.divideGraphic("char", "ARASHI0", (_local1 * 5), (_local1 * 6), _local1, _local1, false);
Hell.divideGraphic("char", "ARASHI1", (_local1 * 5), (_local1 * 6), _local1, _local1, true);
Hell.divideGraphic("char", "ARASHI2", (_local1 * 6), (_local1 * 6), _local1, _local1, false);
Hell.divideGraphic("char", "ARASHI3", (_local1 * 6), (_local1 * 6), _local1, _local1, true);
Hell.divideGraphic("char", "ARASHI_EAT0", (_local1 * 5), (_local1 * 6), _local1, _local1, false);
Hell.divideGraphic("char", "ARASHI_EAT1", (_local1 * 5), (_local1 * 6), _local1, _local1, true);
Hell.divideGraphic("char", "ARASHI_EAT2", (_local1 * 6), (_local1 * 6), _local1, _local1, false);
Hell.divideGraphic("char", "ARASHI_EAT3", (_local1 * 6), (_local1 * 6), _local1, _local1, true);
Hell.divideGraphic("char", "SOWAKA0", (_local1 * 5), (_local1 * 2), _local1, _local1, false);
Hell.divideGraphic("char", "SOWAKA1", (_local1 * 5), (_local1 * 2), _local1, _local1, true);
Hell.divideGraphic("char", "SOWAKA2", (_local1 * 6), (_local1 * 2), _local1, _local1, false);
Hell.divideGraphic("char", "SOWAKA3", (_local1 * 6), (_local1 * 2), _local1, _local1, true);
Hell.divideGraphic("char", "SHAGEKI0", (_local1 * 7), (_local1 * 2), _local1, _local1, false);
Hell.divideGraphic("char", "SHAGEKI1", (_local1 * 7), (_local1 * 2), _local1, _local1, true);
Hell.divideGraphic("char", "SHAGEKI2", (_local1 * 8), (_local1 * 2), _local1, _local1, false);
Hell.divideGraphic("char", "SHAGEKI3", (_local1 * 8), (_local1 * 2), _local1, _local1, true);
Hell.divideGraphic("char", "RAINBOW_RAY0", (_local1 * 5), (_local1 * 3), _local1, _local1, false);
Hell.divideGraphic("char", "RAINBOW_RAY1", (_local1 * 5), (_local1 * 3), _local1, _local1, true);
Hell.divideGraphic("char", "RAINBOW_RAY2", (_local1 * 6), (_local1 * 3), _local1, _local1, false);
Hell.divideGraphic("char", "RAINBOW_RAY3", (_local1 * 6), (_local1 * 3), _local1, _local1, true);
Hell.divideGraphic("char", "EXPLODE0", (_local1 * 5), (_local1 * 4), _local1, _local1, false);
Hell.divideGraphic("char", "EXPLODE1", (_local1 * 6), (_local1 * 4), _local1, _local1, false);
Hell.divideGraphic("char", "EXPLODE2", (_local1 * 7), (_local1 * 4), _local1, _local1, false);
Hell.divideGraphic("char", "EXPLODE3", (_local1 * 8), (_local1 * 4), _local1, _local1, false);
Hell.write("resource loaded.\n");
}
}
}//package
Section 21
//koke_BMP_Char (koke_BMP_Char)
package {
import mx.core.*;
public class koke_BMP_Char extends BitmapAsset {
}
}//package
Section 22
//koke_BMP_Font (koke_BMP_Font)
package {
import mx.core.*;
public class koke_BMP_Font extends BitmapAsset {
}
}//package
Section 23
//koke_BMP_Menu (koke_BMP_Menu)
package {
import mx.core.*;
public class koke_BMP_Menu extends BitmapAsset {
}
}//package
Section 24
//Map (Map)
package {
public class Map {
public var draw_ofs_y:Number;
public var timer:int;
public var width:int;
public var movable_map:Array;
public var map:Array;
public var height:int;
public var gamemain:GameMain;
public var draw_ofs_x:Number;
public static const DRAW_CHIP_H:Number = 6;
public static const MOUSE_OFS_X:Number = 16;
public static const MOUSE_OFS_Y:Number = 18;
public static const DRAW_CHIP_W:Number = 12;
public static var MAP_GRASS_AFFECT:Number = 0.9;
public static var MOVIE_GRASS_FEED:Number = 200;
public static var MAP_REFRESH_INTERVAL:int = 10;
public static var MAP_BORDER_IS_WALL:Boolean = false;
public static var MAP_GRASS_AFFECT_LIMIT:Number = 0.3;
public function Map(_arg1:GameMain, _arg2:int, _arg3:int){
var _local4:int;
super();
this.gamemain = _arg1;
this.width = _arg2;
this.height = _arg3;
this.map = new Array();
this.movable_map = new Array();
_local4 = 0;
while (_local4 < (_arg2 * _arg3)) {
map[_local4] = new MapChip();
movable_map[_local4] = true;
_local4++;
};
this.draw_ofs_x = 0;
this.draw_ofs_y = 0;
timer = 0;
}
public function getGrass(_arg1:int, _arg2:int):Number{
var _local3:MapChip;
if (!inRange(_arg1, _arg2)){
return (0);
};
_local3 = toMap(_arg1, _arg2);
return (_local3.grass);
}
public function draw():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Number;
var _local8:Number;
MapChip.GRASS_COLOR_R = ConfigParser.getint("MAP_GRASS_COLOR_R");
MapChip.GRASS_COLOR_G = ConfigParser.getint("MAP_GRASS_COLOR_G");
MapChip.GRASS_COLOR_B = ConfigParser.getint("MAP_GRASS_COLOR_B");
_local1 = toRoundMapX(toMapX(0, 0));
_local2 = toRoundMapY(toMapY(gamemain.getScreenWidth(), 0));
_local3 = toRoundMapX((toMapX(gamemain.getScreenWidth(), gamemain.getScreenHeight()) + 2));
_local4 = toRoundMapY((toMapY(0, gamemain.getScreenHeight()) + 2));
_local5 = _local1;
while (_local5 < _local3) {
_local6 = _local2;
while (_local6 < _local4) {
_local7 = toViewX(_local5, _local6);
_local8 = toViewY(_local5, _local6);
if ((((((((_local7 < -32)) || ((_local8 < -32)))) || ((_local7 > (gamemain.getScreenWidth() + 32))))) || ((_local8 > (gamemain.getScreenHeight() + 32))))){
} else {
toMap(_local5, _local6).drawBase(_local7, _local8);
if (isMap(_local5, _local6, MapChip.TYPE.NONE)){
toMap(_local5, _local6).draw(_local7, _local8, ((timer / 5) % 4));
};
};
_local6++;
};
_local5++;
};
_local5 = _local1;
while (_local5 < _local3) {
_local6 = _local2;
while (_local6 < _local4) {
_local7 = toViewX(_local5, _local6);
_local8 = toViewY(_local5, _local6);
if ((((((((_local7 < -32)) || ((_local8 < -32)))) || ((_local7 > (gamemain.getScreenWidth() + 32))))) || ((_local8 > (gamemain.getScreenHeight() + 32))))){
} else {
if (!isMap(_local5, _local6, MapChip.TYPE.NONE)){
toMap(_local5, _local6).draw(_local7, _local8, ((timer / 5) % 4));
};
gamemain.charpool.drawAtMap(_local5, _local6);
};
_local6++;
};
_local5++;
};
}
public function update():void{
var _local1:Array;
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:MapChip;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:MapChip;
var _local11:Number;
timer++;
MAP_GRASS_AFFECT = ConfigParser.getfloat("MAP_GRASS_AFFECT");
MAP_REFRESH_INTERVAL = ConfigParser.getint("MAP_REFRESH_INTERVAL");
MOVIE_GRASS_FEED = ConfigParser.getfloat("MAP_MOVIE_GRASS_FEED");
MAP_GRASS_AFFECT_LIMIT = ConfigParser.getfloat("MAP_GRASS_AFFECT_LIMIT");
MAP_BORDER_IS_WALL = ConfigParser.getboolean("MAP_BORDER_IS_WALL");
_local1 = [-1, 0, 1, 0];
_local2 = [0, -1, 0, 1];
_local3 = 0;
while (_local3 < width) {
if ((timer % MAP_REFRESH_INTERVAL) != (_local3 % MAP_REFRESH_INTERVAL)){
} else {
_local4 = 0;
while (_local4 < height) {
_local5 = toMap(_local3, _local4);
if (isMap(_local3, _local4, MapChip.TYPE.NONE)){
_local6 = 0;
_local7 = 0;
while (_local7 < _local1.length) {
_local8 = (_local3 + _local1[_local7]);
_local9 = (_local4 + _local2[_local7]);
if (inRange(_local8, _local9)){
_local10 = toMap(_local8, _local9);
_local6 = (_local6 + _local10.grass);
};
_local7++;
};
_local6 = (_local6 / _local1.length);
if (_local5.grass < _local6){
_local11 = (_local6 - _local5.grass);
if (_local11 > MAP_GRASS_AFFECT_LIMIT){
_local11 = MAP_GRASS_AFFECT_LIMIT;
};
_local5.grass = (_local5.grass + _local11);
};
} else {
if (isMap(_local3, _local4, MapChip.TYPE.MOVIE)){
_local5.grass = MOVIE_GRASS_FEED;
};
};
_local4++;
};
};
_local3++;
};
updateMovableMap();
}
public function inRange(_arg1:int, _arg2:int):Boolean{
return ((((((((_arg1 >= 0)) && ((_arg2 >= 0)))) && ((_arg1 < width)))) && ((_arg2 < height))));
}
public function isMap(_arg1:int, _arg2:int, _arg3:int):Boolean{
var _local4:MapChip;
if (!inRange(_arg1, _arg2)){
return (false);
};
_local4 = toMap(_arg1, _arg2);
return ((_local4.type == _arg3));
}
public function toMapX(_arg1:int, _arg2:int):int{
return ((((((_arg1 - draw_ofs_x) - MOUSE_OFS_X) / DRAW_CHIP_W) + (((_arg2 - draw_ofs_y) - MOUSE_OFS_Y) / DRAW_CHIP_H)) / 2));
}
public function toViewX(_arg1:Number, _arg2:Number):Number{
return ((((_arg1 - _arg2) * DRAW_CHIP_W) + draw_ofs_x));
}
public function toViewY(_arg1:Number, _arg2:Number):Number{
return ((((_arg1 + _arg2) * DRAW_CHIP_H) + draw_ofs_y));
}
public function count(_arg1:int):int{
var _local2:int;
var _local3:MapChip;
_local2 = 0;
for each (_local3 in map) {
if (_local3.type == _arg1){
_local2++;
};
};
return (_local2);
}
public function toMapY(_arg1:int, _arg2:int):int{
return ((((((_arg2 - draw_ofs_y) - MOUSE_OFS_Y) / DRAW_CHIP_H) - (((_arg1 - draw_ofs_x) - MOUSE_OFS_X) / DRAW_CHIP_W)) / 2));
}
public function toMap(_arg1:int, _arg2:int):MapChip{
return (map[(_arg1 + (_arg2 * width))]);
}
public function set(_arg1:int, _arg2:int, _arg3:int):Boolean{
var _local4:MapChip;
if (!inRange(_arg1, _arg2)){
return (false);
};
_local4 = toMap(_arg1, _arg2);
_local4.type = _arg3;
_local4.grass = 0;
return (true);
}
public function getGrassLevel(_arg1:int, _arg2:int):int{
var _local3:MapChip;
if (!inRange(_arg1, _arg2)){
return (0);
};
_local3 = toMap(_arg1, _arg2);
return (_local3.getGrassLevel());
}
public function toRoundMapX(_arg1:int):int{
if (_arg1 < 0){
return (0);
};
if (_arg1 >= width){
return (width);
};
return (_arg1);
}
public function toRoundMapY(_arg1:int):int{
if (_arg1 < 0){
return (0);
};
if (_arg1 >= height){
return (height);
};
return (_arg1);
}
public function setGrass(_arg1:int, _arg2:int, _arg3:Number):Boolean{
var _local4:MapChip;
if (!inRange(_arg1, _arg2)){
return (false);
};
_local4 = toMap(_arg1, _arg2);
_local4.grass = _arg3;
return (true);
}
public function updateMovableMap():void{
var _local1:int;
var _local2:CharacterPool;
var _local3:*;
var _local4:int;
var _local5:Boolean;
var _local6:Vec3;
_local1 = 0;
while (_local1 < width) {
_local4 = 0;
while (_local4 < height) {
_local5 = true;
if (map[(_local1 + (_local4 * width))].type != MapChip.TYPE.NONE){
_local5 = false;
};
movable_map[(_local1 + (_local4 * width))] = _local5;
_local4++;
};
_local1++;
};
_local2 = gamemain.charpool;
for each (_local3 in _local2.actors) {
if (_local3.exist){
_local6 = _local3.getPosition();
if (((inRange(_local6.x, _local6.y)) && (_local3.isBlocking()))){
movable_map[(_local6.x + (_local6.y * width))] = false;
};
};
};
}
public function isMovable(_arg1:int, _arg2:int):Boolean{
if (inRange(_arg1, _arg2)){
return (movable_map[(_arg1 + (_arg2 * width))]);
};
return (!(MAP_BORDER_IS_WALL));
}
}
}//package
Section 25
//MapChip (MapChip)
package {
public class MapChip {
public var grass:Number;
public var type:int;
public static const TYPEDRAW_LOOP:int = 16;
public static const name:Array = ["NONE", "MOVIE", "FENCE"];
public static const CHIP_SIZE:int = 32;
public static var TYPE:Object = {NONE:0, CURSOR:0, MOVIE:1, FENCE:2};
public static var GRASS_COLOR_G:int = 128;
public static var GRASS_COLOR_R:int = 128;
public static var GRASS_COLOR_B:int = 128;
public function MapChip(){
init();
}
public function init():void{
grass = 0;
type = TYPE.NONE;
}
public function drawBase(_arg1:Number, _arg2:Number):void{
Hell.drawGraphic("BASE", _arg1, (_arg2 + (CHIP_SIZE / 2)));
}
public function draw(_arg1:Number, _arg2:Number, _arg3:int=0):void{
if (type == TYPE.NONE){
if (getGrassLevel() < 1){
return;
};
Hell.drawGraphic(("GRASS" + getGrassLevel()), _arg1, (_arg2 + (CHIP_SIZE / 2)));
} else {
Hell.drawGraphic((name[type] + _arg3), _arg1, _arg2);
};
}
public function getGrassLevel():int{
if (grass < 10){
return (0);
};
if (grass < 20){
return (1);
};
if (grass < 40){
return (2);
};
if (grass < 80){
return (3);
};
return (4);
}
public static function drawCursor(_arg1:Number, _arg2:Number, _arg3:int=0):void{
Hell.drawGraphic(("CURSOR" + _arg3), _arg1, (_arg2 + (CHIP_SIZE / 2)));
}
}
}//package
Section 26
//PlayChart (PlayChart)
package {
public class PlayChart {
public var gamemain:GameMain;
public var logs:Array;
private static const r:Array = [0, 0, 0, 0, 0, 0, 0xFF, 192];
private static const g:Array = [0, 0xFF, 0, 0, 0, 0, 0, 192];
public static const LOG_VIEW_WIDTH:int = 4;
public static const LOG_MAX:int = 160;
private static const b:Array = [0, 0, 0, 0, 0, 0xFF, 0, 192];
public function PlayChart(_arg1:GameMain){
logs = new Array(LOG_MAX);
this.gamemain = _arg1;
}
public function addChart(_arg1:CharacterPool, _arg2:Map):void{
var _local3:int;
var _local4:Log;
_local3 = 0;
while (_local3 < (logs.length - 1)) {
logs[_local3] = logs[(_local3 + 1)];
_local3++;
};
_local4 = new Log((Character.TYPE.MAX + 1));
_local3 = 0;
while (_local3 < _local4.length()) {
if (_local3 == Character.TYPE.NONE){
} else {
if (_local3 < Character.TYPE.MAX){
_local4.set(_local3, _arg1.count(_local3));
} else {
_local4.set(_local3, _arg2.count(MapChip.TYPE.MOVIE));
};
};
_local3++;
};
logs[(length - 1)] = _local4;
}
public function draw():void{
var _local1:Number;
var _local2:int;
var _local3:int;
if (!logs[(length - 1)]){
return;
};
_local1 = 2;
while (((gamemain.getScreenHeight() - 80) - (logs[(length - 1)].getMax() * _local1)) < 80) {
_local1 = (_local1 / 2);
};
_local2 = 0;
while (_local2 < (logs.length - 1)) {
if (((logs[_local2]) && (logs[(_local2 + 1)]))){
for (;_local3 < logs[_local2].param.length;_local3++) {
if ((((((r[_local3] == 0)) && ((g[_local3] == 0)))) && ((b[_local3] == 0)))){
continue;
};
};
};
_local2++;
};
}
}
}//package
class Log {
public var param:Array;
private function Log(_arg1:int){
param = new Array(_arg1);
}
public function set(_arg1:int, _arg2:Number):void{
param[_arg1] = _arg2;
}
public function length():int{
return (param.length);
}
public function getMax():Number{
var _local1:Number;
var _local2:Number;
_local1 = 0;
for each (_local2 in param) {
if (_local2 > _local1){
_local1 = _local2;
};
};
return (_local1);
}
}
Section 27
//Vec3 (Vec3)
package {
public class Vec3 {
public var x:Number;
public var y:Number;
public var z:Number;
public function Vec3(... _args){
var _local2:Vec3;
super();
if (_args.length == 0){
x = (y = (z = 0));
return;
};
if (_args.length == 3){
x = _args[0];
y = _args[1];
z = _args[2];
return;
};
if (_args.length == 1){
_local2 = _args[0];
x = _local2.x;
y = _local2.y;
z = _local2.z;
return;
};
if (_args.length == 2){
x = (_args[0] * Math.cos(_args[1]));
y = (_args[0] * Math.sin(_args[1]));
z = 0;
return;
};
}
public function opAdd(_arg1:Vec3):Vec3{
return (new Vec3((x + _arg1.x), (y + _arg1.y), (z + _arg1.z)));
}
public function opMul(_arg1){
var _local2:Vec3;
var _local3:Number;
if ((_arg1 is Vec3)){
_local2 = _arg1;
return ((((x * _local2.x) + (y * _local2.y)) + (z * _local2.z)));
};
_local3 = _arg1;
return (new Vec3((x * _local3), (y * _local3), (z * _local3)));
}
public function opDivAssign(_arg1:Number):void{
x = (x / _arg1);
y = (y / _arg1);
z = (z / _arg1);
}
public function opMulAssign(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
z = (z * _arg1);
}
public function atan2D(_arg1:Vec3=null):Number{
if (_arg1 == null){
return (Math.atan2(y, x));
};
return (Math.atan2((_arg1.y - y), (_arg1.x - x)));
}
public function opSubAssign(_arg1:Vec3):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
z = (z - _arg1.z);
}
public function blend(_arg1:Vec3, _arg2:Vec3, _arg3:Number):void{
x = ((_arg1.x * _arg3) + (_arg2.x * (1 - _arg3)));
y = ((_arg1.y * _arg3) + (_arg2.y * (1 - _arg3)));
z = ((_arg1.z * _arg3) + (_arg2.z * (1 - _arg3)));
}
public function opAddAssign(_arg1:Vec3):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
z = (z + _arg1.z);
}
public function toVector2D(_arg1:Number, _arg2:Number):void{
x = (_arg1 * Math.cos(_arg2));
y = (_arg1 * Math.sin(_arg2));
z = 0;
}
public function getIdentity():Vec3{
var _local1:Number;
_local1 = getDist();
return (new Vec3((x / _local1), (y / _local1), (z / _local1)));
}
public function getDistSqrt(_arg1:Vec3):Number{
var _local2:Number;
var _local3:Number;
_local2 = (_arg1.x - x);
_local3 = (_arg1.y - y);
return (((_local2 * _local2) + (_local3 * _local3)));
}
public function getDist(_arg1:Vec3=null):Number{
if (_arg1 == null){
return (Math.sqrt(((x * x) + (y * y))));
};
return (Math.sqrt(getDistSqrt(_arg1)));
}
public function opSub(_arg1:Vec3):Vec3{
return (new Vec3((x - _arg1.x), (y - _arg1.y), (z - _arg1.z)));
}
}
}//package