cinvoke-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cinvoke-svn] r128 - in trunk/skorpion: . server/game


From: will
Subject: [cinvoke-svn] r128 - in trunk/skorpion: . server/game
Date: 19 Nov 2006 06:59:23 -0500

Author: p
Date: 2006-11-19 06:59:22 -0500 (Sun, 19 Nov 2006)
New Revision: 128

Modified:
   trunk/skorpion/Client.cs
   trunk/skorpion/server/game/Server.cs
   trunk/skorpion/skorpion.cs
Log:
- fix starfield bug
- hack in some stuff for getting replays working



Modified: trunk/skorpion/Client.cs
===================================================================
--- trunk/skorpion/Client.cs    2006-11-18 07:36:13 UTC (rev 127)
+++ trunk/skorpion/Client.cs    2006-11-19 11:59:22 UTC (rev 128)
@@ -143,7 +143,7 @@
                                        }
 
                                        Ship universeMe = 
(Ship)Universe.Entities[MyID];
-                                       if (universeMe != null) 
+                                       if (universeMe != null && 
GlobalState.CamNum != 3) 
                                        {
                                                Me.Position = 
universeMe.Position;
                                        }
@@ -268,7 +268,7 @@
                                                
(((Entity)NextFrame[de.Key]).Position - ((Entity)LastFrame[de.Key]).Position)
                                                * ((float)t / 
(float)RefreshInterval);
 
-                                       if ((ushort)de.Key == MyID)
+                                       if ((ushort)de.Key == MyID && 
GlobalState.CamNum != 3)
                                        {
                                                Me.Position = 
((Entity)de.Value).Position;
                                                //if (Me.Position.X == 
float.NaN)
@@ -319,16 +319,29 @@
                                        update = true;
                        }
  
-                       if (update) {
+                       if (update) 
+                       {
                                PlayerRefresh m = new PlayerRefresh();
                                m.ShipOrt.SetVector(Me.Orientation);
                                m.ShipUp.SetVector(Me.UpDirection);
-                               
m.Velocity.SetVector(MyVelocity.Total(Me.Orientation, Me.UpDirection));
+                               
+                               if (GlobalState.CamNum == 3)
+                               {
+                                       m.Velocity.SetVector(new 
skorpion.Vector3(0,0,0));
+                                       Me.Position += 
MyVelocity.Total(Me.Orientation, Me.UpDirection) * 10;
+                               }
+                               else
+                               {
+                                       
m.Velocity.SetVector(MyVelocity.Total(Me.Orientation, Me.UpDirection));
+                               }                               
+                               
                                m.Ping = Pinger.Send();
 
                                Net.send(m);
 
                                LastSent = DateTime.Now;
+       
+                               
                        }
                }
 

Modified: trunk/skorpion/server/game/Server.cs
===================================================================
--- trunk/skorpion/server/game/Server.cs        2006-11-18 07:36:13 UTC (rev 
127)
+++ trunk/skorpion/server/game/Server.cs        2006-11-19 11:59:22 UTC (rev 
128)
@@ -6,6 +6,9 @@
        public class GameServer
        {
                public  Universe  Universe;
+               public  bool      Playback = false;
+               public  bool      Recordon = false;
+               public  ArrayList Record = new ArrayList();
 
                private Hashtable Conns;
                private Hashtable Clients;
@@ -243,6 +246,23 @@
                                        s.Snapped = false;
                                        s.Position = new Vector3(500,330,0);
                                }
+                               else if (cmd == "record")
+                               {
+                                       DisplayReq displayReq = new 
DisplayReq();
+                                       if (this.Recordon) 
+                                       {
+                                               displayReq.Message = "*** 
record off";
+                                               this.Recordon = false;
+                                       }
+                                       else 
+                                       {
+                                               this.Recordon = true;
+                                               this.Record = new ArrayList();
+                                               displayReq.Message = "*** 
record on";
+                                       }
+
+                                       
ServerState.NetServer.broadcastViaACKQueue(displayReq);
+                               }
                                else
                                        r.Response = "Unknown command";
 
@@ -303,6 +323,10 @@
                        if (LastRefreshTime >= freshtime)
                                return null;
 
+                       if (Playback) 
+                       {
+                       }
+
                        Universe.Run();
 
                        ArrayList ship = new ArrayList();

