Skip to content

Commit

Permalink
Added helicopter class. Added new mission.
Browse files Browse the repository at this point in the history
  • Loading branch information
slicer69 committed Nov 4, 2011
1 parent 54694da commit 6cefc4a
Show file tree
Hide file tree
Showing 19 changed files with 672 additions and 30 deletions.
2 changes: 1 addition & 1 deletion data/information.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The format for the ships files goes like this:

Type Class Friend Speed Depth Heading Latitude Longitude Sonar Mood

Type determines submarine (0) or ship (1)
Type determines submarine (0) or ship (1) or helicopter (5).
Class must match to a class from the "ships" directory.
Friend tells us which side the ship is on. Zero is a FOE, 1 is a Friend,
2 is unknown and 3 is neutral.
Expand Down
11 changes: 11 additions & 0 deletions data/mission9.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
None
None
None
None
Sink
Sink
Sink
Sink
Sink
None
None
2 changes: 1 addition & 1 deletion data/orders8.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Mission 8
Mission 9
We have quite a storm brewing, Captain. The sea in your
area is full of submarines, both friend and foe. You
are instructed to clear the area of enemy submarines.
Expand Down
6 changes: 6 additions & 0 deletions data/orders9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Mission 10
There is a group of destroyers moving through your sector.
We want you to intercept and sink these ships before they
do any damage. Watch our for enemy submarines, we have reason
to believe there are some in the area, guarding the surface
ships. Good luck!
11 changes: 11 additions & 0 deletions data/ships9.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
0 1 1 5 50 270 135000 140000 75.0
0 1 1 5 150 90 175000 140000 75.0 Attack
0 2 0 10 150 180 160000 150000 75.0 Convoy
0 2 0 10 200 180 170000 150000 75.0 Convoy
1 3 0 10 0 180 155000 160000 75.0 Convoy
1 3 0 10 0 180 155000 165000 75.0 Convoy
1 3 0 10 0 180 145000 160000 75.0 Convoy
1 3 0 10 0 180 145000 165000 75.0 Convoy
1 3 0 10 0 180 150000 162500 75.0 Convoy
5 12 0 10 -20 180 150000 150000 75.0 Attack
5 12 0 10 -20 180 150000 170000 75.0 Attack
1 change: 1 addition & 0 deletions ships/class12.shp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
120 -10 50 4 1 1 360.0 Helicopter H
1 change: 1 addition & 0 deletions ships/information.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ Nimitz CV 8
Tbilisi CV 9
Alpha SSN 10
Ohio SSBN 11
Helicopter 12

6 changes: 3 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
CC = g++
PREFIX ?= /usr
DEVCFLAGS = -Wall -g -D_GNU_SOURCE `sdl-config --cflags`
CFLAGS = -g -Wall `sdl-config --cflags` -Wno-write-strings # -DDEBUGMAP # -DAIDEBUG # -DDEBUG
CFLAGS = -g -Wall `sdl-config --cflags` -Wno-write-strings # -DDEBUG_HELICOPTER # -DDEBUGMAP # -DAIDEBUG # -DDEBUG
LIBS = -lm -lSDL_gfx -lSDL_image -lSDL_mixer `sdl-config --libs`
OBJS = main.o sonar.o radar.o esm.o control.o submarine.o adcap.o coord.o stack.o contact.o towedarray.o targetmotionanalysis.o boatpositionlog.o dfont.o dstack.o message.o gameclock.o files.o mission.o menu.o draw.o sound.o map.o winfunctions.o
OBJS = main.o sonar.o radar.o esm.o control.o submarine.o adcap.o coord.o stack.o contact.o towedarray.o targetmotionanalysis.o boatpositionlog.o dfont.o dstack.o message.o gameclock.o files.o mission.o menu.o draw.o sound.o map.o winfunctions.o helicopter.o
SSN = ../openssn
DATADIR = $(PREFIX)/share/games/openssn
VERSION ?= 0.0

.SUFFIXES: .cpp .o

.cpp.o:
$(CC) $(CFLAGS) -DVERSION=$(VERSION) -DDATADIR=\"$(DATADIR)\" -c $<
$(CC) $(CFLAGS) -DVERSION=$(VERSION) -DDATADIR=\"$(DATADIR)\" -DOPTDIR=\"$(OPTDIR)\" -c $<

.o:
$(CC) $(CLFAGS) $< -o $@
Expand Down
4 changes: 4 additions & 0 deletions src/coord.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
#define MAP_MAX 300000
#endif

#ifndef RADIAN_RATIO
#define RADIAN_RATIO 6.28318530717958647692
#endif

/**
*@author Michael Bridak
*/
Expand Down
4 changes: 1 addition & 3 deletions src/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,11 @@ void DrawDiamond(SDL_Surface *screen, int X1, int Y1, int Size, char Direction,
// Direction: T = Top, B = Bottom, F = Full
int xc, yc;
int size;
char direction;
xc = X1;
yc = Y1;
size = Size;
direction = Direction;

switch(direction){
switch(Direction){

case 'B':
DrawLine(screen, xc-size, yc, xc, yc+size, Color); //bottomleft
Expand Down
9 changes: 9 additions & 0 deletions src/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ char *Find_Data_File(char *filename)
}
*/

// last chance, try OPTDIR
sprintf(location, "%s/%s", OPTDIR, filename);
my_file = fopen(location, "r");
if (my_file)
{
fclose(my_file);
data_dir = OPTDIR;
return location;
}
data_dir = ".";
return filename;
}
Expand Down
3 changes: 3 additions & 0 deletions src/files.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#ifndef DATADIR
#define DATADIR "."
#endif
#ifndef OPTDIR
#define OPTDIR "/opt/openssn"
#endif

// Find the full path of a file based on its name.
// The return value should be freed UNLESS the return
Expand Down
Loading

0 comments on commit 6cefc4a

Please sign in to comment.