File: radar.h

package info (click to toggle)
openssn 1.4-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 7,340 kB
  • sloc: cpp: 10,973; makefile: 80
file content (184 lines) | stat: -rw-r--r-- 4,753 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/***************************************************************************
                             radar.h  -  description
                             -------------------
    begin                : Fri August 2 2001
    copyright            : (C) 2001 by Rick McDaniel
    email                : rickeym@swbell.net
$Id: radar.h,v 1.8 2003/04/14 05:51:04 mbridak Exp $
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License.     *
 *    .                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef RADAR_H
#define RADAR_H

// rdm windows
//#include <iostream>


/**Usage:

1. Make depth < 58 feet (for sea state <= 1).  Must be shallower at higher
   sea states.
2. Raise mast:  radar.RaiseMast()
  *@author Rick McDaniel
  */

class Radar {
   public:

	SDL_Surface *radarscreen;
	SDL_Surface *tempscreen;
	SDL_Surface *blip;
	SDL_Surface *sweep[1];	//only need 1 now
	SDL_Surface *ClearRadar;
	SDL_Rect src, dest;

	bool rangescale10, rangescale20, rangescale30;
	bool rangescale40, rangescale50, rangescale60;

	bool rangering0, rangering5, rangering10;
	bool rangering15, rangering20, rangering25;

	float tick;		//our radar sweep angle
	int ALPHA;

	Radar(Submarine *temp);
	~Radar();

	/** 	Initialize the graphic for this class, *screen is the main
		display screen passed in from main. */

	void InitGraphics(SDL_Surface *screen, SDL_Surface *radarscreen);
	
	void ClearScreen();
	
	void ClearTextBox();

	void LoadWidgets();

	void DisplayWidgets();

	void DisplayContacts();

	void DisplaySweep();
	
	void Sweep(float gametime);

	void DisplayRings();
	
	void ClearRangeScale();

	void ClearRangeRing();

	void ShowData(SDL_Surface *screen, int x, int y);

	int DeltaBearing(int bearing1, int bearing2);
	int ReciprocalBearing(int bearing1);

	void DrawPixel(SDL_Surface *screen, int x, int y, Uint32 color);
	void DrawArc(SDL_Surface *screen, int X1, int Y1, int Radius, int Theta1, int Theta2, Uint32 Color);
	void DrawCircle(SDL_Surface *screen, int X1, int Y1, int Radius, Uint32 Color);

	// Toggle Range Scale
	void ToggleRangeScale10();
	void ToggleRangeScale20();
	void ToggleRangeScale30();
	void ToggleRangeScale40();
	void ToggleRangeScale50();
	void ToggleRangeScale60();

	// Toggle Ring Ring
	void ToggleRangeRing0();
	void ToggleRangeRing5();
	void ToggleRangeRing10();
	void ToggleRangeRing15();
	void ToggleRangeRing20();
	void ToggleRangeRing25();

	void ToggleMast(); // Toggle Mast Status
        void RaiseMast();
        void LowerMast();

  // Set functions
	void setRangeScale(int);  // How far do we want to look!
	void setRangeRing(int);   // Used on the display panel

  // Get functions
	int getRangeScale() const;  // Get current RangeScale
	int getRangeRing() const;   // Get current RangeRing
	bool getMastStatus() const;  // Get the current mast position
	int getAntennaHeight(int, int) const; // Get current mast height
	int getBearing(int);  // Get target bearing
	int getRange(int); // Get target range
	float getRadarHorizon(int ObserverDepth, int TargetHeight, int SeaState);

	bool isTargetVisible(Submarine *, int, int, int, int); // Can we see the target

	SDL_Rect destination_rectangle;
	SDL_Rect source_rectangle;
	SDL_Surface *screen;
	SDL_Surface *range10off;
	SDL_Surface *range10on;
	SDL_Surface *range20off;
	SDL_Surface *range20on;
	SDL_Surface *range30off;
	SDL_Surface *range30on;
	SDL_Surface *range40off;
	SDL_Surface *range40on;
	SDL_Surface *range50off;
	SDL_Surface *range50on;
	SDL_Surface *range60off;
	SDL_Surface *range60on;

	SDL_Surface *ring0off;
	SDL_Surface *ring0on;
	SDL_Surface *ring5off;
	SDL_Surface *ring5on;
	SDL_Surface *ring10off;
	SDL_Surface *ring10on;
	SDL_Surface *ring15off;
	SDL_Surface *ring15on;
	SDL_Surface *ring20off;
	SDL_Surface *ring20on;
	SDL_Surface *ring25off;
	SDL_Surface *ring25on;

	SDL_Surface *mastdownoff;
	SDL_Surface *mastdownon;

	SDL_Surface *mastupoff;
	SDL_Surface *mastupon;

	Submarine *Subs;	

	bool Mast;
	int RangeScale;
	int RangeRing;
	int MastHeight;
	int CurrentAntennaHeight;
	int RadarHorizon;
	int bearing;
	int range;
	int x;
	int y;
	
	int tempint;
	int tempval;
	static char text[120];

	DFont largeFont(const char*, const char *);

	Uint32 orange;
	Uint32 black;
	
};

#endif