Section 1
//compareStringCaseInSensitive (de.polygonal.ds.sort.compare.compareStringCaseInSensitive)
package de.polygonal.ds.sort.compare {
public function compareStringCaseInSensitive(_arg1:String, _arg2:String):int{
var _local3:int;
var _local4:int;
var _local5:int;
_arg1 = _arg1.toLowerCase();
_arg2 = _arg2.toLowerCase();
if ((_arg1.length + _arg2.length) > 2){
_local3 = 0;
_local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length;
_local5 = 0;
while (_local5 < _local4) {
_local3 = (_arg1.charCodeAt(_local5) - _arg2.charCodeAt(_local5));
if (_local3 != 0){
break;
};
_local5++;
};
return (_local3);
} else {
};
return ((!NULL! - !NULL!));
}
}//package de.polygonal.ds.sort.compare
Section 2
//compareStringCaseInSensitiveDesc (de.polygonal.ds.sort.compare.compareStringCaseInSensitiveDesc)
package de.polygonal.ds.sort.compare {
public function compareStringCaseInSensitiveDesc(_arg1:String, _arg2:String):int{
var _local3:int;
var _local4:int;
var _local5:int;
_arg1 = _arg1.toLowerCase();
_arg2 = _arg2.toLowerCase();
if ((_arg1.length + _arg2.length) > 2){
_local3 = 0;
_local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length;
_local5 = 0;
while (_local5 < _local4) {
_local3 = (_arg2.charCodeAt(_local5) - _arg1.charCodeAt(_local5));
if (_local3 != 0){
break;
};
_local5++;
};
return (_local3);
} else {
};
return ((!NULL! - !NULL!));
}
}//package de.polygonal.ds.sort.compare
Section 3
//compareStringCaseSensitive (de.polygonal.ds.sort.compare.compareStringCaseSensitive)
package de.polygonal.ds.sort.compare {
public function compareStringCaseSensitive(_arg1:String, _arg2:String):int{
var _local3:int;
var _local4:int;
var _local5:int;
if ((_arg1.length + _arg2.length) > 2){
_local3 = 0;
_local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length;
_local5 = 0;
while (_local5 < _local4) {
_local3 = (_arg1.charCodeAt(_local5) - _arg2.charCodeAt(_local5));
if (_local3 != 0){
break;
};
_local5++;
};
return (_local3);
} else {
};
return ((!NULL! - !NULL!));
}
}//package de.polygonal.ds.sort.compare
Section 4
//compareStringCaseSensitiveDesc (de.polygonal.ds.sort.compare.compareStringCaseSensitiveDesc)
package de.polygonal.ds.sort.compare {
public function compareStringCaseSensitiveDesc(_arg1:String, _arg2:String):int{
var _local3:int;
var _local4:int;
var _local5:int;
if ((_arg1.length + _arg2.length) > 2){
_local3 = 0;
_local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length;
_local5 = 0;
while (_local5 < _local4) {
_local3 = (_arg2.charCodeAt(_local5) - _arg1.charCodeAt(_local5));
if (_local3 != 0){
break;
};
_local5++;
};
return (_local3);
} else {
};
return ((!NULL! - !NULL!));
}
}//package de.polygonal.ds.sort.compare
Section 5
//sLinkedInsertionSort (de.polygonal.ds.sort.sLinkedInsertionSort)
package de.polygonal.ds.sort {
import de.polygonal.ds.*;
public function sLinkedInsertionSort(_arg1:SListNode, _arg2:Boolean=false):SListNode{
var _local3:Array;
var _local4:int;
var _local5:SListNode;
var _local6:SListNode;
var _local7:int;
var _local8:Number;
var _local9:int;
_local3 = [];
_local4 = 0;
_local5 = _arg1;
_local6 = _arg1;
while (_local6) {
var _temp1 = _local4;
_local4 = (_local4 + 1);
var _local10 = _temp1;
_local3[_local10] = _local6.data;
_local6 = _local6.next;
};
if (_local4 <= 1){
return (_local5);
};
_local9 = 1;
while (_local9 < _local4) {
_local8 = _local3[_local9];
_local7 = _local9;
while ((((_local7 > 0)) && ((_local3[int((_local7 - 1))] > _local8)))) {
_local3[_local7] = _local3[int((_local7 - 1))];
_local7--;
};
_local3[_local7] = _local8;
_local9++;
};
_local6 = _local5;
_local9 = 0;
while (_local6) {
var _temp2 = _local9;
_local9 = (_local9 + 1);
_local6.data = _local3[_temp2];
_local6 = _local6.next;
};
return (_local5);
}
}//package de.polygonal.ds.sort
Section 6
//sLinkedInsertionSortCmp (de.polygonal.ds.sort.sLinkedInsertionSortCmp)
package de.polygonal.ds.sort {
import de.polygonal.ds.*;
public function sLinkedInsertionSortCmp(_arg1:SListNode, _arg2:Function, _arg3:Boolean=false):SListNode{
var _local4:Array;
var _local5:int;
var _local6:SListNode;
var _local7:SListNode;
var _local8:int;
var _local9:int;
var _local10:*;
_local4 = [];
_local5 = 0;
_local6 = _arg1;
_local7 = _arg1;
while (_local7) {
var _temp1 = _local5;
_local5 = (_local5 + 1);
var _local11 = _temp1;
_local4[_local11] = _local7.data;
_local7 = _local7.next;
};
if (_arg3){
if (_local5 <= 1){
return (_local6);
};
_local9 = 1;
while (_local9 < _local5) {
_local10 = _local4[_local9];
_local8 = _local9;
while ((((_local8 > 0)) && ((_arg2(_local4[int((_local8 - 1))], _local10) < 0)))) {
_local4[_local8] = _local4[int((_local8 - 1))];
_local8--;
};
_local4[_local8] = _local10;
_local9++;
};
} else {
if (_local5 <= 1){
return (_local6);
};
_local9 = 1;
while (_local9 < _local5) {
_local10 = _local4[_local9];
_local8 = _local9;
while ((((_local8 > 0)) && ((_arg2(_local4[int((_local8 - 1))], _local10) > 0)))) {
_local4[_local8] = _local4[int((_local8 - 1))];
_local8--;
};
_local4[_local8] = _local10;
_local9++;
};
};
_local7 = _local6;
_local9 = 0;
while (_local7) {
var _temp2 = _local9;
_local9 = (_local9 + 1);
_local7.data = _local4[_temp2];
_local7 = _local7.next;
};
return (_local6);
}
}//package de.polygonal.ds.sort
Section 7
//sLinkedMergeSort (de.polygonal.ds.sort.sLinkedMergeSort)
package de.polygonal.ds.sort {
import de.polygonal.ds.*;
public function sLinkedMergeSort(_arg1:SListNode, _arg2:Boolean=false):SListNode{
var _local3:SListNode;
var _local4:SListNode;
var _local5:SListNode;
var _local6:SListNode;
var _local7:SListNode;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
if (!_arg1){
return (null);
};
_local3 = _arg1;
_local8 = 1;
if (_arg2){
while (true) {
_local4 = _local3;
_local7 = null;
_local3 = _local7;
_local9 = 0;
while (_local4) {
_local9++;
_local12 = 0;
_local10 = 0;
_local5 = _local4;
while (_local12 < _local8) {
_local10++;
_local5 = _local5.next;
if (!_local5){
break;
};
_local12++;
};
_local11 = _local8;
while ((((_local10 > 0)) || ((((_local11 > 0)) && (_local5))))) {
if (_local10 == 0){
_local6 = _local5;
_local5 = _local5.next;
_local11--;
} else {
if ((((_local11 == 0)) || (!(_local5)))){
_local6 = _local4;
_local4 = _local4.next;
_local10--;
} else {
if ((_local4.data - _local5.data) >= 0){
_local6 = _local4;
_local4 = _local4.next;
_local10--;
} else {
_local6 = _local5;
_local5 = _local5.next;
_local11--;
};
};
};
if (_local7){
_local7.next = _local6;
} else {
_local3 = _local6;
};
_local7 = _local6;
};
_local4 = _local5;
};
_local7.next = null;
if (_local9 <= 1){
return (_local3);
};
_local8 = (_local8 << 1);
};
} else {
while (true) {
_local4 = _local3;
_local7 = null;
_local3 = _local7;
_local9 = 0;
while (_local4) {
_local9++;
_local12 = 0;
_local10 = 0;
_local5 = _local4;
while (_local12 < _local8) {
_local10++;
_local5 = _local5.next;
if (!_local5){
break;
};
_local12++;
};
_local11 = _local8;
while ((((_local10 > 0)) || ((((_local11 > 0)) && (_local5))))) {
if (_local10 == 0){
_local6 = _local5;
_local5 = _local5.next;
_local11--;
} else {
if ((((_local11 == 0)) || (!(_local5)))){
_local6 = _local4;
_local4 = _local4.next;
_local10--;
} else {
if ((_local4.data - _local5.data) <= 0){
_local6 = _local4;
_local4 = _local4.next;
_local10--;
} else {
_local6 = _local5;
_local5 = _local5.next;
_local11--;
};
};
};
if (_local7){
_local7.next = _local6;
} else {
_local3 = _local6;
};
_local7 = _local6;
};
_local4 = _local5;
};
_local7.next = null;
if (_local9 <= 1){
return (_local3);
};
_local8 = (_local8 << 1);
};
};
return (null);
}
}//package de.polygonal.ds.sort
Section 8
//sLinkedMergeSortCmp (de.polygonal.ds.sort.sLinkedMergeSortCmp)
package de.polygonal.ds.sort {
import de.polygonal.ds.*;
public function sLinkedMergeSortCmp(_arg1:SListNode, _arg2:Function, _arg3:Boolean=false):SListNode{
var _local4:SListNode;
var _local5:SListNode;
var _local6:SListNode;
var _local7:SListNode;
var _local8:SListNode;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
if (((!(_arg1)) || ((_arg2 == null)))){
return (null);
};
_local4 = _arg1;
_local9 = 1;
if (_arg3){
while (true) {
_local5 = _local4;
_local8 = null;
_local4 = _local8;
_local10 = 0;
while (_local5) {
_local10++;
_local13 = 0;
_local11 = 0;
_local6 = _local5;
while (_local13 < _local9) {
_local11++;
_local6 = _local6.next;
if (!_local6){
break;
};
_local13++;
};
_local12 = _local9;
while ((((_local11 > 0)) || ((((_local12 > 0)) && (_local6))))) {
if (_local11 == 0){
_local7 = _local6;
_local6 = _local6.next;
_local12--;
} else {
if ((((_local12 == 0)) || (!(_local6)))){
_local7 = _local5;
_local5 = _local5.next;
_local11--;
} else {
if (_arg2(_local5.data, _local6.data) >= 0){
_local7 = _local5;
_local5 = _local5.next;
_local11--;
} else {
_local7 = _local6;
_local6 = _local6.next;
_local12--;
};
};
};
if (_local8){
_local8.next = _local7;
} else {
_local4 = _local7;
};
_local8 = _local7;
};
_local5 = _local6;
};
_local8.next = null;
if (_local10 <= 1){
return (_local4);
};
_local9 = (_local9 << 1);
};
} else {
while (true) {
_local5 = _local4;
_local8 = null;
_local4 = _local8;
_local10 = 0;
while (_local5) {
_local10++;
_local13 = 0;
_local11 = 0;
_local6 = _local5;
while (_local13 < _local9) {
_local11++;
_local6 = _local6.next;
if (!_local6){
break;
};
_local13++;
};
_local12 = _local9;
while ((((_local11 > 0)) || ((((_local12 > 0)) && (_local6))))) {
if (_local11 == 0){
_local7 = _local6;
_local6 = _local6.next;
_local12--;
} else {
if ((((_local12 == 0)) || (!(_local6)))){
_local7 = _local5;
_local5 = _local5.next;
_local11--;
} else {
if (_arg2(_local5.data, _local6.data) <= 0){
_local7 = _local5;
_local5 = _local5.next;
_local11--;
} else {
_local7 = _local6;
_local6 = _local6.next;
_local12--;
};
};
};
if (_local8){
_local8.next = _local7;
} else {
_local4 = _local7;
};
_local8 = _local7;
};
_local5 = _local6;
};
_local8.next = null;
if (_local10 <= 1){
return (_local4);
};
_local9 = (_local9 << 1);
};
};
return (null);
}
}//package de.polygonal.ds.sort
Section 9
//Collection (de.polygonal.ds.Collection)
package de.polygonal.ds {
public interface Collection {
function isEmpty():Boolean;
function getIterator():Iterator;
function get size():int;
function clear():void;
function toArray():Array;
function contains(_arg1):Boolean;
}
}//package de.polygonal.ds
Section 10
//Iterator (de.polygonal.ds.Iterator)
package de.polygonal.ds {
public interface Iterator {
function start():void;
function next();
function set data(_arg1):void;
function get data();
function hasNext():Boolean;
}
}//package de.polygonal.ds
Section 11
//LinkedListNode (de.polygonal.ds.LinkedListNode)
package de.polygonal.ds {
public interface LinkedListNode {
}
}//package de.polygonal.ds
Section 12
//SLinkedList (de.polygonal.ds.SLinkedList)
package de.polygonal.ds {
import de.polygonal.ds.sort.compare.*;
import de.polygonal.ds.sort.*;
public class SLinkedList implements Collection {
private var _count:int;
public var tail:SListNode;
public var head:SListNode;
public static const MERGE_SORT:int = (1 << 2);
public static const DESCENDING:int = (1 << 4);
public static const NUMERIC:int = (1 << 3);
public static const INSERTION_SORT:int = (1 << 1);
public function SLinkedList(... _args){
head = (tail = null);
_count = 0;
if (_args.length > 0){
append.apply(this, _args);
};
}
public function isEmpty():Boolean{
return ((_count == 0));
}
public function remove(_arg1:SListIterator):Boolean{
var _local2:SListNode;
if (((!((_arg1.list == this))) || (!(_arg1.node)))){
return (false);
};
_local2 = head;
if (_arg1.node == head){
_arg1.forth();
removeHead();
return (true);
};
while (_local2.next != _arg1.node) {
_local2 = _local2.next;
};
_arg1.forth();
if (_local2.next == tail){
tail = _local2;
};
_local2.next = _arg1.node;
_count--;
return (true);
}
public function get size():int{
return (_count);
}
public function removeHead(){
var _local1:*;
var _local2:SListNode;
if (head){
_local1 = head.data;
if (head == tail){
head = (tail = null);
} else {
_local2 = head;
head = head.next;
_local2.next = null;
if (head == null){
tail = null;
};
};
_count--;
return (_local1);
};
return (null);
}
public function clear():void{
var _local1:SListNode;
var _local2:SListNode;
_local1 = head;
head = null;
while (_local1) {
_local2 = _local1.next;
_local1.next = null;
_local1 = _local2;
};
_count = 0;
}
public function prepend(... _args):SListNode{
var _local2:int;
var _local3:SListNode;
var _local4:SListNode;
var _local5:int;
_local2 = _args.length;
_local3 = new SListNode(_args[int((_local2 - 1))]);
if (head){
_local3.next = head;
head = _local3;
} else {
head = (tail = _local3);
};
if (_local2 > 1){
_local4 = _local3;
_local5 = (_local2 - 2);
while (_local5 >= 0) {
_local3 = new SListNode(_args[_local5]);
_local3.next = head;
head = _local3;
_local5--;
};
_count = (_count + _local2);
return (_local4);
};
_count++;
return (_local3);
}
public function popDown():void{
var _local1:SListNode;
var _local2:SListNode;
_local1 = tail;
if (head.next == tail){
tail = head;
head = _local1;
tail.next = null;
head.next = tail;
} else {
_local2 = head;
while (_local2.next != tail) {
_local2 = _local2.next;
};
tail = _local2;
tail.next = null;
_local1.next = head;
head = _local1;
};
}
public function concat(... _args):SLinkedList{
var _local2:SLinkedList;
var _local3:SLinkedList;
var _local4:SListNode;
var _local5:int;
var _local6:int;
_local2 = new SLinkedList();
_local4 = head;
while (_local4) {
_local2.append(_local4.data);
_local4 = _local4.next;
};
_local5 = _args.length;
_local6 = 0;
while (_local6 < _local5) {
_local3 = _args[_local6];
_local4 = _local3.head;
while (_local4) {
_local2.append(_local4.data);
_local4 = _local4.next;
};
_local6++;
};
return (_local2);
}
public function append(... _args):SListNode{
var _local2:int;
var _local3:SListNode;
var _local4:SListNode;
var _local5:int;
_local2 = _args.length;
_local3 = new SListNode(_args[0]);
if (head){
tail.next = _local3;
tail = _local3;
} else {
head = (tail = _local3);
};
if (_local2 > 1){
_local4 = _local3;
_local5 = 1;
while (_local5 < _local2) {
_local3 = new SListNode(_args[_local5]);
tail.next = _local3;
tail = _local3;
_local5++;
};
_count = (_count + _local2);
return (_local4);
};
_count++;
return (_local3);
}
public function sort(... _args):void{
var _local2:int;
var _local3:Function;
var _local4:*;
if (_count <= 1){
return;
};
if (_args.length > 0){
_local2 = 0;
_local3 = null;
_local4 = _args[0];
if ((_local4 is Function)){
_local3 = _local4;
if (_args.length > 1){
_local4 = _args[1];
if ((_local4 is int)){
_local2 = _local4;
};
};
} else {
if ((_local4 is int)){
_local2 = _local4;
};
};
if (Boolean(_local3)){
if ((_local2 & 2)){
head = sLinkedInsertionSortCmp(head, _local3, (_local2 == 18));
} else {
head = sLinkedMergeSortCmp(head, _local3, (_local2 == 16));
};
} else {
if ((_local2 & 2)){
if ((_local2 & 4)){
if (_local2 == 22){
head = sLinkedInsertionSortCmp(head, compareStringCaseSensitiveDesc);
} else {
if (_local2 == 14){
head = sLinkedInsertionSortCmp(head, compareStringCaseInSensitive);
} else {
if (_local2 == 30){
head = sLinkedInsertionSortCmp(head, compareStringCaseInSensitiveDesc);
} else {
head = sLinkedInsertionSortCmp(head, compareStringCaseSensitive);
};
};
};
} else {
head = sLinkedInsertionSort(head, (_local2 == 18));
};
} else {
if ((_local2 & 4)){
if (_local2 == 20){
head = sLinkedMergeSortCmp(head, compareStringCaseSensitiveDesc);
} else {
if (_local2 == 12){
head = sLinkedMergeSortCmp(head, compareStringCaseInSensitive);
} else {
if (_local2 == 28){
head = sLinkedMergeSortCmp(head, compareStringCaseInSensitiveDesc);
} else {
head = sLinkedMergeSortCmp(head, compareStringCaseSensitive);
};
};
};
} else {
if ((_local2 & 16)){
head = sLinkedMergeSort(head, true);
};
};
};
};
} else {
head = sLinkedMergeSort(head);
};
}
public function contains(_arg1):Boolean{
var _local2:SListNode;
_local2 = head;
while (_local2) {
if (_local2.data == _arg1){
return (true);
};
_local2 = _local2.next;
};
return (false);
}
public function reverse():void{
var _local1:Array;
var _local2:int;
var _local3:SListNode;
if (_count == 0){
return;
};
_local1 = new Array(_count);
_local2 = 0;
_local3 = head;
while (_local3) {
var _temp1 = _local2;
_local2 = (_local2 + 1);
var _local4 = _temp1;
_local1[_local4] = _local3;
_local3 = _local3.next;
};
_local1.reverse();
_local3 = (head = _local1[0]);
_local2 = 1;
while (_local2 < _count) {
_local3 = (_local3.next = _local1[_local2]);
_local2++;
};
_local3.next = null;
tail = _local3;
_local1 = null;
}
public function insertAfter(_arg1:SListIterator, _arg2):SListNode{
var _local3:SListNode;
if (_arg1.list != this){
return (null);
};
if (_arg1.node){
_local3 = new SListNode(_arg2);
_arg1.node.insertAfter(_local3);
if (_arg1.node == tail){
tail = _arg1.node.next;
};
_count++;
return (_local3);
//unresolved jump
};
return (append(_arg2));
}
public function getIterator():Iterator{
return (new SListIterator(this, head));
}
public function toArray():Array{
var _local1:Array;
var _local2:SListNode;
_local1 = [];
_local2 = head;
while (_local2) {
_local1.push(_local2.data);
_local2 = _local2.next;
};
return (_local1);
}
public function getListIterator():SListIterator{
return (new SListIterator(this, head));
}
public function join(_arg1):String{
var _local2:String;
var _local3:SListNode;
if (_count == 0){
return ("");
};
_local2 = "";
_local3 = head;
while (_local3.next) {
_local2 = (_local2 + (_local3.data + _arg1));
_local3 = _local3.next;
};
_local2 = (_local2 + _local3.data);
return (_local2);
}
public function toString():String{
return ((("[SlinkedList, size=" + size) + "]"));
}
public function removeTail(){
var _local1:*;
var _local2:SListNode;
if (tail){
_local1 = tail.data;
if (head == tail){
head = (tail = null);
} else {
_local2 = head;
while (_local2.next != tail) {
_local2 = _local2.next;
};
tail = _local2;
_local2.next = null;
};
_count--;
return (_local1);
};
return (null);
}
public function merge(... _args):void{
var _local2:SLinkedList;
var _local3:int;
var _local4:int;
if (_args.length == 0){
return;
};
_local2 = _args[0];
if (head){
tail.next = _local2.head;
tail = _local2.tail;
} else {
head = _local2.head;
tail = _local2.tail;
};
_count = (_count + _local2.size);
_local3 = _args.length;
_local4 = 1;
while (_local4 < _local3) {
_local2 = _args[_local4];
tail.next = _local2.head;
tail = _local2.tail;
_count = (_count + _local2.size);
_local4++;
};
}
public function nodeOf(_arg1, _arg2:SListIterator=null):SListIterator{
var _local3:SListNode;
if (_arg2 != null){
if (_arg2.list != null){
return (null);
};
};
_local3 = ((_arg2)==null) ? head : _arg2.node;
while (_local3) {
if (_local3.data === _arg1){
return (new SListIterator(this, _local3));
};
_local3 = _local3.next;
};
return (null);
}
public function dump():String{
var _local1:String;
var _local2:SListIterator;
if (!head){
return ("SLinkedList: (empty)");
};
_local1 = (((("SLinkedList: has " + _count) + " node") + ((_count == 1)) ? "" : "s") + "\n|< Head\n");
_local2 = getListIterator();
while (_local2.valid()) {
_local1 = (_local1 + (("\t" + _local2.data) + "\n"));
_local2.forth();
};
_local1 = (_local1 + "Tail >|");
return (_local1);
}
public function splice(_arg1:SListIterator, _arg2:uint=4294967295, ... _args):SLinkedList{
var _local4:SListNode;
var _local5:SListNode;
var _local6:SLinkedList;
var _local7:int;
var _local8:int;
var _local9:SListNode;
if (_arg1){
if (_arg1.list != this){
return (null);
};
};
if (_arg1.node){
_local4 = _arg1.node;
_local5 = head;
while (_local5.next != _local4) {
_local5 = _local5.next;
};
_local6 = new SLinkedList();
if (_arg2 == 4294967295){
if (_arg1.node == tail){
return (_local6);
};
while (_arg1.node) {
_local6.append(_arg1.node.data);
_arg1.remove();
};
_arg1.list = _local6;
_arg1.node = _local4;
return (_local6);
} else {
_local7 = 0;
while (_local7 < _arg2) {
if (_arg1.node){
_local6.append(_arg1.node.data);
_arg1.remove();
} else {
break;
};
_local7++;
};
};
_local8 = _args.length;
if (_local8 > 0){
if (_count == 0){
_local7 = 0;
while (_local7 < _local8) {
append(_args[_local7]);
_local7++;
};
} else {
if (_local5 == null){
_local9 = prepend(_args[0]);
_local7 = 1;
while (_local7 < _local8) {
_local9.insertAfter(new SListNode(_args[_local7]));
if (_local9 == tail){
tail = _local9.next;
};
_local9 = _local9.next;
_count++;
_local7++;
};
} else {
_local9 = _local5;
_local7 = 0;
while (_local7 < _local8) {
_local9.insertAfter(new SListNode(_args[_local7]));
if (_local9 == tail){
tail = _local9.next;
};
_local9 = _local9.next;
_count++;
_local7++;
};
};
};
_arg1.node = _local9;
} else {
_arg1.node = _local4;
};
_arg1.list = _local6;
return (_local6);
};
return (null);
}
public function shiftUp():void{
var _local1:SListNode;
_local1 = head;
if (head.next == tail){
head = tail;
tail = _local1;
tail.next = null;
head.next = tail;
} else {
head = head.next;
tail.next = _local1;
_local1.next = null;
tail = _local1;
};
}
}
}//package de.polygonal.ds
Section 13
//SListIterator (de.polygonal.ds.SListIterator)
package de.polygonal.ds {
public class SListIterator implements Iterator {
public var node:SListNode;
public var list:SLinkedList;
public function SListIterator(_arg1:SLinkedList=null, _arg2:SListNode=null){
this.list = _arg1;
this.node = _arg2;
}
public function remove():Boolean{
return (list.remove(this));
}
public function start():void{
if (list){
node = list.head;
};
}
public function get data(){
if (node){
return (node.data);
};
return (null);
}
public function next(){
var _local1:*;
if (hasNext()){
_local1 = node.data;
node = node.next;
return (_local1);
};
return (null);
}
public function forth():void{
if (node){
node = node.next;
};
}
public function hasNext():Boolean{
return (Boolean(node));
}
public function toString():String{
return ((("{SListIterator: data=" + node.data) + "}"));
}
public function valid():Boolean{
return (Boolean(node));
}
public function set data(_arg1):void{
node.data = _arg1;
}
public function end():void{
if (list){
node = list.tail;
};
}
}
}//package de.polygonal.ds
Section 14
//SListNode (de.polygonal.ds.SListNode)
package de.polygonal.ds {
public class SListNode implements LinkedListNode {
public var next:SListNode;
public var data;
public function SListNode(_arg1){
data = _arg1;
next = null;
}
public function insertAfter(_arg1:SListNode):void{
_arg1.next = next;
next = _arg1;
}
public function toString():String{
return ((("[SListNode, data=" + data) + "]"));
}
}
}//package de.polygonal.ds
Section 15
//LineParticle (physics.LineParticle)
package physics {
public class LineParticle extends Particle {
private var spring:Spring;
public var p2:Particle;
public function LineParticle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean=false){
super(_arg1, _arg2, _arg5);
p2 = new Particle(_arg3, _arg4, _arg5);
this.spring = new Spring(this, p2);
}
override public function toString():String{
return ((((((((((((("[LineParticle x: " + x) + ", y: ") + y) + ", ox: ") + ox) + ", oy: ") + oy) + ", x2: ") + p2.x) + ", y2: ") + p2.y) + "]"));
}
override function simulate():void{
var _local1:Number;
var _local2:Number;
if (((engine) && (!(fixed)))){
_local1 = ox;
_local2 = oy;
ox = x;
oy = y;
x = (x + (((x - _local1) * engine.drag) + engine.gravity.x));
y = (y + (((y - _local2) * engine.drag) + engine.gravity.y));
p2.simulate();
spring.simulate();
};
}
}
}//package physics
Section 16
//LineParticleConstraint (physics.LineParticleConstraint)
package physics {
public class LineParticleConstraint extends Spring {
private var lineNY:Number;
public var radius:Number;
private var pushB:Pusher;
private var pushA:Pusher;
public var p:Particle;
private var lineTX:Number;
private var lineTY:Number;
public var l:LineParticle;
private var lineNX:Number;
private static const SAMPLES:int = 4;
public function LineParticleConstraint(_arg1:Particle, _arg2:LineParticle, _arg3:Number=1){
var _local4:Number;
var _local5:Number;
var _local6:Number;
super(_arg1, _arg1);
if (_arg3 < 1){
_arg3 = 1;
};
this.p = _arg1;
this.l = _arg2;
this.radius = _arg3;
_local4 = (_arg2.p2.x - _arg2.x);
_local5 = (_arg2.p2.y - _arg2.y);
_local6 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
_local4 = (_local4 / _local6);
_local5 = (_local5 / _local6);
lineNX = _local5;
lineNY = -(_local4);
lineTX = _local4;
lineTY = _local5;
pushA = new Pusher(_arg1, _arg2, _arg3);
pushB = new Pusher(_arg1, _arg2.p2, _arg3);
}
override function setEngine(_arg1:ParticleEngine):void{
if (_arg1 == null){
engine.removeSpring(pushA);
engine.removeSpring(pushB);
} else {
_arg1.addSpring(pushA);
_arg1.addSpring(pushB);
};
super.setEngine(_arg1);
}
override function simulate():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
if (engine){
pushA.simulate();
pushB.simulate();
_local1 = p.ox;
_local2 = p.oy;
_local3 = (p.x - p.ox);
_local4 = (p.y - p.oy);
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
_local3 = (_local3 / _local5);
_local4 = (_local4 / _local5);
_local6 = 0;
while (_local6 <= 1) {
_local1 = (_local1 + (_local3 * _local6));
_local2 = (_local2 + (_local4 * _local6));
if ((((((lineTX * (_local1 - l.x)) + (lineTY * (_local2 - l.y))) >= 0)) && ((((-(lineTX) * (_local1 - l.p2.x)) + (-(lineTY) * (_local2 - l.p2.y))) >= 0)))){
_local7 = (l.x - _local1);
_local8 = (l.y - _local2);
_local9 = ((lineNX * _local7) + (lineNY * _local8));
_local10 = (lineNX * _local9);
_local11 = (lineNY * _local9);
_local12 = ((_local10 * _local10) + (_local11 * _local11));
if (_local12 < (radius * radius)){
_local12 = Math.sqrt(_local12);
_local10 = (_local10 / _local12);
_local11 = (_local11 / _local12);
_local13 = -((((p.x - p.ox) * lineNX) + ((p.y - p.oy) * lineNY)));
p.ox = (p.ox - (_local13 * lineNX));
p.oy = (p.oy - (_local13 * lineNY));
p.x = (_local1 - (_local10 * (radius - _local12)));
p.y = (_local2 - (_local11 * (radius - _local12)));
break;
};
};
_local6 = (_local6 + (1 / SAMPLES));
};
};
}
override public function toString():String{
return ((((((("[LineParticleConstraint p: " + p.toString()) + ", l: ") + l.toString()) + ", radius: ") + radius) + "]"));
}
override public function setRope(_arg1:Boolean):void{
}
override public function equals(_arg1:Spring):Boolean{
return ((((((_arg1 is LineParticleConstraint)) && (p.equals(LineParticleConstraint(_arg1).p)))) && (l.equals(LineParticleConstraint(_arg1).l))));
}
}
}//package physics
Section 17
//Particle (physics.Particle)
package physics {
public class Particle {
protected var engine:ParticleEngine;
public var ox:Number;
public var oy:Number;
public var fixed:Boolean;
public var x:Number;
public var y:Number;
public function Particle(_arg1:Number, _arg2:Number, _arg3:Boolean=false){
this.x = (this.ox = _arg1);
this.y = (this.oy = _arg2);
this.fixed = _arg3;
}
function setEngine(_arg1:ParticleEngine):void{
engine = _arg1;
}
public function toString():String{
return ((((((((("[Particle x: " + x) + ", y: ") + y) + ", ox: ") + ox) + ", oy: ") + oy) + "]"));
}
function simulate():void{
var _local1:Number;
var _local2:Number;
if (((engine) && (!(fixed)))){
_local1 = ox;
_local2 = oy;
ox = x;
oy = y;
x = (x + (((x - _local1) * engine.drag) + engine.gravity.x));
y = (y + (((y - _local2) * engine.drag) + engine.gravity.y));
};
}
public function equals(_arg1:Particle):Boolean{
return ((((((((x == _arg1.x)) && ((y == _arg1.y)))) && ((ox == _arg1.ox)))) && ((oy == _arg1.oy))));
}
}
}//package physics
Section 18
//ParticleEngine (physics.ParticleEngine)
package physics {
import flash.events.*;
import flash.display.*;
public class ParticleEngine {
private var particleList:Array;
private var springList:Array;
public var gravity:Vector;
public var drag:Number;// = 0.98
public var iterations:int;// = 1
public function ParticleEngine(){
iterations = 1;
drag = 0.98;
gravity = new Vector(0, 1);
super();
particleList = [];
springList = [];
}
public function render(_arg1:Graphics):void{
var _local2:Particle;
var _local3:Spring;
for each (_local2 in particleList) {
_arg1.drawCircle(_local2.x, _local2.y, 3);
};
for each (_local3 in springList) {
_arg1.moveTo(_local3.p0.x, _local3.p0.y);
_arg1.lineTo(_local3.p1.x, _local3.p1.y);
};
}
public function removeParticle(_arg1:Particle):Particle{
var _local2:Particle;
var _local3:int;
var _local4:int;
_local4 = particleList.length;
while (_local3 < _local4) {
_local2 = particleList[_local3];
if (_arg1.equals(_local2)){
_local2.setEngine(null);
particleList.splice(_local3, 1);
return (_local2);
};
_local3++;
};
return (null);
}
public function removeSpring(_arg1:Spring):Spring{
var _local2:Spring;
var _local3:int;
var _local4:int;
_local3 = 0;
_local4 = springList.length;
while (_local3 < _local4) {
_local2 = springList[_local3];
if (_arg1.equals(_local2)){
_local2.setEngine(null);
springList.splice(_local3, 1);
return (_local2);
};
_local3++;
};
return (null);
}
public function addSpring(_arg1:Spring):Spring{
_arg1.setEngine(this);
springList.push(_arg1);
return (_arg1);
}
public function main(_arg1:Event):void{
var _local2:Particle;
var _local3:int;
var _local4:Spring;
for each (_local2 in particleList) {
_local2.simulate();
};
_local3 = 0;
while (_local3 < iterations) {
for each (_local4 in springList) {
_local4.simulate();
};
_local3++;
};
}
public function removeLPC(_arg1:LineParticle):void{
var _local2:Spring;
var _local3:int;
var _local4:int;
_local3 = 0;
_local4 = springList.length;
while (_local3 < _local4) {
_local2 = springList[_local3];
if ((((_local2 is LineParticleConstraint)) && (LineParticleConstraint(_local2).l.equals(_arg1)))){
springList.splice(_local3, 1);
_local2.setEngine(null);
return;
};
_local3++;
};
}
public function addParticle(_arg1:Particle):Particle{
_arg1.setEngine(this);
particleList.push(_arg1);
return (_arg1);
}
}
}//package physics
Section 19
//Pusher (physics.Pusher)
package physics {
public class Pusher extends Spring {
private var dist:Number;
public function Pusher(_arg1:Particle, _arg2:Particle, _arg3:Number){
super(_arg1, _arg2);
this.dist = _arg3;
}
override function simulate():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
if (engine){
_local1 = (p1.x - p0.x);
_local2 = (p1.y - p0.y);
_local3 = ((_local1 * _local1) + (_local2 * _local2));
if (_local3 < (dist * dist)){
_local3 = Math.sqrt(_local3);
if (_local3 == 0){
_local3 = 1E-5;
};
_local3 = ((_local3 - dist) / _local3);
_local1 = (_local1 * (_local3 * 0.5));
_local2 = (_local2 * (_local3 * 0.5));
if (!p0.fixed){
p0.x = (p0.x + _local1);
p0.y = (p0.y + _local2);
};
if (!p1.fixed){
p1.x = (p1.x - _local1);
p1.y = (p1.y - _local2);
};
};
};
}
override public function toString():String{
return ((((((((("[Pusher p0: " + p0.toString()) + ", p1: ") + p1.toString()) + ", relax: ") + relax) + ", dist: ") + dist) + "]"));
}
override public function setRope(_arg1:Boolean):void{
}
}
}//package physics
Section 20
//Spring (physics.Spring)
package physics {
public class Spring {
public var p0:Particle;
public var p1:Particle;
protected var engine:ParticleEngine;
protected var relax:Number;
protected var rope:Boolean;
public function Spring(_arg1:Particle, _arg2:Particle, _arg3:Number=-1){
this.p0 = _arg1;
this.p1 = _arg2;
this.rope = false;
if (_arg3 < 0){
this.relax = Math.sqrt((Math.pow((_arg1.x - _arg2.x), 2) + Math.pow((_arg1.y - _arg2.y), 2)));
} else {
this.relax = _arg3;
};
}
function simulate():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
if (engine){
_local1 = (p1.x - p0.x);
_local2 = (p1.y - p0.y);
_local3 = ((_local1 * _local1) + (_local2 * _local2));
if (((!(rope)) || ((_local3 > (relax * relax))))){
_local3 = Math.sqrt(_local3);
if (_local3 == 0){
_local3 = 1E-5;
};
_local3 = ((_local3 - relax) / _local3);
_local1 = (_local1 * (_local3 * 0.5));
_local2 = (_local2 * (_local3 * 0.5));
if (!p0.fixed){
p0.x = (p0.x + _local1);
p0.y = (p0.y + _local2);
};
if (!p1.fixed){
p1.x = (p1.x - _local1);
p1.y = (p1.y - _local2);
};
};
};
}
public function toString():String{
return ((((((("[Spring p0: " + p0.toString()) + ", p1: ") + p1.toString()) + ", relax: ") + relax) + "]"));
}
public function setRope(_arg1:Boolean):void{
rope = _arg1;
}
function setEngine(_arg1:ParticleEngine):void{
engine = _arg1;
}
public function equals(_arg1:Spring):Boolean{
return (((p0.equals(_arg1.p0)) && (p1.equals(_arg1.p1))));
}
}
}//package physics
Section 21
//Vector (physics.Vector)
package physics {
public class Vector {
public var x:Number;
public var y:Number;
public function Vector(_arg1:Number, _arg2:Number){
this.x = _arg1;
this.y = _arg2;
}
public function length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function toString():String{
return ((((("[Vector x: " + x) + ", y: ") + y) + "]"));
}
public function normalize():Vector{
var _local1:Number;
_local1 = length();
x = (x / _local1);
y = (y / _local1);
return (this);
}
public function equals(_arg1:Vector):Boolean{
return ((((x == _arg1.x)) && ((y == _arg1.y))));
}
}
}//package physics
Section 22
//Background (Background)
package {
import flash.display.*;
import flash.geom.*;
public class Background extends Sprite {
private var textureHeight:int;
private var bitmap:Bitmap;
private var textureWidth:int;
private var normal:BitmapData;
public function Background(_arg1:BitmapData, _arg2:int, _arg3:int){
var _local4:int;
var _local5:int;
super();
textureWidth = _arg1.width;
textureHeight = _arg1.height;
normal = new BitmapData((_arg2 + textureWidth), (_arg3 + textureHeight), false);
bitmap = new Bitmap(normal);
addChild(bitmap);
_local4 = 0;
while (_local4 < Math.ceil((normal.width / textureWidth))) {
_local5 = 0;
while (_local5 < Math.ceil((normal.height / textureHeight))) {
normal.copyPixels(_arg1, _arg1.rect, new Point((_local4 * textureWidth), (_local5 * textureHeight)));
_local5++;
};
_local4++;
};
}
public function render(_arg1:int, _arg2:int):void{
bitmap.x = -((uint(_arg1) % textureWidth));
bitmap.y = -((uint(_arg2) % textureHeight));
}
}
}//package
Section 23
//backgroundTex (backgroundTex)
package {
import flash.display.*;
public dynamic class backgroundTex extends BitmapData {
public function backgroundTex(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 24
//Egg (Egg)
package {
import flash.display.*;
public dynamic class Egg extends MovieClip {
}
}//package
Section 25
//Game (Game)
package {
import physics.*;
import flash.events.*;
import flash.display.*;
public class Game extends Sprite {
private var worldX:int;
private var worldY:int;
private var background:Background;
private var timer:int;
private var engine:ParticleEngine;
private var canvas:Sprite;
private var wallManager:WallManager;
private var player:Player;
private var allSperms:Array;
private var sperms:Array;
public function Game(_arg1:Stage){
var _local2:int;
var _local3:Sprite;
super();
_arg1.addEventListener(Event.ENTER_FRAME, main);
engine = new ParticleEngine();
engine.gravity = new Vector(0, 0);
engine.iterations = 5;
player = new Player(_arg1, engine);
background = new Background(new backgroundTex(128, 128), 700, 450);
canvas = new Sprite();
wallManager = new WallManager(engine);
sperms = [];
allSperms = [player];
addChild(background);
addChild(wallManager);
addChild(canvas);
addChild(player);
_local2 = 0;
while (_local2 < 7) {
addSperm((((Math.random() - 0.5) * 350) + 100), ((Math.random() - 0.5) * 150));
_local2++;
};
wallManager.setSperms(allSperms);
wallManager.init();
removeChild(player);
addChild(player);
_local3 = new Sprite();
_local3.graphics.beginFill(0);
_local3.graphics.drawRect(0, 0, 700, 450);
_local3.graphics.endFill();
addChild(_local3);
mask = _local3;
}
private function main(_arg1:Event):void{
var _local2:Sperm;
timer++;
worldX = (worldX + int((((player.getX() - 200) - worldX) * 0.99)));
worldY = (worldY + int((((player.getY() - 225) - worldY) * 0.99)));
engine.main(null);
canvas.graphics.clear();
background.render((worldX + timer), worldY);
wallManager.main(worldX, worldY);
player.main(worldX, worldY, canvas.graphics);
for each (_local2 in sperms) {
_local2.main(worldX, worldY, canvas.graphics);
};
}
private function addSperm(_arg1:int, _arg2:int):void{
var _local3:UnroyalChild;
var _local4:Sperm;
_local3 = new UnroyalChild(engine, _arg1, _arg2, player);
sperms.push(_local3);
addChild(_local3);
for each (_local4 in allSperms) {
engine.addSpring(new Pusher(_local3.getParticle(), _local4.getParticle(), (_local4.getRadius() + _local3.getRadius())));
};
allSperms.push(_local3);
}
}
}//package
Section 26
//GameOver (GameOver)
package {
import flash.display.*;
public dynamic class GameOver extends MovieClip {
}
}//package
Section 27
//Intro (Intro)
package {
import flash.events.*;
import flash.display.*;
public class Intro extends MovieClip {
private var i:int;
public function Intro(){
addFrameScript(309, frame310, 348, frame349, 371, frame372);
addEventListener(MouseEvent.CLICK, asd);
}
function frame310(){
stop();
}
function frame349(){
stop();
}
private function start(){
removeEventListener(MouseEvent.CLICK, asd);
dispatchEvent(new Event(Event.COMPLETE));
}
private function asd(_arg1:MouseEvent):void{
if (i == 0){
gotoAndPlay("story");
};
if (i == 1){
gotoAndPlay("controlls");
};
if (i == 2){
start();
};
i++;
}
function frame372(){
stop();
}
}
}//package
Section 28
//Player (Player)
package {
import physics.*;
import flash.events.*;
import flash.display.*;
import flash.ui.*;
public class Player extends Sperm {
private var keys:Array;
private var thrust:Boolean;
private var thrustPower:Number;
public var hat:MovieClip;
private var thrustTimer:int;
public function Player(_arg1:Stage, _arg2:ParticleEngine){
var _local3:int;
keys = [];
super(_arg2, -150, 0);
_local3 = 0;
while (_local3 < 200) {
keys[_local3] = false;
_local3++;
};
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
}
private function keyHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode < keys.length){
keys[_arg1.keyCode] = (_arg1.type == KeyboardEvent.KEY_DOWN);
};
}
override public function main(_arg1:int, _arg2:int, _arg3:Graphics):void{
var _local4:Number;
super.main(_arg1, _arg2, _arg3);
if (keys[Keyboard.UP]){
if (thrustTimer == 0){
thrust = true;
thrustPower = 6;
keys[Keyboard.UP] = false;
thrustTimer = (30 * 3);
};
};
if (thrust){
vx = (vx + (Math.cos(angle) * thrustPower));
vy = (vy - (Math.sin(angle) * thrustPower));
thrustPower = (thrustPower - 0.5);
if (thrustPower <= 0){
thrust = false;
};
};
if (((!(thrust)) && ((thrustTimer > 0)))){
thrustTimer--;
};
MovieClip(getChildByName("hat")).gotoAndStop(int(((1 - (thrustTimer / (30 * 3))) * 30)));
_local4 = angle;
vx = (vx + (Math.cos(_local4) * 0.6));
vy = (vy - (Math.sin(_local4) * 0.6));
if (keys[Keyboard.LEFT]){
angle = (angle + 0.1);
vx = (vx * 0.92);
vy = (vy * 0.92);
};
if (keys[Keyboard.RIGHT]){
angle = (angle - 0.1);
vx = (vx * 0.92);
vy = (vy * 0.92);
};
head.x = (head.x + vx);
head.y = (head.y + vy);
}
}
}//package
Section 29
//Princess (Princess)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.net.*;
public class Princess extends Sprite {
public var song:SoundChannel;
public var asdsd:Boolean;
public var intro:Intro;
public var game:Game;
private static const MUSIC_VOLUME:Number = 1;
public static var instance:Princess;
public function Princess(){
instance = this;
stage.frameRate = 30;
intro = new Intro();
addChild(intro);
intro.addEventListener(Event.COMPLETE, start);
}
private function start(_arg1:Event):void{
intro.removeEventListener(Event.COMPLETE, start);
removeChild(intro);
game = new Game(stage);
addChild(game);
song = new Sound(new URLRequest("beingaroyalsperm.mp3")).play(0, int.MAX_VALUE, new SoundTransform(MUSIC_VOLUME));
}
public static function gameOver():void{
if (!instance.asdsd){
instance.asdsd = true;
instance.removeChild(instance.game);
instance.game = null;
instance.song.stop();
instance.addChild(new GameOver());
};
}
}
}//package
Section 30
//Sperm (Sperm)
package {
import physics.*;
import flash.display.*;
public class Sperm extends MovieClip {
protected var tail:Array;
protected var vx:Number;
protected var vy:Number;
protected var angle:Number;
protected var head:Particle;
protected static const RADIUS:Number = 18;
protected static const TAIL_LENGTH:int = 12;
public function Sperm(_arg1:ParticleEngine, _arg2:int, _arg3:int){
var _local4:Particle;
var _local5:Particle;
var _local6:int;
super();
vx = (vy = (angle = 0));
x = (y = int.MAX_VALUE);
tail = [];
_local6 = 0;
while (_local6 < TAIL_LENGTH) {
_local4 = new Particle(((-(_local6) * 10) + _arg2), _arg3);
if (_local5){
_arg1.addSpring(new Spring(_local4, _local5));
};
_arg1.addParticle(_local4);
tail.push(_local4);
_local5 = _local4;
_local6++;
};
head = tail[0];
}
public function getParticle():Particle{
return (head);
}
public function getRadius():Number{
return (RADIUS);
}
public function main(_arg1:int, _arg2:int, _arg3:Graphics):void{
var _local4:Particle;
var _local5:int;
vx = (vx * 0.65);
vy = (vy * 0.65);
head.x = (head.x + vx);
head.y = (head.y + vy);
rotation = (-(angle) / (Math.PI / 180));
x = (head.x - _arg1);
y = (head.y - _arg2);
_local5 = 0;
while (_local5 < TAIL_LENGTH) {
_local4 = tail[_local5];
_arg3.lineStyle((((TAIL_LENGTH + 1) - _local5) * 0.9), 0xFFFFFF);
if (_local5 == 0){
_arg3.moveTo((_local4.x - _arg1), (_local4.y - _arg2));
} else {
_arg3.lineTo((_local4.x - _arg1), (_local4.y - _arg2));
};
_local5++;
};
}
public function getX():Number{
return (head.x);
}
public function getY():Number{
return (head.y);
}
}
}//package
Section 31
//UnroyalChild (UnroyalChild)
package {
import physics.*;
import flash.display.*;
public class UnroyalChild extends Sperm {
private var keys:Array;
private var timer:int;
private var swimRate:Number;
private var player:Player;
public function UnroyalChild(_arg1:ParticleEngine, _arg2:int, _arg3:int, _arg4:Player){
keys = [];
super(_arg1, _arg2, _arg3);
timer = 0;
swimRate = (0.2 + ((Math.random() - 0.5) * 0.05));
this.player = _arg4;
}
override public function main(_arg1:int, _arg2:int, _arg3:Graphics):void{
var _local4:Number;
super.main(_arg1, _arg2, _arg3);
timer++;
_local4 = (player.getX() - head.x);
if (_local4 < 0){
_local4 = 0;
};
vx = (vx + (Math.cos(angle) * (1.9 + (_local4 * 0.002))));
vy = (vy - (Math.sin(angle) * (1.9 + (_local4 * 0.002))));
angle = (angle + (Math.cos((timer * swimRate)) * 0.03));
}
}
}//package
Section 32
//WallManager (WallManager)
package {
import de.polygonal.ds.*;
import physics.*;
import flash.display.*;
public class WallManager extends Sprite {
private var egg:Egg;
private var frontier:int;
private var aX:Number;
private var bX:Number;
private var bY:Number;
private var aY:Number;
private var engine:ParticleEngine;
private var eggTimer:int;
private var iterator:SListIterator;
private var list:SLinkedList;
private var sperms:Array;
private var eggX:int;
public function WallManager(_arg1:ParticleEngine){
this.engine = _arg1;
list = new SLinkedList();
iterator = list.getListIterator();
}
public function init(){
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
_local7 = -300;
_local5 = _local7;
_local3 = _local5;
_local1 = _local3;
_local8 = 0;
_local6 = _local8;
_local4 = _local6;
_local2 = _local4;
addLine((_local5 - 500), _local6, _local5, _local6);
addLine((_local5 - 500), _local6, _local5, _local6);
_local9 = 0;
while (_local9 < 8) {
_local1 = (-300 + (100 * _local9));
_local3 = (-300 + (100 * _local9));
if (_local9 < 6){
_local2 = (Math.sin(((_local9 / 6) * Math.PI)) * 190);
_local4 = (-(Math.sin(((_local9 / 6) * Math.PI))) * 190);
} else {
_local2 = (_local2 + 15);
_local4 = (_local4 - 15);
};
addLine(_local1, _local2, _local5, _local6);
addLine(_local3, _local4, _local7, _local8);
frontier = _local1;
_local5 = _local1;
_local6 = _local2;
_local7 = _local3;
_local8 = _local4;
_local9++;
};
aX = _local5;
aY = _local6;
bX = _local7;
bY = _local8;
}
public function addLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:LineParticle;
var _local6:Sperm;
_local5 = new LineParticle(_arg1, _arg2, _arg3, _arg4, true);
list.append(_local5);
for each (_local6 in sperms) {
engine.addSpring(new LineParticleConstraint(_local6.getParticle(), _local5, _local6.getRadius()));
};
}
public function main(_arg1:int, _arg2:int):void{
var _local3:Boolean;
var _local4:LineParticle;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
graphics.clear();
iterator.start();
while (iterator.valid()) {
_local4 = iterator.data;
if (((((_local4.p2.x - _arg1) < -500)) && (((_local4.x - _arg1) < -500)))){
engine.removeLPC(_local4);
engine.removeParticle(_local4);
iterator.remove();
} else {
graphics.beginFill(0xFFFFFF);
graphics.moveTo((_local4.x - _arg1), (_local4.y - _arg2));
graphics.lineTo((_local4.p2.x - _arg1), (_local4.p2.y - _arg2));
graphics.lineTo((_local4.p2.x - _arg1), (_local3) ? 0 : 450);
graphics.lineTo((_local4.x - _arg1), (_local3) ? 0 : 450);
graphics.endFill();
_local3 = !(_local3);
iterator.forth();
};
};
if (egg){
egg.x = (eggX - _arg1);
egg.y = (190 - _arg2);
eggTimer++;
if (!contains(egg)){
addChild(egg);
};
if (eggTimer > (30 * 5)){
Princess.gameOver();
};
};
if (frontier < (_arg1 + 750)){
if (frontier < 25000){
_local7 = ((frontier + 80) + int((Math.random() * 40)));
_local5 = _local7;
_local6 = (((aY + (Math.sin((frontier * 0.003)) * 15)) + ((1 + Math.sin((frontier * 0.0026))) * 2)) + ((1 + Math.sin((frontier * 0.0003))) * 0.7));
_local8 = (((bY + (Math.sin((frontier * 0.002)) * 15)) + ((1 + Math.sin((frontier * 0.0042))) * 2)) + ((1 + Math.sin((frontier * 0.00025))) * 0.7));
} else {
if (!egg){
egg = new Egg();
eggX = (frontier + 500);
};
_local7 = ((frontier + 80) + int((Math.random() * 40)));
_local5 = _local7;
_local6 = (aY * 0.8);
_local8 = (bY * 0.8);
if (Math.abs((_local6 - _local8)) < 100){
_local8 = ((_local6 + _local8) / 2);
_local6 = _local8;
};
};
addLine(aX, aY, _local5, _local6);
addLine(bX, bY, _local7, _local8);
aX = _local5;
aY = _local6;
bX = _local7;
bY = _local8;
frontier = _local5;
};
}
public function setSperms(_arg1:Array):void{
sperms = _arg1;
}
}
}//package