Skip to content

Commit

Permalink
Fixed invisible HUD issues
Browse files Browse the repository at this point in the history
Fixed reload bar firing at the wrong place
Made server not render anything (to fix performance issues)
Launcher bullet explosions now adequately respond to obstacles
  • Loading branch information
Ohmnivore committed Jun 13, 2014
1 parent 945d62b commit 4d5faaf
Show file tree
Hide file tree
Showing 25 changed files with 140 additions and 33 deletions.
Binary file modified Client/export/windows/cpp/bin/SkullRush.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion Client/export/windows/cpp/bin/config.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=0.3.2
version=0.3.4
name=NOOB
team=1
ip=
Expand Down
27 changes: 23 additions & 4 deletions Client/source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class PlayState extends FlxState
public var players:FlxGroup;
public var emitters:FlxGroup;
public var ent:FlxGroup;
public var perma_hud:FlxGroup;
public var hud:FlxGroup;
public var scores:NScoreManager;

Expand Down Expand Up @@ -111,6 +112,8 @@ class PlayState extends FlxState
ent = new FlxGroup();
add(ent);
tocollide.add(ent);
perma_hud = new FlxGroup();
add(perma_hud);
hud = new FlxGroup();
add(hud);
scores = new NScoreManager();
Expand All @@ -121,11 +124,11 @@ class PlayState extends FlxState
//hud.add(new FlxCrosshairs());

Reg.chatbox = new ChatBox();
hud.add(Reg.chatbox);
perma_hud.add(Reg.chatbox);
Reg.chatbox.callback = sendChatMsg;

Reg.announcer = new Announcer();
hud.add(Reg.announcer);
perma_hud.add(Reg.announcer);

ping_text = new FlxText(0, 0, 70, "0");
ping_text.scrollFactor.set();
Expand Down Expand Up @@ -313,13 +316,28 @@ class PlayState extends FlxState
{
super.destroy();
}


override public function draw():Void
{
m.acquire();
if (collidemap != null)
{
if (collidemap.cachedGraphics != null)
{
if (collidemap.cachedGraphics.tilesheet != null)
super.draw();
}
}
m.release();
}

/**
* Function that is called once every frame.
*/
override public function update():Void
{
//Reg.client.updateS();
m.acquire();

if (FlxG.keys.justPressed.ESCAPE && !Menu.OPENED)
{
Expand All @@ -341,7 +359,7 @@ class PlayState extends FlxState

scores.update();

m.acquire();
//m.acquire();

super.update();

Expand All @@ -360,6 +378,7 @@ class PlayState extends FlxState
Reg.chatbox.toggle();
}

Reg.client.poll();
m.release();
}

Expand Down
9 changes: 6 additions & 3 deletions Client/source/Player.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ class Player extends PlayerBase
{
super.fire();

var reload:FlxTimer = new FlxTimer(last_shot.mock_fireRate / 1000);
Reg.state.wepBar.setRange(0, 1);
Reg.state.wepBar.setParent(reload, "progress", false);
if (ID == Reg.state.player.ID)
{
var reload:FlxTimer = new FlxTimer(last_shot.mock_fireRate / 1000);
Reg.state.wepBar.setRange(0, 1);
Reg.state.wepBar.setParent(reload, "progress", false);
}
}

override public function setGun(GunID:Int, Force:Bool = false):Void
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ At the moment the client source code is a mess. I'll clean it up one day.

## Bugs:
* Fix annoying LAN server discovery bug
* Fix client-side crashes on map change
* Map change crash


## Assets:
Expand Down
1 change: 0 additions & 1 deletion Server/Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

<!--These window settings apply to all targets-->
<window width="640" height="480" fps="60" background="#000000" hardware="true" vsync="true" />
<window antialiasing="100" />

<!--Web-specific-->
<window if="web" orientation="portrait" />
Expand Down
Binary file added Server/export/windows/cpp/bin/Insomnia.ndll
Binary file not shown.
Binary file modified Server/export/windows/cpp/bin/SkullRushServer.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion Server/export/windows/cpp/bin/config.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=0.3.1
version=0.3.4

############################

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Server/source/Admin.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ;
import enet.ENet;
import flixel.FlxG;
import flixel.util.FlxTimer;
import gevents.ConfigEvent;
import networkobj.NReg;

Expand Down Expand Up @@ -77,6 +78,7 @@ class Admin

public static function reloadMap():Void
{
FlxTimer.manager.clear();
Reg.reLaunch();
}

Expand Down
2 changes: 1 addition & 1 deletion Server/source/InitState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class InitState extends FlxState

//Make trace also write to flixel's debugger's log
old_trace = Log.trace;
//Log.trace = new_trace;
Log.trace = new_trace;

//Setup networking
Reg.maps = Reg.parseMaps();
Expand Down
9 changes: 9 additions & 0 deletions Server/source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import gamemodes.FFA;
import gevents.GenEvent;
import gevents.InitEvent;
import gevents.SetTeamEvent;
import insomnia.Insomnia;
import sys.io.File;
import gevents.ConfigEvent;
import haxe.Serializer;
Expand Down Expand Up @@ -130,6 +131,9 @@ class PlayState extends FlxState
Thread.create(thread);

Admin.hookCommands();

Insomnia.preventSleep();
Insomnia.setProcessPriority(Insomnia.P_REALTIME_PRIORITY_CLASS);
}

public function loadMap(Name:String):Void
Expand Down Expand Up @@ -217,6 +221,11 @@ class PlayState extends FlxState
}
}

override public function draw():Void
{
//super.draw();
}

/**
* Function that is called once every frame.
*/
Expand Down
2 changes: 0 additions & 2 deletions Server/source/Player.hx
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,8 @@ class Player extends PlayerBase

