Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

JBScreen.JBScreenMapPanorama


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
// ============================================================================
// JBScreenMapPanorama
// Copyright 2003 by Mychaeel <mychaeel@planetjailbreak.com>
// $Id: JBScreenMapPanorama.uc,v 1.1.1.1 2003/06/30 22:05:18 mychaeel Exp $
//
// Renders a panoramic minimap similar to the scoreboard on a ScriptedTexture.
// ============================================================================


class JBScreenMapPanorama extends JBScreenMap
  placeable
  showcategories(Movement);


// ============================================================================
// Replication
// ============================================================================

replication {

  reliable if (Role == ROLE_Authority)
    RepLocation,
    RepRotation,
    FieldOfView;
  }


// ============================================================================
// Properties
// ============================================================================

var() float FieldOfView;            // field of view for panoramic overview


// ============================================================================
// Variables
// ============================================================================

var private vector RepLocation;     // replicated actor location
var private rotator RepRotation;    // replicated actor rotation

var private Coords CoordsPanorama;  // coordinate system of viewpoint
var private float ScaleDepth;       // field of view depth adjustment


// ============================================================================
// PostBeginPlay
//
// Replicated the actor's location and rotation to clients. Required because
// movement variables are only unreliably replicated and thus haven't reached
// the client already when PostNetBeginPlay is called.
// ============================================================================

event PostBeginPlay() {

  RepLocation = Location;
  RepRotation = Rotation;
  }


// ============================================================================
// PrepareCoords
//
// Prepares the panorama's coordinate system for location translations.
// ============================================================================

simulated protected function bool PrepareCoords() {

  if (FieldOfView <= 0.0)
    return False;

  CoordsPanorama.Origin = RepLocation;

  GetAxes(RepRotation,
    CoordsPanorama.XAxis,
    CoordsPanorama.YAxis,
    CoordsPanorama.ZAxis);

  ScaleDepth = 1.0 / Tan(FieldOfView * Pi / 360.0);
  
  return True;
  }


// ============================================================================
// CalcLocation
//
// Calculates and returns the texture pixel coordinates corresponding to the
// given world coordinates.
// ============================================================================

simulated function vector CalcLocation(vector LocationWorld) {

  local float ScaleLateral;
  local vector LocationIcon;
  
  LocationWorld -= CoordsPanorama.Origin;

  LocationIcon.X = LocationWorld dot CoordsPanorama.YAxis;
  LocationIcon.Y = LocationWorld dot CoordsPanorama.ZAxis;
  LocationIcon.Z = LocationWorld dot CoordsPanorama.XAxis;

  if (LocationIcon.Z == 0.0)
    return vect(0,0,0);  // undefined

  ScaleLateral = ScaleDepth / LocationIcon.Z * SizeScriptedTexture.X / 2;
  LocationIcon.X *=  ScaleLateral;  LocationIcon.X += SizeScriptedTexture.X / 2;
  LocationIcon.Y *= -ScaleLateral;  LocationIcon.Y += SizeScriptedTexture.Y / 2;

  return LocationIcon;
  }


// ============================================================================
// Defaults
// ============================================================================

defaultproperties {

  FieldOfView = 90.0;

  bDirectional = True;
  }

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Di 1.7.2003 00:05:18.000 - Creation time: Do 14.8.2014 09:58:43.037 - Created with UnCodeX