@@ -19,24 +19,24 @@ |
||
| 19 | 19 | parent::SpriteFile('SPR'); |
| 20 | 20 | $frameCount = $reader->ReadInt(2); |
| 21 | 21 | |
| 22 | - for($i=0;$i<$frameCount;$i++) { |
|
| 22 | + for ($i = 0; $i < $frameCount; $i++) { |
|
| 23 | 23 | $offset = $reader->ReadInt(4); |
| 24 | 24 | $width = $reader->ReadInt(2); |
| 25 | 25 | $height = $reader->ReadInt(2); |
| 26 | - $this->AddFrame(new SPRFrame($reader,$width,$height,$offset)); |
|
| 26 | + $this->AddFrame(new SPRFrame($reader, $width, $height, $offset)); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /// @brief Compiles the SPR file into a binary string |
| 31 | 31 | public function Compile() { |
| 32 | - $data = pack('v',$this->GetFrameCount()); |
|
| 32 | + $data = pack('v', $this->GetFrameCount()); |
|
| 33 | 33 | $offset = 2+(8*$this->GetFrameCount()); |
| 34 | - foreach($this->GetFrames() as $frame) { |
|
| 35 | - $data .= pack('V',$offset); |
|
| 36 | - $data .= pack('vv',$frame->GetWidth(),$frame->GetHeight()); |
|
| 34 | + foreach ($this->GetFrames() as $frame) { |
|
| 35 | + $data .= pack('V', $offset); |
|
| 36 | + $data .= pack('vv', $frame->GetWidth(), $frame->GetHeight()); |
|
| 37 | 37 | $offset += $frame->GetWidth()*$frame->GetHeight(); |
| 38 | 38 | } |
| 39 | - foreach($this->GetFrames() as $frame) { |
|
| 39 | + foreach ($this->GetFrames() as $frame) { |
|
| 40 | 40 | $data .= $frame->Encode(); |
| 41 | 41 | } |
| 42 | 42 | return $data; |
@@ -7,56 +7,56 @@ |
||
| 7 | 7 | * @dataProvider createAgentFiles |
| 8 | 8 | */ |
| 9 | 9 | public function testCreatePRAYFile(PRAYFile $prayfile) { |
| 10 | - $this->assertInstanceOf('PRAYFile',$prayfile); |
|
| 10 | + $this->assertInstanceOf('PRAYFile', $prayfile); |
|
| 11 | 11 | $this->assertNotNull($prayfile); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * @dataProvider createAgentFiles |
| 16 | 16 | */ |
| 17 | - public function testNumberOfBlocks(PRAYFile $prayfile,$fixtureInfo) { |
|
| 17 | + public function testNumberOfBlocks(PRAYFile $prayfile, $fixtureInfo) { |
|
| 18 | 18 | $this->assertNotNull($prayfile); |
| 19 | - $this->assertEquals($fixtureInfo['block count'],sizeof($prayfile->GetBlocks())); |
|
| 19 | + $this->assertEquals($fixtureInfo['block count'], sizeof($prayfile->GetBlocks())); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @dataProvider createAgentFiles |
| 24 | 24 | */ |
| 25 | - public function testFirstAgentDescription(PRAYFile $prayfile,$info) { |
|
| 25 | + public function testFirstAgentDescription(PRAYFile $prayfile, $info) { |
|
| 26 | 26 | $this->assertNotNull($prayfile); |
| 27 | 27 | $blocks = $prayfile->GetBlocks(PRAY_BLOCK_AGNT); |
| 28 | - $this->assertEquals($info['first agent desc'],$blocks[0]->GetAgentDescription()); |
|
| 28 | + $this->assertEquals($info['first agent desc'], $blocks[0]->GetAgentDescription()); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @dataProvider createAgentFiles |
| 33 | 33 | */ |
| 34 | - public function testChangeAGNTAndRecompile(PRAYFile $prayfile,$info) { |
|
| 34 | + public function testChangeAGNTAndRecompile(PRAYFile $prayfile, $info) { |
|
| 35 | 35 | $this->assertNotNull($prayfile); |
| 36 | 36 | $blocks = $prayfile->GetBlocks(PRAY_BLOCK_AGNT); |
| 37 | - $blocks[0]->SetTag('Agent Description','Testing'); |
|
| 38 | - $this->assertEquals('Testing',$blocks[0]->GetAgentDescription()); |
|
| 37 | + $blocks[0]->SetTag('Agent Description', 'Testing'); |
|
| 38 | + $this->assertEquals('Testing', $blocks[0]->GetAgentDescription()); |
|
| 39 | 39 | $data = $prayfile->Compile(); |
| 40 | 40 | $newfile = new PRAYFile(new StringReader($data)); |
| 41 | - $this->assertEquals($info['block count'],sizeof($newfile->GetBlocks())); |
|
| 41 | + $this->assertEquals($info['block count'], sizeof($newfile->GetBlocks())); |
|
| 42 | 42 | $newfile->GetBlocks('AGNT'); |
| 43 | - $this->assertEquals('Testing',$blocks[0]->GetAgentDescription()); |
|
| 43 | + $this->assertEquals('Testing', $blocks[0]->GetAgentDescription()); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * @dataProvider createCreatureFiles |
| 48 | 48 | */ |
| 49 | - public function testChangeGLSTAndRecompile(PRAYFILE $prayfile,$info) { |
|
| 49 | + public function testChangeGLSTAndRecompile(PRAYFILE $prayfile, $info) { |
|
| 50 | 50 | $this->assertNotNull($prayfile); |
| 51 | 51 | $blocks = $prayfile->GetBlocks(PRAY_BLOCK_GLST); |
| 52 | - $this->assertEquals($info['events count'],$blocks[0]->GetHistory()->CountEvents()); |
|
| 52 | + $this->assertEquals($info['events count'], $blocks[0]->GetHistory()->CountEvents()); |
|
| 53 | 53 | $blocks[0]->GetHistory()->RemoveEvent(0); |
| 54 | - $this->assertEquals($info['events count']-1,$blocks[0]->GetHistory()->CountEvents()); |
|
| 54 | + $this->assertEquals($info['events count']-1, $blocks[0]->GetHistory()->CountEvents()); |
|
| 55 | 55 | |
| 56 | 56 | $data = $prayfile->Compile(); |
| 57 | 57 | $newfile = new PRAYFile(new StringReader($data)); |
| 58 | 58 | $blocks = $newfile->GetBlocks(PRAY_BLOCK_GLST); |
| 59 | - $this->assertEquals($info['events count']-1,$blocks[0]->GetHistory()->CountEvents()); |
|
| 59 | + $this->assertEquals($info['events count']-1, $blocks[0]->GetHistory()->CountEvents()); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -6,8 +6,7 @@ |
||
| 6 | 6 | class C3CAOSFlowControls { |
| 7 | 7 | /// @brief Returns an array of tokens. |
| 8 | 8 | public static function GetTokens() { |
| 9 | - return array |
|
| 10 | - ( |
|
| 9 | + return array( |
|
| 11 | 10 | |
| 12 | 11 | 'doif', |
| 13 | 12 | 'econ', |
@@ -9,8 +9,7 @@ |
||
| 9 | 9 | class C3CAOSVariables { |
| 10 | 10 | /// @brief Returns an array of tokens. |
| 11 | 11 | public static function GetTokens() { |
| 12 | - return array |
|
| 13 | - ( |
|
| 12 | + return array( |
|
| 14 | 13 | //agents |
| 15 | 14 | 'abba', |
| 16 | 15 | 'carr', |
@@ -6,8 +6,7 @@ |
||
| 6 | 6 | class C3CAOSCommands { |
| 7 | 7 | /// @brief Returns an array of tokens. |
| 8 | 8 | public static function GetTokens() { |
| 9 | - return array |
|
| 10 | - ( |
|
| 9 | + return array( |
|
| 11 | 10 | 'alph', |
| 12 | 11 | 'anim', |
| 13 | 12 | 'amms', |
@@ -5,8 +5,7 @@ |
||
| 5 | 5 | class C2CAOSFlowControls { |
| 6 | 6 | /// @brief Returns an array of tokens. |
| 7 | 7 | public static function GetTokens() { |
| 8 | - return array |
|
| 9 | - ( |
|
| 8 | + return array( |
|
| 10 | 9 | 'enum', |
| 11 | 10 | 'esee', |
| 12 | 11 | 'etch', |
@@ -9,8 +9,7 @@ |
||
| 9 | 9 | class C2CAOSVariables { |
| 10 | 10 | /// @brief Returns an array of tokens. |
| 11 | 11 | public static function GetTokens() { |
| 12 | - return array |
|
| 13 | - ( |
|
| 12 | + return array( |
|
| 14 | 13 | 'ownr', |
| 15 | 14 | 'from', |
| 16 | 15 | 'pntr', |
@@ -6,8 +6,7 @@ |
||
| 6 | 6 | class C2CAOSCommands { |
| 7 | 7 | /// @brief Returns an array of tokens. |
| 8 | 8 | public static function GetTokens() { |
| 9 | - return array |
|
| 10 | - ( |
|
| 9 | + return array( |
|
| 11 | 10 | //creation |
| 12 | 11 | 'new: scen', |
| 13 | 12 | 'new: simp', |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | /** |
| 65 | 65 | * @param integer $start |
| 66 | 66 | */ |
| 67 | - public function GetSubString($start,$length = FALSE) { |
|
| 68 | - if($length == FALSE) { |
|
| 67 | + public function GetSubString($start, $length = FALSE) { |
|
| 68 | + if ($length == FALSE) { |
|
| 69 | 69 | $length = strlen($this->string)-$start; |
| 70 | 70 | } |
| 71 | - $str = substr($this->string,$start,$length); |
|
| 71 | + $str = substr($this->string, $start, $length); |
|
| 72 | 72 | return $str; |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | * @param false|string $string |
| 78 | 78 | */ |
| 79 | 79 | function BytesToIntLilEnd($string) { //little endian |
| 80 | - if($string == "") { |
|
| 80 | + if ($string == "") { |
|
| 81 | 81 | return false; |
| 82 | 82 | } |
| 83 | 83 | $length = strlen($string); |
| 84 | 84 | $int = 0; |
| 85 | - for($i=0;$i<$length;$i++) { |
|
| 86 | - $int += ord($string{$i})<<($i*8); |
|
| 85 | + for ($i = 0; $i < $length; $i++) { |
|
| 86 | + $int += ord($string{$i}) << ($i*8); |
|
| 87 | 87 | } |
| 88 | 88 | return $int; |
| 89 | 89 | } |