if (move_jump) //jump
{
//trace("jumping");
if (isTouching(FlxObject.ANY) && canJump)
{
//trace(_arr[2]);
velocity.y = -280;
canJump = false;
}
Expand Down
2 changes: 0 additions & 2 deletions Server/source/SkullServer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class SkullServer extends Server
//var b = Bytes.alloc(80);
//s.receive(b);
//var msg:String = new BytesInput(b).readUntil(0);
//if (msg.length > 0) trace("Msg: ", msg);
//
//if (msg == "get_info")
//{
Expand All @@ -89,7 +88,6 @@ class SkullServer extends Server
//info += '$players_max, ';
//info += '"$internal_ip"';
//info += ']';
//trace("Info: ", info);
//
//s.sendAll(Bytes.ofString(info));
//}
Expand Down
4 changes: 2 additions & 2 deletions Server/source/gamemodes/DefaultHooks.hx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class DefaultHooks
{
var e:ENetEvent = E.leaveinfo;

trace("Peer disconnected! ID: ", e.ID);
trace("Peer disconnected! ID: " + Std.string(e.ID));

var p:Player = Reg.server.playermap.get(e.ID);

Expand Down Expand Up @@ -359,7 +359,7 @@ class DefaultHooks
static public function onPeerConnect(e:JoinEvent):Void
{
var E:ENetEvent = e.joininfo;
trace("Peer connected. ID: ", E.ID);
trace("Peer connected. ID: " + Std.string(E.ID));
var name:String = Msg.PlayerInfo.data.get("name");
name = StringTools.trim(name);
if (name.length > 15) name = name.substr(0, 15);
Expand Down
2 changes: 1 addition & 1 deletion Server/source/networkobj/NEmitter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class NEmitter
static public function stopEmitter(Handle:Int):Void
{
var e:FlxEmitterAuto = live_emitters.get(Handle);
//trace(e);

if (e != null)
{
Msg.EmitterDelete.data.set("id", Handle);
Expand Down
6 changes: 2 additions & 4 deletions Server/source/networkobj/NWeapon.hx
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,11 @@ class NWeapon
static public function announceWeapons(player:Int = 0):Void
{
var map:Map<Int, Dynamic> = new Map<Int, Dynamic>();
//trace(array);

for (slot in NWeapon.weapons.keys())
{
//trace("trace");
var arr:Array<Dynamic> = [];
var w:NWeapon = cast NWeapon.weapons.get(slot);
//trace("Wep:", w);

arr.push(w.bulletElasticity);
arr.push(w.bulletLifeSpan);
Expand All @@ -201,7 +199,7 @@ class NWeapon

map.set(slot, arr);
}
//trace(array);

Msg.AnnounceGuns.data.set("serialized", Serializer.run(map));

if (player == 0)
Expand Down
21 changes: 20 additions & 1 deletion Server/source/weapons/Launcher.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package weapons;
import flixel.addons.weapon.FlxBullet;
import flixel.effects.particles.FlxEmitter;
import flixel.effects.particles.FlxEmitterExt;
import flixel.tile.FlxTilemap;
import flixel.util.FlxAngle;
import flixel.util.FlxMath;
import flixel.util.FlxPoint;
Expand Down Expand Up @@ -76,7 +77,25 @@ class Launcher extends NWeapon

v.rotateByRadians(FlxAngle.angleBetween(Bullet, pl));

if (Reg.state.collidemap.ray(Bullet.getMidpoint(), pl.getMidpoint()))
var no_collision:Bool = true;
for (m in Reg.state.maps.members.iterator())
{
var map:FlxTilemap = cast m;

try
{
if (!map.ray(Bullet.getMidpoint(), pl.getMidpoint()))
{
no_collision = false;
}
}
catch (e:Dynamic)
{

}
}

if (no_collision)
{
var dist_coeff:Float = (100 - FlxMath.distanceBetween(pl, Bullet)) / 100;
if (dist_coeff < 0) dist_coeff = 0;
Expand Down
7 changes: 0 additions & 7 deletions Shared/code/PlayerBase.hx
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ class PlayerBase extends FlxSprite
{
if (grantedWeps.exists(GunID))
{
//trace(GunID);
if (grantedWeps.get(GunID) == true)
{
var g:FlxWeaponExt = guns_arr[GunID - 1];
Expand All @@ -371,7 +370,6 @@ class PlayerBase extends FlxSprite
canChange = false;
weap_change_timer.reset(0.3);

//trace(current_weap);
}
}
}
Expand All @@ -397,9 +395,7 @@ class PlayerBase extends FlxSprite
_arr.push(dash_left);
_arr.push(dash_right);
_arr.push(current_weap);
//trace(current_weap);

//trace(cannon.nextFire - FlxG.game.ticks);
_arr.push(cannon.nextFire - FlxG.game.ticks);
_arr.push(last_shot.template.slot - 1);

Expand Down Expand Up @@ -505,16 +501,13 @@ class PlayerBase extends FlxSprite

if (move_jump) //jump
{
//trace("jumping");
if (isTouching(FlxObject.ANY))
{
//trace(_arr[2]);
velocity.y = -280;
}

else
{
//trace("not jumping");
move_jump = false;
}
}
Expand Down
3 changes: 1 addition & 2 deletions Shared/code/enet/Message.hx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class Message
}

res += Serializer.run(_arr);
//trace(res);
return res;
}

Expand All @@ -91,7 +90,7 @@ class Message
for (f in fields)
{
data.set(f, _arr[x]);
//trace(_arr[x]);

x++;
}
}
Expand Down
Loading

0 comments on commit 4d5faaf

Please sign in to comment.