Modified: trunk/skorpion/skorpion.cs
===================================================================
--- trunk/skorpion/skorpion.cs  2006-11-18 07:36:13 UTC (rev 127)
+++ trunk/skorpion/skorpion.cs  2006-11-19 11:59:22 UTC (rev 128)
@@ -40,7 +40,7 @@
                public static CreateFlags   DevFlags            = 
CreateFlags.HardwareVertexProcessing;
 
                public static ushort        Team                = 1;
-               public static bool          Thrusters           = true;
+               public static bool          Thrusters           = false;
 
                public static bool          ClientStart         = true;
                public static string        ClientConnect       = "pleep.com";
@@ -421,21 +421,27 @@
                        iShipMaterial2.Diffuse = Color.FromArgb(255,100,120);   
 
                        // stars
-                       iStars = Mesh.Sphere(iDevice, 1000.0f, 20, 20);
+                       iStars = Mesh.Sphere(iDevice, 1200.0f, 20, 20);
                        iStars = iStars.Clone(MeshFlags.WriteOnly, 
CustomVertex.PositionTextured.Format, iDevice);
                        
                        CustomVertex.PositionTextured[] starVerts = 
(CustomVertex.PositionTextured[])
                                
iStars.LockVertexBuffer(typeof(CustomVertex.PositionTextured),
                                LockFlags.None, iStars.NumberVertices);
 
+                       System.Console.WriteLine("atan2(0,1) == " + 
Math.Atan2(0, 1));
                        for (int i=0; i<iStars.NumberVertices; i++)
                        {
-                               starVerts[i].Tu = 
(float)Math.Asin(starVerts[i].X/1000.0f)/(float)Math.PI+0.5f;
-                               starVerts[i].Tv = 
(float)Math.Asin(starVerts[i].Y/1000.0f)/(float)Math.PI+0.5f;
+                               Vector3 vv = new Vector3(starVerts[i].X, 
starVerts[i].Y, starVerts[i].Z);
+                               vv.Normalize();
+                               float f = (float)Math.Atan2(vv.Z, vv.X);
+                               if (f >= 0) starVerts[i].Tu = f / 
(float)(Math.PI*2);
+                               else        starVerts[i].Tu = (float)(Math.PI + 
f) / (float)(Math.PI*2) + 0.5f;
+
+                               starVerts[i].Tv = (float)Math.Asin(-vv.Y) / 
(float)(Math.PI) + 0.5f;
                        }
 
                        iStars.UnlockVertexBuffer();
-                       iStarTexture = TextureLoader.FromFile(iDevice, 
".\\assets\\starmap.dds");
+            iStarTexture = TextureLoader.FromFile(iDevice, 
".\\assets\\starmap.dds");
 
                        // assets
                        Assets.Reset();
@@ -607,10 +613,13 @@
                        iDevice.RenderState.CullMode = Cull.Clockwise;
                        iDevice.TextureState[0].ColorOperation = 
TextureOperation.SelectArg1;
                        iDevice.TextureState[0].ColorArgument1 = 
TextureArgument.TextureColor;
+                       iDevice.RenderState.Wrap0 = WrapCoordinates.Zero;
+
                        iDevice.SetTexture(0, iStarTexture);
                        iStars.DrawSubset(0);
                        iDevice.RenderState.Lighting = true;
                        iDevice.RenderState.ZBufferEnable = true;
+                       iDevice.RenderState.Wrap0 = 0;
 
                        // draw sparks erupting from the ball
                        foreach(Entity e2 in 
GlobalState.Client.ThisFrame.Values)
@@ -740,6 +749,15 @@
                                {
                                        drawme = true;
                                        myteam = ((Ship)e).Team;
+                                       if (GlobalState.CamNum == 3) 
+                                                                               
+                                       {
+                                               Ship s = (Ship)e;
+                                               if (s.Team == 1) { 
iDevice.Material = iShipMaterial1; }
+                                               else if (s.Team == 2) { 
iDevice.Material = iShipMaterial2; }
+                                               else { iDevice.Material = 
iShipMaterial; }
+                                               DrawShip((Ship)e);
+                                       }
                                }
                                else if (e.Type == Ship.TYPE) 
                                {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]