use new haxe for-in syntax
This commit is contained in:
parent
4db2b31176
commit
04f4fa3ef1
|
@ -0,0 +1,2 @@
|
||||||
|
grep -Plr 'for\(([^= ]*)=([^;]*);\1<([^=;]*);\1\+\+\)' source/ | xargs sed -i 's#for(\([^= ]*\)=\([^;]*\);\1<\([^=;]*\);\1++)#for(\1 in \2...\3)#'
|
||||||
|
grep -Plr 'for\(var ([^=:]*):Int=([^;]*);\1<([^=;]*);\1\+\+\)' source/ | xargs sed -i 's#for(var \([^=:]*\):Int=\([^;]*\);\1<\([^=;]*\);\1++)#for(\1 in \2...\3)#'
|
|
@ -1194,7 +1194,7 @@ class Intra extends FlxGame {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(FlxG.keys.justPressed("R")){
|
if(FlxG.keys.justPressed("R")){
|
||||||
for(var y:Int=36;y<48;y++){
|
for(y in 36...48){
|
||||||
Registry.card_states[y]=1;
|
Registry.card_states[y]=1;
|
||||||
Registry.nr_growths++;
|
Registry.nr_growths++;
|
||||||
}
|
}
|
||||||
|
@ -1219,7 +1219,7 @@ class Intra extends FlxGame {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FlxG.keys.justPressed("S")){
|
if(FlxG.keys.justPressed("S")){
|
||||||
for(var i:Int=11;i<=Registry.IDX_WHITE;i++){
|
for(i in 11...Registry.IDX_WHITE+1){
|
||||||
Registry.inventory[i]=true;
|
Registry.inventory[i]=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1789,4 +1789,4 @@ class Intra extends FlxGame {
|
||||||
position_bars();
|
position_bars();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ class Save {
|
||||||
if(ref[0]===false){
|
if(ref[0]===false){
|
||||||
if(old.length<ref.length){
|
if(old.length<ref.length){
|
||||||
trace("Array with falses in save was shorter than in disk");
|
trace("Array with falses in save was shorter than in disk");
|
||||||
for(var j:Int=old.length;j<ref.length;j++){
|
for(j in old.length...ref.length){
|
||||||
old.push(false);
|
old.push(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package data
|
package data ;
|
||||||
{
|
|
||||||
import helper.Cutscene;
|
import helper.Cutscene;
|
||||||
import org.flixel.FlxG;
|
import org.flixel.FlxG;
|
||||||
import org.flixel.FlxGroup;
|
import org.flixel.FlxGroup;
|
||||||
|
@ -531,7 +531,7 @@ class SoundData
|
||||||
teleguy_down.loadEmbedded(embed_teleguy_down);
|
teleguy_down.loadEmbedded(embed_teleguy_down);
|
||||||
teleguy_up.loadEmbedded(embed_teleguy_up);
|
teleguy_up.loadEmbedded(embed_teleguy_up);
|
||||||
gasguy_shoot.loadEmbedded(embed_gasguy_shoot);
|
gasguy_shoot.loadEmbedded(embed_gasguy_shoot);
|
||||||
init_sound_group(gasguy_move, embed_gasguy_move)
|
init_sound_group(gasguy_move, embed_gasguy_move);
|
||||||
init_sound_group(rat_move, embed_rat_move);
|
init_sound_group(rat_move, embed_rat_move);
|
||||||
|
|
||||||
sb_split.loadEmbedded(embed_sb_split);
|
sb_split.loadEmbedded(embed_sb_split);
|
||||||
|
@ -608,7 +608,7 @@ class SoundData
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init_multi_sound_group(g:FlxGroup, sounds:Array, looped:Bool=false, volume:Float=1):Void {
|
public function init_multi_sound_group(g:FlxGroup, sounds:Array, looped:Bool=false, volume:Float=1):Void {
|
||||||
for(var sound:Class in sounds){
|
for(sound in sounds){
|
||||||
var s:FlxSound=new FlxSound;
|
var s:FlxSound=new FlxSound;
|
||||||
s.loadEmbedded(sound, looped, volume);
|
s.loadEmbedded(sound, looped, volume);
|
||||||
g.add(s);
|
g.add(s);
|
||||||
|
@ -846,4 +846,4 @@ class SoundData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -733,7 +733,7 @@ class TileData
|
||||||
curMapBuf.setTileProperties(20, FlxObject.NONE, TileData.conveyer);
|
curMapBuf.setTileProperties(20, FlxObject.NONE, TileData.conveyer);
|
||||||
curMapBuf.setTileProperties(21, FlxObject.ANY, null, null, 3);
|
curMapBuf.setTileProperties(21, FlxObject.ANY, null, null, 3);
|
||||||
curMapBuf.setTileProperties(32, FlxObject.NONE, TileData.spike, Player);
|
curMapBuf.setTileProperties(32, FlxObject.NONE, TileData.spike, Player);
|
||||||
for(j in 36...=48){
|
for(j in 36...49){
|
||||||
curMapBuf.setTileProperties(j, FlxObject.NONE);
|
curMapBuf.setTileProperties(j, FlxObject.NONE);
|
||||||
}
|
}
|
||||||
HOLE_INDICES.push(9);
|
HOLE_INDICES.push(9);
|
||||||
|
@ -1141,7 +1141,7 @@ class TileData
|
||||||
} else if(p.cid==CLASS_ID.SILVERFISH){
|
} else if(p.cid==CLASS_ID.SILVERFISH){
|
||||||
if((p.y<ty + 4)&&(p.y + p.height>ty)&&
|
if((p.y<ty + 4)&&(p.y + p.height>ty)&&
|
||||||
(p.x<tx + 6)&&(p.x + p.width>tx)){
|
(p.x<tx + 6)&&(p.x + p.width>tx)){
|
||||||
p.xml.@alive="false";
|
p.xml.alive="false";
|
||||||
Registry.GRID_ENEMIES_DEAD++;
|
Registry.GRID_ENEMIES_DEAD++;
|
||||||
p.exists=false;
|
p.exists=false;
|
||||||
}
|
}
|
||||||
|
@ -1149,7 +1149,7 @@ class TileData
|
||||||
|
|
||||||
if((p.y<ty + 11)&&(p.y + p.height>ty)&&
|
if((p.y<ty + 11)&&(p.y + p.height>ty)&&
|
||||||
(p.x<tx + 8)&&(p.x + p.width>tx)){
|
(p.x<tx + 8)&&(p.x + p.width>tx)){
|
||||||
p.xml.@alive="false";
|
p.xml.alive="false";
|
||||||
Registry.GRID_ENEMIES_DEAD++;
|
Registry.GRID_ENEMIES_DEAD++;
|
||||||
p.exists=false;
|
p.exists=false;
|
||||||
}
|
}
|
||||||
|
@ -1161,7 +1161,7 @@ class TileData
|
||||||
p.velocity.y *=0.25;
|
p.velocity.y *=0.25;
|
||||||
if((p.y<ty + 4)&&(p.y + p.height>ty)&&
|
if((p.y<ty + 4)&&(p.y + p.height>ty)&&
|
||||||
(p.x<tx + 6)&&(p.x + p.width>tx)){
|
(p.x<tx + 6)&&(p.x + p.width>tx)){
|
||||||
p.xml.@alive="false";
|
p.xml.alive="false";
|
||||||
Registry.GRID_ENEMIES_DEAD++;
|
Registry.GRID_ENEMIES_DEAD++;
|
||||||
p.exists=false;
|
p.exists=false;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -122,7 +122,7 @@ class Achievements
|
||||||
|
|
||||||
if(Registry.inventory[Registry.IDX_JUMP])rate +=2;
|
if(Registry.inventory[Registry.IDX_JUMP])rate +=2;
|
||||||
|
|
||||||
for(i in 11...=Registry.IDX_WHITE){
|
for(i in 11...Registry.IDX_WHITE+1){
|
||||||
if(Registry.inventory[i]){
|
if(Registry.inventory[i]){
|
||||||
rate +=4;
|
rate +=4;
|
||||||
}
|
}
|
||||||
|
@ -250,4 +250,4 @@ class Achievements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,7 +350,7 @@ class Cutscene extends PushableFlxState
|
||||||
var tilemap:FlxTilemap=new FlxTilemap();
|
var tilemap:FlxTilemap=new FlxTilemap();
|
||||||
tilemap.loadMap(CSV, tileset, 16, 16);
|
tilemap.loadMap(CSV, tileset, 16, 16);
|
||||||
var submap_data:Array<Dynamic>=new Array();
|
var submap_data:Array<Dynamic>=new Array();
|
||||||
for(var i:Int=0;i<w*h;i++){
|
for(i in 0...w*h){
|
||||||
submap_data.push(tilemap.getTile(gx * 10 +(i % w), gy * 10 +(i / h)));
|
submap_data.push(tilemap.getTile(gx * 10 +(i % w), gy * 10 +(i / h)));
|
||||||
}
|
}
|
||||||
tilemap.destroy();
|
tilemap.destroy();
|
||||||
|
|
|
@ -104,7 +104,7 @@ class ScreenFade
|
||||||
|
|
||||||
private function fx_rect(rate:Int):Int {
|
private function fx_rect(rate:Int):Int {
|
||||||
|
|
||||||
for(var i:Int=offset;i<offset + rate;i++){
|
for(i in offset...offset + rate){
|
||||||
for(j in 0...base.width){
|
for(j in 0...base.width){
|
||||||
base.setPixel32(j, i, 0xff000000);
|
base.setPixel32(j, i, 0xff000000);
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,8 @@ class ScreenFade
|
||||||
for(y in 0...height +=stride){
|
for(y in 0...height +=stride){
|
||||||
for(x in 0...width +=stride){
|
for(x in 0...width +=stride){
|
||||||
next_color=thing_to_draw.bitmapData.getPixel32(x,y);
|
next_color=thing_to_draw.bitmapData.getPixel32(x,y);
|
||||||
for(var _x:Int=x;_x<x + stride;_x++){
|
for(_x in x...x + stride){
|
||||||
for(var _y:Int=y;_y<y + stride;_y++){
|
for(_y in y...y + stride){
|
||||||
thing_to_draw.bitmapData.setPixel32(_x, _y, next_color);
|
thing_to_draw.bitmapData.setPixel32(_x, _y, next_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,8 +152,8 @@ class ScreenFade
|
||||||
for(y in 0...buf.height +=stride){
|
for(y in 0...buf.height +=stride){
|
||||||
for(x in 0...buf.width +=stride){
|
for(x in 0...buf.width +=stride){
|
||||||
next_color=buf.getPixel32(x,y);
|
next_color=buf.getPixel32(x,y);
|
||||||
for(var _x:Int=x;_x<x + stride;_x++){
|
for(_x in x...x + stride){
|
||||||
for(var _y:Int=y;_y<y + stride;_y++){
|
for(_y in y...y + stride){
|
||||||
buf.setPixel32(_x, _y, next_color);
|
buf.setPixel32(_x, _y, next_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ class Save {
|
||||||
if(ref[0]===false){
|
if(ref[0]===false){
|
||||||
if(old.length<ref.length){
|
if(old.length<ref.length){
|
||||||
trace("Array with falses in save was shorter than in disk");
|
trace("Array with falses in save was shorter than in disk");
|
||||||
for(var j:Int=old.length;j<ref.length;j++){
|
for(j in old.length...ref.length){
|
||||||
old.push(false);
|
old.push(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package org.flixel
|
package org.flixel ;
|
||||||
{
|
|
||||||
import entity.player.Player;
|
import entity.player.Player;
|
||||||
import flash.geom.Point;
|
import flash.geom.Point;
|
||||||
import global.Registry;
|
import global.Registry;
|
||||||
|
@ -45,4 +45,4 @@ class AnoSprite extends FlxSprite
|
||||||
super.destroy();
|
super.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class FlxGradient
|
||||||
|
|
||||||
ratio.push(0);
|
ratio.push(0);
|
||||||
|
|
||||||
for(var ri:Int=1;ri<colors.length - 1;ri++)
|
for(ri in 1...colors.length - 1)
|
||||||
{
|
{
|
||||||
ratio.push(ri * spread);
|
ratio.push(ri * spread);
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ class PNGEncoder
|
||||||
var e:Int=png.position;
|
var e:Int=png.position;
|
||||||
png.position=p;
|
png.position=p;
|
||||||
c=0xffffffff;
|
c=0xffffffff;
|
||||||
for(var i:Int=0;i<(e-p);i++){
|
for(i in 0...(e-p)){
|
||||||
c=uint(crcTable[
|
c=uint(crcTable[
|
||||||
(c ^ png.readUnsignedByte())&
|
(c ^ png.readUnsignedByte())&
|
||||||
uint(0xff)] ^ Int(c>>>8));
|
uint(0xff)] ^ Int(c>>>8));
|
||||||
|
|
|
@ -217,7 +217,7 @@ class MinimapState extends PushableFlxState
|
||||||
|
|
||||||
private function update_map():Void
|
private function update_map():Void
|
||||||
{
|
{
|
||||||
for(var i:Int=0;i<minimap.widthInTiles * minimap.heightInTiles;i++){
|
for(i in 0...minimap.widthInTiles * minimap.heightInTiles){
|
||||||
if(1 !=visited[Registry.CURRENT_MAP_NAME][i]){
|
if(1 !=visited[Registry.CURRENT_MAP_NAME][i]){
|
||||||
minimap.setTileByIndex(i, blank_tile_index, true);
|
minimap.setTileByIndex(i, blank_tile_index, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -520,7 +520,7 @@ class RoamState extends FlxState
|
||||||
var prev_len:Int=entities.length;
|
var prev_len:Int=entities.length;
|
||||||
for(var grid:XML in xml){
|
for(var grid:XML in xml){
|
||||||
if(load_all ||(parseInt(grid.@grid_x)==gx && parseInt(grid.@grid_y)==gy)){
|
if(load_all ||(parseInt(grid.@grid_x)==gx && parseInt(grid.@grid_y)==gy)){
|
||||||
for(var i:Int=0;i<grid.child("*").length();i++){
|
for(i in 0...grid.child("*").length()){
|
||||||
SpriteFactory.makeSprite(grid.child("*")[i], i, entities, entities, player, this, darkness);
|
SpriteFactory.makeSprite(grid.child("*")[i], i, entities, entities, player, this, darkness);
|
||||||
if(entities.length !=prev_len){
|
if(entities.length !=prev_len){
|
||||||
while(prev_len<entities.length){
|
while(prev_len<entities.length){
|
||||||
|
|
Loading…
Reference in New Issue