Big patch with header file restructuring, cleanups, and some added comments.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1479 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2005-01-22 01:08:12 +00:00
parent 837dbd7892
commit e6879b8ae1
236 changed files with 3562 additions and 2298 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.4:
- Massive amount of file restructuring and cleanups. Need many more. - SvdB
- Added Intro and Ending slide shows (bug #46); use "-i pc" -Alex
- Cross-fades in OpenGL mode with complex scalers fixed (bug #674) -Alex
- Added doc/devel/dialogs - SvdB
+59 -4
View File
@@ -1228,6 +1228,10 @@ SOURCE=..\sc2code\comm\comandr\restypes.h
SOURCE=..\sc2code\comm\comandr\strings.h
# End Source File
# End Group
# Begin Source File
SOURCE=..\sc2code\comm\commall.h
# End Source File
# Begin Group "druuge.comm"
# PROP Default_Filter ""
@@ -2010,6 +2014,10 @@ SOURCE=..\sc2code\planets\elemdata.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\planets\genall.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\planets\genburv.c
# End Source File
# Begin Source File
@@ -3203,6 +3211,10 @@ SOURCE=..\sc2code\battle.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\battle.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\border.c
# End Source File
# Begin Source File
@@ -3239,6 +3251,9 @@ SOURCE=..\sc2code\collide.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\colors.h
# Begin Source File
SOURCE=..\sc2code\comm.c
# End Source File
# Begin Source File
@@ -3291,6 +3306,10 @@ SOURCE=..\sc2code\dummy.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\dummy.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\element.h
# End Source File
# Begin Source File
@@ -3307,10 +3326,22 @@ SOURCE=..\sc2code\fmv.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\fmv.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\galaxy.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\gameev.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\gameev.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\gameinp.c
# End Source File
# Begin Source File
@@ -3319,6 +3350,10 @@ SOURCE=..\sc2code\gameopt.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\gamestr.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\gendef.c
# End Source File
# Begin Source File
@@ -3367,6 +3402,10 @@ SOURCE=..\sc2code\init.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\init.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\intel.c
# End Source File
# Begin Source File
@@ -3479,10 +3518,18 @@ SOURCE=..\sc2code\settings.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\settings.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\setup.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\setup.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\setupmenu.c
# End Source File
# Begin Source File
@@ -3511,6 +3558,10 @@ SOURCE=..\sc2code\sis.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\sounds.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\sounds.h
# End Source File
# Begin Source File
@@ -3519,6 +3570,10 @@ SOURCE=..\sc2code\starbase.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\strtemp.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\starbase.h
# End Source File
# Begin Source File
@@ -3527,10 +3582,6 @@ SOURCE=..\sc2code\starcon.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\starcon.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\starmap.c
# End Source File
# Begin Source File
@@ -3571,6 +3622,10 @@ SOURCE=..\sc2code\util.c
# End Source File
# Begin Source File
SOURCE=..\sc2code\util.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\velocity.c
# End Source File
# Begin Source File
+11 -8
View File
@@ -19,19 +19,22 @@
* for now there's few options which indicate 3do/pc flavors.
*/
#include "options.h"
#include "port.h"
#include "libs/graphics/gfx_common.h"
#include "file.h"
#include "config.h"
#include "libs/compiler.h"
#include "libs/uio.h"
#include "libs/strlib.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <locale.h>
#include "port.h"
#include "libs/graphics/gfx_common.h"
#include "compiler.h"
#include "options.h"
#include "file.h"
#include "config.h"
#include "libs/uio.h"
#include "libs/strlib.h"
int optWhichMusic;
int optWhichCoarseScan;
+1
View File
@@ -23,6 +23,7 @@
#define OPTIONS_H
#include "port.h"
#include "libs/compiler.h"
#include "libs/uio.h"
#define OPT_3DO 0x01
+8 -9
View File
@@ -1,14 +1,13 @@
uqm_SUBDIRS="comm libs planets ships"
uqm_CFILES="battle.c border.c build.c cleanup.c clock.c collide.c comm.c
commglue.c confirm.c credits.c cyborg.c demo.c displist.c
dummy.c encount.c fmv.c galaxy.c gameinp.c gameopt.c
gendef.c getchar.c globdata.c gravity.c gravwell.c grpinfo.c
hyper.c init.c intel.c intro.c ipdisp.c load.c loadship.c
master.c melee.c menu.c misc.c oscill.c outfit.c pickmele.c
pickship.c plandata.c process.c restart.c save.c settings.c
setup.c setupmenu.c ship.c shipstat.c shipyard.c sis.c starbase.c
starcon.c starmap.c state.c status.c tactrans.c
trans.c util.c velocity.c weapon.c"
commglue.c confirm.c credits.c cyborg.c demo.c displist.c dummy.c
encount.c fmv.c galaxy.c gameev.c gameinp.c gameopt.c gendef.c
getchar.c globdata.c gravity.c gravwell.c grpinfo.c hyper.c init.c
intel.c intro.c ipdisp.c load.c loadship.c master.c melee.c menu.c
misc.c oscill.c outfit.c pickmele.c pickship.c plandata.c process.c
restart.c save.c settings.c setup.c setupmenu.c ship.c shipstat.c
shipyard.c sis.c sounds.c starbase.c starcon.c starmap.c state.c
status.c tactrans.c trans.c uqmdebug.c util.c velocity.c weapon.c"
if [ "$DEBUG" = 1 ]; then
uqm_CFILES="$uqm_CFILES uqmdebug.c"
+11 -2
View File
@@ -16,9 +16,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "libs/graphics/gfx_common.h"
//#include "starcon.h"
#include "battle.h"
#include "controls.h"
#include "init.h"
#include "intel.h"
#include "resinst.h"
#include "setup.h"
#include "settings.h"
#include "sounds.h"
#include "libs/graphics/gfx_common.h"
#include "libs/mathlib.h"
QUEUE disp_q;
SIZE battle_counter;
+29
View File
@@ -0,0 +1,29 @@
/*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _BATTLE_H
#define _BATTLE_H
#include "libs/compiler.h"
#include "displist.h"
extern QUEUE disp_q;
extern SIZE battle_counter;
extern BOOLEAN instantVictory;
extern BOOLEAN Battle (void);
#endif /* _BATTLE_H */
+9 -1
View File
@@ -16,7 +16,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "libs/gfxlib.h"
#include "libs/threadlib.h"
#include "colors.h"
#include "setup.h"
#include "sis.h"
#include "units.h"
#include "util.h"
void
InitSISContexts (void)
+7 -1
View File
@@ -16,7 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "build.h"
#include "races.h"
#include "setup.h"
#include "libs/compiler.h"
#include "libs/mathlib.h"
HSTARSHIP
Build (PQUEUE pQueue, DWORD RaceResIndex, COUNT which_player, BYTE
+4
View File
@@ -19,6 +19,10 @@
#ifndef _BUILD_H
#define _BUILD_H
#include "races.h"
#include "displist.h"
#include "libs/compiler.h"
#define CREW_XOFFS 4
#define ENERGY_XOFFS 52
#define GAUGE_YOFFS (SHIP_INFO_HEIGHT - 10)
+13 -3
View File
@@ -16,7 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "battle.h"
#include "nameref.h"
#include "reslib.h"
#include "gamestr.h"
#include "setup.h"
#include "sounds.h"
#include "libs/sndlib.h"
#include "libs/vidlib.h"
//Added by Chris
@@ -35,6 +41,10 @@ void FreeHyperData (void);
//End Added by Chris
static void UninitContexts (void);
static void UninitKernel (BOOLEAN ships);
void
FreeKernel (void)
{
@@ -56,7 +66,7 @@ FreeKernel (void)
UninitGraphics ();
}
void
static void
UninitContexts (void)
{
UninitQueue (&disp_q);
@@ -66,7 +76,7 @@ UninitContexts (void)
DestroyContext (ReleaseContext (StatusContext));
}
void
static void
UninitKernel (BOOLEAN ships)
{
extern FRAME status;
+8 -1
View File
@@ -16,7 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "gameev.h"
#include "globdata.h"
#include "setup.h"
#include "libs/compiler.h"
#include "libs/gfxlib.h"
#include "libs/tasklib.h"
#include "libs/threadlib.h"
// the running of the game-clock is based on game framerates
// *not* on the system (or translated) timer
+2 -24
View File
@@ -20,33 +20,11 @@
#define _CLOCK_H
#include "libs/tasklib.h"
#include "displist.h"
#define START_YEAR 2155
enum
{
ARILOU_ENTRANCE_EVENT = 0,
ARILOU_EXIT_EVENT,
HYPERSPACE_ENCOUNTER_EVENT,
KOHR_AH_VICTORIOUS_EVENT,
ADVANCE_PKUNK_MISSION,
ADVANCE_THRADD_MISSION,
ZOQFOT_DISTRESS_EVENT,
ZOQFOT_DEATH_EVENT,
SHOFIXTI_RETURN_EVENT,
ADVANCE_UTWIG_SUPOX_MISSION,
KOHR_AH_GENOCIDE_EVENT,
SPATHI_SHIELD_EVENT,
ADVANCE_ILWRATH_MISSION,
ADVANCE_MYCON_MISSION,
ARILOU_UMGAH_CHECK,
YEHAT_REBEL_EVENT,
SLYLANDRO_RAMP_UP,
SLYLANDRO_RAMP_DOWN,
NUM_EVENTS
};
#define UPDATE_DAY (1 << 0)
#define UPDATE_MONTH (1 << 1)
#define UPDATE_YEAR (1 << 2)
+5 -1
View File
@@ -16,8 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "collide.h"
#include "element.h"
#include "races.h"
#include "units.h"
#include "libs/mathlib.h"
//#define DEBUG_COLLIDE
+53
View File
@@ -0,0 +1,53 @@
/*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _COLORS_H
#define _COLORS_H
#define BLACK_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00)
#define LTGRAY_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x14, 0x14), 0x07)
#define DKGRAY_COLOR BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)
#define WHITE_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F)
#define NORMAL_ILLUMINATED_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F)
#define NORMAL_SHADOWED_COLOR BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)
#define HIGHLIGHT_ILLUMINATED_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x0A, 0x0A), 0x0C)
#define HIGHLIGHT_SHADOWED_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04)
#define MENU_BACKGROUND_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x14, 0x14), 0x07)
#define MENU_FOREGROUND_COLOR BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)
#define MENU_TEXT_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00)
#define MENU_HIGHLIGHT_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04)
#define STATUS_ILLUMINATED_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F)
#define STATUS_SHADOWED_COLOR BUILD_COLOR (MAKE_RGB15 (0x0A, 0x0A, 0x0A), 0x08)
#define STATUS_SHAPE_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00)
#define STATUS_SHAPE_OUTLINE_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F)
#define CONTROL_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)
#define ALLIANCE_BACKGROUND_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)
#define HIERARCHY_BACKGROUND_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04)
#define ALLIANCE_TEXT_COLOR BUILD_COLOR (MAKE_RGB15 (0x0A, 0x1F, 0x1F), 0x0B)
#define HIERARCHY_TEXT_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x0A), 0x0E)
#define ALLIANCE_BOX_HIGHLIGHT_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)
#define HIERARCHY_BOX_HIGHLIGHT_COLOR HIERARCHY_BACKGROUND_COLOR
#define MESSAGE_BACKGROUND_COLOR BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x14), 0x01)
#define MESSAGE_TEXT_COLOR BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x0A), 0x0E)
#endif /* _COLORS_H */
+20 -9
View File
@@ -16,18 +16,29 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <ctype.h>
#include "libs/graphics/gfx_common.h"
#include "libs/graphics/drawable.h"
#include "libs/sound/trackplayer.h"
#include "starcon.h"
#include "commglue.h"
#include "options.h"
#include "comm.h"
#include "libs/sound/sound.h"
#include "libs/sound/trackint.h"
#include "build.h"
#include "commglue.h"
#include "controls.h"
#include "encount.h"
#include "endian_uqm.h"
#include "gamestr.h"
#include "options.h"
#include "resinst.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
#include "libs/graphics/drawable.h"
#include "libs/graphics/gfx_common.h"
#include "libs/mathlib.h"
#include "libs/inplib.h"
#include "libs/sound/sound.h"
#include "libs/sound/trackplayer.h"
#include "libs/sound/trackint.h"
#include <ctype.h>
void InitOscilloscope (int x, int y, int width, int height, FRAME_DESC *f);
void SetSliderImage (void *f);
+6 -3
View File
@@ -17,9 +17,12 @@
#ifndef _COMM_H
#define _COMM_H
void init_communication (void);
void uninit_communication (void);
int do_subtitles (UNICODE *pStr);
#include "libs/compiler.h"
extern void init_communication (void);
extern void uninit_communication (void);
extern int do_subtitles (UNICODE *pStr);
extern void AlienTalkSegue (COUNT wait_track);
#endif /* _COMM_H */
+4 -3
View File
@@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/arilou/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/arilou/strings.h"
#include "gameev.h"
static LOCDATA arilou_desc =
{
NULL_PTR, /* init_encounter_func */
+1 -3
View File
@@ -16,10 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/blackur/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/blackur/strings.h"
static LOCDATA blackurq_desc =
+4 -3
View File
@@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/chmmr/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/chmmr/strings.h"
#include "build.h"
static LOCDATA chmmr_desc =
{
NULL_PTR, /* init_encounter_func */
+2 -3
View File
@@ -16,10 +16,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "setup.h"
#include "comm/commall.h"
#include "comm/comandr/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/comandr/strings.h"
#include "libs/graphics/gfx_common.h"
+27
View File
@@ -0,0 +1,27 @@
/*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _COMMALL_H
#define _COMMALL_H
#include "colors.h"
#include "comm.h"
#include "commglue.h"
#include "encount.h"
#include "reslib.h"
#endif /* _COMMALL_H */
+5 -3
View File
@@ -16,12 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/druuge/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/druuge/strings.h"
#include "build.h"
#include "setup.h"
static LOCDATA druuge_desc =
{
NULL_PTR, /* init_encounter_func */
+4 -3
View File
@@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/ilwrath/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/ilwrath/strings.h"
#include "gameev.h"
static LOCDATA ilwrath_desc =
{
NULL_PTR, /* init_encounter_func */
+7 -3
View File
@@ -16,12 +16,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/melnorm/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/melnorm/strings.h"
#include "gameev.h"
#include "setup.h"
#include "libs/inplib.h"
#include "libs/mathlib.h"
//Added by Chris
void DrawCargoStrings (BYTE OldElement, BYTE NewElement);
+5 -3
View File
@@ -16,12 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/mycon/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/mycon/strings.h"
#include "gameev.h"
#include "libs/mathlib.h"
static LOCDATA mycon_desc =
{
NULL_PTR, /* init_encounter_func */
+3 -3
View File
@@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/orz/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/orz/strings.h"
#include "build.h"
static LOCDATA orz_desc =
{
+5 -3
View File
@@ -16,12 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/pkunk/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/pkunk/strings.h"
#include "build.h"
#include "gameev.h"
static LOCDATA pkunk_desc =
{
NULL_PTR, /* init_encounter_func */
+4 -3
View File
@@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/yehat/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/rebel/strings.h"
#include "build.h"
static LOCDATA yehat_desc =
{
NULL_PTR, /* init_encounter_func */
+4 -3
View File
@@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/shofixt/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/shofixt/strings.h"
#include "gameev.h"
static LOCDATA shofixti_desc =
{
NULL_PTR, /* init_encounter_func */
+3 -3
View File
@@ -16,12 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "gameev.h"
#include "comm/commall.h"
#include "comm/slyhome/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/slyhome/strings.h"
static LOCDATA slylandro_desc =
{
NULL_PTR, /* init_encounter_func */
+5 -5
View File
@@ -16,12 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/slyland/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/slyland/strings.h"
#include "battle.h"
#include "setup.h"
static LOCDATA slylandro_desc =
{
NULL_PTR, /* init_encounter_func */
@@ -201,8 +203,6 @@ CombatIsInevitable (RESPONSE_REF R)
}
else if (PLAYER_SAID (R, destruct_code))
{
extern BOOLEAN instantVictory;
NPCPhrase (DESTRUCT_SEQUENCE);
instantVictory = TRUE;
SET_GAME_STATE (BATTLE_SEGUE, 1);
+5 -3
View File
@@ -16,12 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/spathi/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/spahome/strings.h"
#include "build.h"
#include "gameev.h"
static LOCDATA spahome_desc =
{
NULL_PTR, /* init_encounter_func */
+4 -3
View File
@@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/spathi/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/spathi/strings.h"
#include "build.h"
static LOCDATA spathi_desc =
{
NULL_PTR, /* init_encounter_func */
+8 -3
View File
@@ -16,12 +16,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/comandr/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/starbas/strings.h"
#include "build.h"
#include "setup.h"
#include "libs/graphics/gfx_common.h"
#include "libs/inplib.h"
#include "libs/mathlib.h"
#include "libs/inplib.h"
//Added by Chris
+4 -3
View File
@@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/supox/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/supox/strings.h"
#include "build.h"
static LOCDATA supox_desc =
{
NULL_PTR, /* init_encounter_func */
+4 -3
View File
@@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/syreen/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/syreen/strings.h"
#include "build.h"
static LOCDATA syreen_desc =
{
NULL_PTR, /* init_encounter_func */
+4 -3
View File
@@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/talkpet/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/talkpet/strings.h"
#include "build.h"
static LOCDATA talkpet_desc =
{
NULL_PTR, /* init_encounter_func */
+5 -3
View File
@@ -16,12 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/thradd/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/thradd/strings.h"
#include "build.h"
#include "gameev.h"
static LOCDATA thradd_desc =
{
NULL_PTR, /* init_encounter_func */
+4 -3
View File
@@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/umgah/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/umgah/strings.h"
#include "build.h"
static LOCDATA umgah_desc =
{
NULL_PTR, /* init_encounter_func */
+1 -3
View File
@@ -16,10 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/urquan/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/urquan/strings.h"
static LOCDATA urquan_desc =
+5 -3
View File
@@ -16,12 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/utwig/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/utwig/strings.h"
#include "build.h"
#include "gameev.h"
static LOCDATA utwig_desc =
{
NULL_PTR, /* init_encounter_func */
+1 -3
View File
@@ -16,10 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/vux/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/vux/strings.h"
static LOCDATA vux_desc =
+6 -3
View File
@@ -16,12 +16,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/yehat/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/yehat/strings.h"
#include "build.h"
#include "gameev.h"
#include "libs/mathlib.h"
static LOCDATA yehat_desc =
{
NULL_PTR, /* init_encounter_func */
+5 -3
View File
@@ -16,12 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "reslib.h"
#include "comm/commall.h"
#include "comm/zoqfot/resinst.h"
#include "starcon.h"
#include "commglue.h"
#include "comm/zoqfot/strings.h"
#include "build.h"
#include "gameev.h"
#define ZOQ_FG_COLOR WHITE_COLOR
#define ZOQ_BG_COLOR BLACK_COLOR
#define ZOQ_BASE_X (TEXT_X_OFFS + ((SIS_TEXT_WIDTH >> 1) >> 1))
+3 -1
View File
@@ -16,8 +16,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "commglue.h"
#include "races.h"
#include <stdarg.h>
#include <assert.h>
+3
View File
@@ -19,8 +19,11 @@
#ifndef _COMMGLUE_H
#define _COMMGLUE_H
#include "globdata.h"
#include "resinst.h"
#include "libs/sound/trackplayer.h"
extern LOCDATA CommData;
extern int cur_comm;
extern UNICODE shared_phrase_buf[256];
+9 -2
View File
@@ -16,13 +16,20 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <ctype.h>
#include "starcon.h"
#include "controls.h"
#include "commglue.h"
#include "comm.h"
#include "colors.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
#include "libs/graphics/widgets.h"
#include "libs/inplib.h"
#include "libs/sound/trackplayer.h"
#include <ctype.h>
#define CONFIRM_WIN_WIDTH 80
#define CONFIRM_WIN_HEIGHT 22
+10 -4
View File
@@ -19,8 +19,8 @@
#ifndef _CONTROLS_H_
#define _CONTROLS_H_
#include "starcon.h"
#include "compiler.h"
#include "libs/compiler.h"
// Enumerated type for controls
enum {
@@ -75,8 +75,8 @@ typedef UBYTE BATTLE_INPUT_STATE;
#define BATTLE_DOWN ((BATTLE_INPUT_STATE)(1 << 6))
typedef BATTLE_INPUT_STATE (*battle_summary_func) (void);
extern battle_summary_func ComputerInput, HumanInput[NUM_PLAYERS];
extern battle_summary_func PlayerInput[NUM_PLAYERS];
extern battle_summary_func ComputerInput, HumanInput[];
extern battle_summary_func PlayerInput[];
extern CONTROLLER_INPUT_STATE CurrentInputState, PulsedInputState;
extern volatile CONTROLLER_INPUT_STATE ImmediateInputState;
@@ -91,8 +91,14 @@ BOOLEAN PauseGame (void);
BOOLEAN DoConfirmExit (void);
void TFB_Abort (void);
BOOLEAN WaitAnyButtonOrQuit (BOOLEAN CheckSpecial);
extern BOOLEAN ConfirmExit (void);
extern void DoInput (PVOID pInputState, BOOLEAN resetInput);
BATTLE_INPUT_STATE p1_combat_summary (void);
BATTLE_INPUT_STATE p2_combat_summary (void);
extern volatile BOOLEAN GamePaused, ExitRequested;
#endif
+11 -3
View File
@@ -16,11 +16,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "credits.h"
#include "controls.h"
#include "encount.h"
#include "options.h"
#include "oscill.h"
#include "resinst.h"
#include "settings.h"
#include "setup.h"
#include "libs/graphics/gfx_common.h"
#include "libs/sound/sound.h"
#include "oscill.h"
#include "options.h"
void
Credits (void)
@@ -165,3 +172,4 @@ OutTakes (void)
optSubtitles = oldsubtitles;
sliderDisabled = FALSE;
}
+6 -1
View File
@@ -14,6 +14,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _CREDITS_H
#define _CREDITS_H
void OutTakes (void);
void Victory (void);
void Credits (void);
#endif /* _CREDITS_H */
+10 -1
View File
@@ -16,8 +16,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "battle.h"
#include "colors.h"
#include "collide.h"
#include "element.h"
#include "globdata.h"
#include "intel.h"
#include "setup.h"
#include "units.h"
#include "libs/inplib.h"
#include "libs/mathlib.h"
//#define DEBUG_CYBORG
+9 -2
View File
@@ -16,9 +16,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <ctype.h>
#include "starcon.h"
/*
* This file seems to be a collection of functions that don't do
* much.
*/
#include "coderes.h"
#include "races.h"
#include <ctype.h>
MEM_HANDLE
LoadVidInstance (DWORD res)
+31
View File
@@ -0,0 +1,31 @@
/*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _DUMMY_H
#define _DUMMY_H
#include "libs/gfxlib.h"
//extern MEM_HANDLE LoadVidInstance (DWORD res);
//extern DRAWABLE CreatePixmapRegion (FRAME Frame, PPOINT pOrg, SIZE width,
// SIZE height);
extern void SetPrimNextLink (PPRIMITIVE pPrim, COUNT Link);
extern COUNT GetPrimNextLink (PPRIMITIVE pPrim);
#endif /* DUMMY_H */
+1 -9
View File
@@ -19,10 +19,10 @@
#ifndef _ELEMENT_H
#define _ELEMENT_H
#include "battle.h"
#include "displist.h"
#include "velocity.h"
#include "libs/gfxlib.h"
#include "libs/sndlib.h"
#define BATTLE_FRAME_RATE (ONE_SECOND / 24)
@@ -165,14 +165,6 @@ extern BOOLEAN DeltaEnergy (ELEMENTPTR ElementPtr, SIZE
extern BOOLEAN DeltaCrew (ELEMENTPTR ElementPtr, SIZE
crew_delta);
// XXX: To be moved to some separate file.
// Don't forget to remove the '#include "libs/sndlib.h"'
extern void PlaySound (SOUND S, SoundPosition Pos,
ELEMENTPTR PositionalObject, BYTE Priority);
extern void ProcessSound (SOUND Sound, ELEMENTPTR PositionalObject);
extern SoundPosition CalcSoundPosition (ELEMENTPTR ElementPtr);
extern SoundPosition NotPositional (void);
extern void PreProcessStatus (PELEMENT ShipPtr);
extern void PostProcessStatus (PELEMENT ShipPtr);
+18 -3
View File
@@ -16,9 +16,26 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "encount.h"
#include "battle.h"
#include "build.h"
#include "colors.h"
#include "controls.h"
#include "gamestr.h"
#include "globdata.h"
#include "init.h"
#include "intel.h"
#include "nameref.h"
#include "resinst.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
#include "state.h"
#include "libs/graphics/gfx_common.h"
#include "libs/mathlib.h"
#include "libs/inplib.h"
static BOOLEAN
DoSelectAction (PMENU_STATE pMS)
@@ -709,8 +726,6 @@ EncounterBattle (void)
MEM_HANDLE hLastIndex;
ACTIVITY OldActivity;
extern UWORD nth_frame;
extern BOOLEAN LoadSC2Data (void);
extern BOOLEAN FreeSC2Data (void);
LockMutex (GraphicsLock);
+8
View File
@@ -19,6 +19,12 @@
#ifndef _ENCOUNT_H
#define _ENCOUNT_H
#include "displist.h"
#include "libs/gfxlib.h"
#include "planets/planets.h"
#include "races.h"
typedef QUEUE_HANDLE HENCOUNTER;
#define MAX_HYPER_SHIPS 7
@@ -136,6 +142,8 @@ enum
ATTACK
};
extern void EncounterBattle (void);
extern void BuildBattle (COUNT which_player);
extern COUNT InitEncounter (void);
extern COUNT UninitEncounter (void);
+10 -5
View File
@@ -16,17 +16,22 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "fmv.h"
#include "controls.h"
#include "hyper.h"
#include "options.h"
#include "resinst.h"
#include "settings.h"
#include "setup.h"
#include "vidlib.h"
#include "libs/graphics/gfx_common.h"
#include "options.h"
#include "libs/inplib.h"
//Added by Chris
void FreeHyperData (void);
BOOLEAN InitGameKernel (void);
void LoadMasterShipList (void);
//End Added by Chris
+29
View File
@@ -0,0 +1,29 @@
/*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _FMV_H
#define _FMV_H
extern void Logo (void);
extern void Introduction (void);
extern void Victory (void);
#ifdef WANT_SHIP_SPINS
extern void DoShipSpin (COUNT index, MUSIC_REF hMusic);
#endif
#endif /* _FMV_H */
+8 -1
View File
@@ -18,7 +18,14 @@
/* background starfield - used to generate agalaxy.asm */
#include "starcon.h"
#include "element.h"
#include "globdata.h"
#include "init.h"
#include "units.h"
#include "libs/compiler.h"
#include "libs/gfxlib.h"
#include "libs/mathlib.h"
//Added by Chris
+728
View File
@@ -0,0 +1,728 @@
//Copyright Paul Reiche, Fred Ford. 1992-2002
/*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "gameev.h"
#include "build.h"
#include "clock.h"
#include "encount.h"
#include "globdata.h"
#include "hyper.h"
#include "libs/compiler.h"
#include "libs/mathlib.h"
static void arilou_entrance_event (void);
static void arilou_exit_event (void);
static void check_race_growth (void);
static void black_urquan_genocide (void);
static void pkunk_mission (void);
static void thradd_mission (void);
static void ilwrath_mission (void);
static void utwig_supox_mission (void);
static void mycon_mission (void);
void
AddInitialGameEvents (void) {
AddEvent (RELATIVE_EVENT, 0, 1, 0, HYPERSPACE_ENCOUNTER_EVENT);
AddEvent (ABSOLUTE_EVENT, 3, 17, START_YEAR, ARILOU_ENTRANCE_EVENT);
AddEvent (RELATIVE_EVENT, 0, 0, YEARS_TO_KOHRAH_VICTORY,
KOHR_AH_VICTORIOUS_EVENT);
AddEvent (RELATIVE_EVENT, 0, 0, 0, SLYLANDRO_RAMP_UP);
}
void
EventHandler (BYTE selector)
{
switch (selector)
{
case ARILOU_ENTRANCE_EVENT:
arilou_entrance_event ();
break;
case ARILOU_EXIT_EVENT:
arilou_exit_event ();
break;
case HYPERSPACE_ENCOUNTER_EVENT:
check_race_growth ();
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE
&& GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
check_hyperspace_encounter ();
AddEvent (RELATIVE_EVENT, 0, 1, 0, HYPERSPACE_ENCOUNTER_EVENT);
break;
case KOHR_AH_VICTORIOUS_EVENT:
if (GET_GAME_STATE (UTWIG_SUPOX_MISSION))
{
AddEvent (RELATIVE_EVENT, 0, 0, 1, KOHR_AH_GENOCIDE_EVENT);
break;
}
/* FALLTHROUGH */
case KOHR_AH_GENOCIDE_EVENT:
if (!GET_GAME_STATE (KOHR_AH_FRENZY)
&& LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
&& CurStarDescPtr
&& CurStarDescPtr->Index == SAMATRA_DEFINED)
AddEvent (RELATIVE_EVENT, 0, 7, 0, KOHR_AH_GENOCIDE_EVENT);
else
black_urquan_genocide ();
break;
case ADVANCE_PKUNK_MISSION:
pkunk_mission ();
break;
case ADVANCE_THRADD_MISSION:
thradd_mission ();
break;
case ZOQFOT_DISTRESS_EVENT:
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
&& CurStarDescPtr
&& CurStarDescPtr->Index == ZOQFOT_DEFINED)
AddEvent (RELATIVE_EVENT, 0, 7, 0, ZOQFOT_DISTRESS_EVENT);
else
{
SET_GAME_STATE (ZOQFOT_DISTRESS, 1);
AddEvent (RELATIVE_EVENT, 6, 0, 0, ZOQFOT_DEATH_EVENT);
}
break;
case ZOQFOT_DEATH_EVENT:
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
&& CurStarDescPtr
&& CurStarDescPtr->Index == ZOQFOT_DEFINED)
AddEvent (RELATIVE_EVENT, 0, 7, 0, ZOQFOT_DEATH_EVENT);
else if (GET_GAME_STATE (ZOQFOT_DISTRESS))
{
HSTARSHIP hZoqFot;
EXTENDED_SHIP_FRAGMENTPTR ZoqFotPtr;
hZoqFot = GetStarShipFromIndex (&GLOBAL (avail_race_q),
ZOQFOTPIK_SHIP);
ZoqFotPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hZoqFot);
ZoqFotPtr->ShipInfo.actual_strength = 0;
ZoqFotPtr->ShipInfo.ship_flags &= ~(GOOD_GUY | BAD_GUY);
UnlockStarShip ( &GLOBAL (avail_race_q), hZoqFot);
SET_GAME_STATE (ZOQFOT_DISTRESS, 2);
}
break;
case SHOFIXTI_RETURN_EVENT:
ActivateStarShip (SHOFIXTI_SHIP, 0);
GLOBAL (CrewCost) -= 2;
/* crew is not an issue anymore */
SET_GAME_STATE (CREW_PURCHASED0, 0);
SET_GAME_STATE (CREW_PURCHASED1, 0);
break;
case ADVANCE_UTWIG_SUPOX_MISSION:
utwig_supox_mission ();
break;
case SPATHI_SHIELD_EVENT:
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
&& CurStarDescPtr
&& CurStarDescPtr->Index == SPATHI_DEFINED)
AddEvent (RELATIVE_EVENT, 0, 7, 0, SPATHI_SHIELD_EVENT);
else
{
HSTARSHIP hSpathi;
EXTENDED_SHIP_FRAGMENTPTR SpathiPtr;
hSpathi = GetStarShipFromIndex (
&GLOBAL (avail_race_q), SPATHI_SHIP);
SpathiPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hSpathi);
if (SpathiPtr->ShipInfo.actual_strength)
{
ActivateStarShip (SPATHI_SHIP, -1);
SET_GAME_STATE (SPATHI_SHIELDED_SELVES, 1);
SpathiPtr->ShipInfo.actual_strength = 0;
}
UnlockStarShip (&GLOBAL (avail_race_q), hSpathi);
}
break;
case ADVANCE_ILWRATH_MISSION:
ilwrath_mission ();
break;
case ADVANCE_MYCON_MISSION:
mycon_mission ();
break;
case ARILOU_UMGAH_CHECK:
SET_GAME_STATE (ARILOU_CHECKED_UMGAH, 2);
break;
case YEHAT_REBEL_EVENT:
{
HSTARSHIP hRebel, hRoyalist;
EXTENDED_SHIP_FRAGMENTPTR RebelPtr, RoyalistPtr;
hRebel = GetStarShipFromIndex (&GLOBAL (avail_race_q),
YEHAT_REBEL_SHIP);
RebelPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hRebel);
hRoyalist = GetStarShipFromIndex (&GLOBAL (avail_race_q),
YEHAT_SHIP);
RoyalistPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hRoyalist);
RebelPtr->ShipInfo.actual_strength =
RoyalistPtr->ShipInfo.actual_strength =
RoyalistPtr->ShipInfo.actual_strength * 2 / 3;
RebelPtr->ShipInfo.loc.x = 5150;
RebelPtr->ShipInfo.loc.y = 0;
UnlockStarShip (&GLOBAL (avail_race_q), hRoyalist);
UnlockStarShip (&GLOBAL (avail_race_q), hRebel);
ActivateStarShip (YEHAT_REBEL_SHIP, SPHERE_TRACKING);
break;
}
case SLYLANDRO_RAMP_UP:
if (!GET_GAME_STATE (DESTRUCT_CODE_ON_SHIP))
{
BYTE ramp_factor;
ramp_factor = GET_GAME_STATE (SLYLANDRO_MULTIPLIER);
if (++ramp_factor <= 4)
{
SET_GAME_STATE (SLYLANDRO_MULTIPLIER, ramp_factor);
AddEvent (RELATIVE_EVENT, 0, 182, 0, SLYLANDRO_RAMP_UP);
}
}
break;
case SLYLANDRO_RAMP_DOWN:
{
BYTE ramp_factor;
ramp_factor = GET_GAME_STATE (SLYLANDRO_MULTIPLIER);
if (--ramp_factor)
AddEvent (RELATIVE_EVENT, 0, 23, 0, SLYLANDRO_RAMP_DOWN);
SET_GAME_STATE (SLYLANDRO_MULTIPLIER, ramp_factor);
break;
}
}
}
void
SetRaceDest (BYTE which_race, COORD x, COORD y, BYTE days_left, BYTE
func_index)
{
HSTARSHIP hStarShip;
EXTENDED_SHIP_FRAGMENTPTR TemplatePtr;
hStarShip = GetStarShipFromIndex (&GLOBAL (avail_race_q), which_race);
TemplatePtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hStarShip);
TemplatePtr->ShipInfo.dest_loc.x = x;
TemplatePtr->ShipInfo.dest_loc.y = y;
TemplatePtr->ShipInfo.days_left = days_left;
TemplatePtr->ShipInfo.func_index = func_index;
UnlockStarShip (&GLOBAL (avail_race_q), hStarShip);
}
static void
arilou_entrance_event (void)
{
SET_GAME_STATE (ARILOU_SPACE, OPENING);
AddEvent (RELATIVE_EVENT, 0, 3, 0, ARILOU_EXIT_EVENT);
}
static void
arilou_exit_event (void)
{
COUNT month_index, year_index;
year_index = GLOBAL (GameClock.year_index);
if ((month_index = GLOBAL (GameClock.month_index) % 12) == 0)
++year_index;
++month_index;
SET_GAME_STATE (ARILOU_SPACE, CLOSING);
AddEvent (ABSOLUTE_EVENT,
month_index, 17, year_index, ARILOU_ENTRANCE_EVENT);
}
static void
check_race_growth (void)
{
HSTARSHIP hStarShip, hNextShip;
for (hStarShip = GetHeadLink (&GLOBAL (avail_race_q));
hStarShip; hStarShip = hNextShip)
{
EXTENDED_SHIP_FRAGMENTPTR TemplatePtr;
TemplatePtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hStarShip);
hNextShip = _GetSuccLink (TemplatePtr);
if (TemplatePtr->ShipInfo.actual_strength
&& TemplatePtr->ShipInfo.actual_strength != (COUNT)~0)
{
SIZE delta_strength;
delta_strength = (SBYTE)TemplatePtr->ShipInfo.energy_level;
if (TemplatePtr->ShipInfo.growth_err_term <=
TemplatePtr->ShipInfo.growth_fract)
{
if (delta_strength <= 0)
--delta_strength;
else
++delta_strength;
}
TemplatePtr->ShipInfo.growth_err_term -=
TemplatePtr->ShipInfo.growth_fract;
delta_strength += TemplatePtr->ShipInfo.actual_strength;
if (delta_strength <= 0)
{
delta_strength = 0;
TemplatePtr->ShipInfo.ship_flags &= ~(GOOD_GUY | BAD_GUY);
}
else if (delta_strength > MAX_FLEET_STRENGTH)
delta_strength = MAX_FLEET_STRENGTH;
TemplatePtr->ShipInfo.actual_strength = (COUNT)delta_strength;
if (TemplatePtr->ShipInfo.actual_strength &&
TemplatePtr->ShipInfo.days_left)
{
TemplatePtr->ShipInfo.loc.x +=
(TemplatePtr->ShipInfo.dest_loc.x
- TemplatePtr->ShipInfo.loc.x)
/ TemplatePtr->ShipInfo.days_left;
TemplatePtr->ShipInfo.loc.y +=
(TemplatePtr->ShipInfo.dest_loc.y
- TemplatePtr->ShipInfo.loc.y)
/ TemplatePtr->ShipInfo.days_left;
if (--TemplatePtr->ShipInfo.days_left == 0
&& TemplatePtr->ShipInfo.func_index != (BYTE) ~0)
EventHandler (TemplatePtr->ShipInfo.func_index);
}
}
UnlockStarShip (&GLOBAL (avail_race_q), hStarShip);
}
}
static void
black_urquan_genocide (void)
{
BYTE Index;
long best_dist;
SIZE best_dx, best_dy;
HSTARSHIP hStarShip, hNextShip;
HSTARSHIP hBlackUrquan;
EXTENDED_SHIP_FRAGMENTPTR BlackUrquanPtr;
hBlackUrquan = GetStarShipFromIndex (
&GLOBAL (avail_race_q), BLACK_URQUAN_SHIP);
BlackUrquanPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hBlackUrquan);
best_dist = -1;
best_dx = SOL_X - BlackUrquanPtr->ShipInfo.loc.x;
best_dy = SOL_Y - BlackUrquanPtr->ShipInfo.loc.y;
for (Index = 0, hStarShip = GetHeadLink (&GLOBAL (avail_race_q));
hStarShip; ++Index, hStarShip = hNextShip)
{
EXTENDED_SHIP_FRAGMENTPTR TemplatePtr;
TemplatePtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hStarShip);
hNextShip = _GetSuccLink (TemplatePtr);
if (Index != BLACK_URQUAN_SHIP
&& Index != URQUAN_SHIP
&& TemplatePtr->ShipInfo.actual_strength != (COUNT)~0)
{
SIZE dx, dy;
dx = TemplatePtr->ShipInfo.loc.x - BlackUrquanPtr->ShipInfo.loc.x;
dy = TemplatePtr->ShipInfo.loc.y - BlackUrquanPtr->ShipInfo.loc.y;
if (dx == 0 && dy == 0)
{
// Arrived at the victim's home world. Cleanse it.
TemplatePtr->ShipInfo.ship_flags &= ~(GOOD_GUY | BAD_GUY);
TemplatePtr->ShipInfo.actual_strength = 0;
}
else if (TemplatePtr->ShipInfo.actual_strength)
{
long dist;
dist = (long)dx * dx + (long)dy * dy;
if (best_dist < 0 || dist < best_dist || Index == DRUUGE_SHIP)
{
best_dist = dist;
best_dx = dx;
best_dy = dy;
if (Index == DRUUGE_SHIP)
hNextShip = 0;
}
}
}
UnlockStarShip (&GLOBAL (avail_race_q), hStarShip);
}
if (best_dist < 0 && best_dx == 0 && best_dy == 0)
{
// All spheres of influence are gone - game over.
GLOBAL (CurrentActivity) &= ~IN_BATTLE;
GLOBAL_SIS (CrewEnlisted) = (COUNT)~0;
SET_GAME_STATE (KOHR_AH_KILLED_ALL, 1);
}
else
{
// Moving towards new race to cleanse.
COUNT speed;
if (best_dist < 0)
best_dist = (long)best_dx * best_dx + (long)best_dy * best_dy;
speed = square_root (best_dist) / 158;
if (speed == 0)
speed = 1;
else if (speed > 255)
speed = 255;
SET_GAME_STATE (KOHR_AH_FRENZY, 1);
SET_GAME_STATE (KOHR_AH_VISITS, 0);
SET_GAME_STATE (KOHR_AH_REASONS, 0);
SET_GAME_STATE (KOHR_AH_PLEAD, 0);
SET_GAME_STATE (KOHR_AH_INFO, 0);
SET_GAME_STATE (URQUAN_VISITS, 0);
SetRaceDest (BLACK_URQUAN_SHIP,
BlackUrquanPtr->ShipInfo.loc.x + best_dx,
BlackUrquanPtr->ShipInfo.loc.y + best_dy,
(BYTE)speed, KOHR_AH_GENOCIDE_EVENT);
}
UnlockStarShip (&GLOBAL (avail_race_q), hBlackUrquan);
}
static void
pkunk_mission (void)
{
HSTARSHIP hPkunk;
EXTENDED_SHIP_FRAGMENTPTR PkunkPtr;
hPkunk = GetStarShipFromIndex (&GLOBAL (avail_race_q), PKUNK_SHIP);
PkunkPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hPkunk);
if (PkunkPtr->ShipInfo.actual_strength)
{
BYTE MissionState;
MissionState = GET_GAME_STATE (PKUNK_MISSION);
if (PkunkPtr->ShipInfo.days_left == 0 && MissionState)
{
if ((MissionState & 1)
/* made it to Yehat space */
|| (PkunkPtr->ShipInfo.loc.x == 4970
&& PkunkPtr->ShipInfo.loc.y == 400))
PkunkPtr->ShipInfo.actual_strength = 0;
else if (PkunkPtr->ShipInfo.loc.x == 502
&& PkunkPtr->ShipInfo.loc.y == 401
&& GET_GAME_STATE (PKUNK_ON_THE_MOVE))
{
SET_GAME_STATE (PKUNK_ON_THE_MOVE, 0);
AddEvent (RELATIVE_EVENT, 3, 0, 0, ADVANCE_PKUNK_MISSION);
UnlockStarShip (&GLOBAL (avail_race_q), hPkunk);
return;
}
}
if (PkunkPtr->ShipInfo.actual_strength == 0)
{
SET_GAME_STATE (YEHAT_ABSORBED_PKUNK, 1);
PkunkPtr->ShipInfo.ship_flags &= ~(GOOD_GUY | BAD_GUY);
ActivateStarShip (YEHAT_SHIP, SPHERE_TRACKING);
}
else
{
COORD x, y;
if (!(MissionState & 1))
{
x = 4970;
y = 400;
}
else
{
x = 502;
y = 401;
}
SET_GAME_STATE (PKUNK_ON_THE_MOVE, 1);
SET_GAME_STATE (PKUNK_SWITCH, 0);
SetRaceDest (PKUNK_SHIP, x, y,
(BYTE)((365 >> 1) - PkunkPtr->ShipInfo.days_left),
ADVANCE_PKUNK_MISSION);
}
SET_GAME_STATE (PKUNK_MISSION, MissionState + 1);
}
UnlockStarShip (&GLOBAL (avail_race_q), hPkunk);
}
static void
thradd_mission (void)
{
BYTE MissionState;
HSTARSHIP hThradd;
EXTENDED_SHIP_FRAGMENTPTR ThraddPtr;
hThradd = GetStarShipFromIndex (&GLOBAL (avail_race_q), THRADDASH_SHIP);
ThraddPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hThradd);
MissionState = GET_GAME_STATE (THRADD_MISSION);
if (ThraddPtr->ShipInfo.actual_strength && MissionState < 3)
{
if (MissionState & 1)
{
SIZE strength_loss;
AddEvent (RELATIVE_EVENT, 0, 14, 0, ADVANCE_THRADD_MISSION);
strength_loss = (SIZE)(ThraddPtr->ShipInfo.actual_strength >> 1);
ThraddPtr->ShipInfo.energy_level =
(BYTE)(-strength_loss / 14);
ThraddPtr->ShipInfo.growth_fract =
(BYTE)(((strength_loss % 14) << 8) / 14);
ThraddPtr->ShipInfo.growth_err_term = 255 >> 1;
}
else
{
COORD x, y;
if (MissionState == 0)
{
x = 4879;
y = 7201;
}
else
{
x = 2535;
y = 8358;
ThraddPtr->ShipInfo.energy_level = 0;
ThraddPtr->ShipInfo.growth_fract = 0;
}
SetRaceDest (THRADDASH_SHIP, x, y, 14, ADVANCE_THRADD_MISSION);
}
}
SET_GAME_STATE (THRADD_MISSION, MissionState + 1);
UnlockStarShip (&GLOBAL (avail_race_q), hThradd);
}
static void
ilwrath_mission (void)
{
HSTARSHIP hIlwrath, hThradd;
EXTENDED_SHIP_FRAGMENTPTR IlwrathPtr, ThraddPtr;
hIlwrath = GetStarShipFromIndex (&GLOBAL (avail_race_q), ILWRATH_SHIP);
IlwrathPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hIlwrath);
hThradd = GetStarShipFromIndex (&GLOBAL (avail_race_q), THRADDASH_SHIP);
ThraddPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hThradd);
if (IlwrathPtr->ShipInfo.loc.x == ((2500 + 2535) >> 1)
&& IlwrathPtr->ShipInfo.loc.y == ((8070 + 8358) >> 1))
{
IlwrathPtr->ShipInfo.actual_strength =
ThraddPtr->ShipInfo.actual_strength = 0;
IlwrathPtr->ShipInfo.ship_flags &= ~(GOOD_GUY | BAD_GUY);
ThraddPtr->ShipInfo.ship_flags &= ~(GOOD_GUY | BAD_GUY);
}
else if (IlwrathPtr->ShipInfo.actual_strength)
{
if (IlwrathPtr->ShipInfo.dest_loc.x != 2500
|| IlwrathPtr->ShipInfo.dest_loc.y != 8070)
SetRaceDest (ILWRATH_SHIP, 2500, 8070, 90,
ADVANCE_ILWRATH_MISSION);
else
{
#define MADD_LENGTH 128
SIZE strength_loss;
SET_GAME_STATE (ILWRATH_FIGHT_THRADDASH, 1);
SET_GAME_STATE (HELIX_UNPROTECTED, 1);
strength_loss = (SIZE)IlwrathPtr->ShipInfo.actual_strength;
IlwrathPtr->ShipInfo.energy_level =
(BYTE)(-strength_loss / MADD_LENGTH);
IlwrathPtr->ShipInfo.growth_fract =
(BYTE)(((strength_loss % MADD_LENGTH) << 8) / MADD_LENGTH);
SetRaceDest (ILWRATH_SHIP,
(2500 + 2535) >> 1, (8070 + 8358) >> 1,
MADD_LENGTH - 1, ADVANCE_ILWRATH_MISSION);
strength_loss = (SIZE)ThraddPtr->ShipInfo.actual_strength;
ThraddPtr->ShipInfo.energy_level =
(BYTE)(-strength_loss / MADD_LENGTH);
ThraddPtr->ShipInfo.growth_fract =
(BYTE)(((strength_loss % MADD_LENGTH) << 8) / MADD_LENGTH);
SetRaceDest (THRADDASH_SHIP,
(2500 + 2535) >> 1, (8070 + 8358) >> 1,
MADD_LENGTH, (BYTE)~0);
SET_GAME_STATE (THRADD_VISITS, 0);
if (ThraddPtr->ShipInfo.ship_flags & GOOD_GUY)
ActivateStarShip (THRADDASH_SHIP, -1);
}
}
UnlockStarShip (&GLOBAL (avail_race_q), hThradd);
UnlockStarShip (&GLOBAL (avail_race_q), hIlwrath);
}
static void
utwig_supox_mission (void)
{
BYTE MissionState;
HSTARSHIP hUtwig, hSupox;
EXTENDED_SHIP_FRAGMENTPTR UtwigPtr, SupoxPtr;
hUtwig = GetStarShipFromIndex (&GLOBAL (avail_race_q), UTWIG_SHIP);
UtwigPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hUtwig);
hSupox = GetStarShipFromIndex (&GLOBAL (avail_race_q), SUPOX_SHIP);
SupoxPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hSupox);
MissionState = GET_GAME_STATE (UTWIG_SUPOX_MISSION);
if (UtwigPtr->ShipInfo.actual_strength && MissionState < 5)
{
if (MissionState == 1)
{
SIZE strength_loss;
AddEvent (RELATIVE_EVENT, 0, (160 >> 1), 0,
ADVANCE_UTWIG_SUPOX_MISSION);
strength_loss = (SIZE)(UtwigPtr->ShipInfo.actual_strength >> 1);
UtwigPtr->ShipInfo.energy_level =
(BYTE)(-strength_loss / 160);
UtwigPtr->ShipInfo.growth_fract =
(BYTE)(((strength_loss % 160) << 8) / 160);
UtwigPtr->ShipInfo.growth_err_term = 255 >> 1;
strength_loss = (SIZE)(SupoxPtr->ShipInfo.actual_strength >> 1);
if (strength_loss)
{
SupoxPtr->ShipInfo.energy_level =
(BYTE)(-strength_loss / 160);
SupoxPtr->ShipInfo.growth_fract =
(BYTE)(((strength_loss % 160) << 8) / 160);
SupoxPtr->ShipInfo.growth_err_term = 255 >> 1;
}
SET_GAME_STATE (UTWIG_WAR_NEWS, 0);
SET_GAME_STATE (SUPOX_WAR_NEWS, 0);
}
else if (MissionState == 2)
{
AddEvent (RELATIVE_EVENT, 0, (160 >> 1), 0,
ADVANCE_UTWIG_SUPOX_MISSION);
++MissionState;
}
else
{
COORD ux, uy, sx, sy;
if (MissionState == 0)
{
ux = 7208;
uy = 7000;
sx = 6479;
sy = 7541;
}
else
{
ux = 8534;
uy = 8797;
sx = 7468;
sy = 9246;
UtwigPtr->ShipInfo.energy_level = 0;
UtwigPtr->ShipInfo.growth_fract = 0;
SupoxPtr->ShipInfo.energy_level = 0;
SupoxPtr->ShipInfo.growth_fract = 0;
SET_GAME_STATE (UTWIG_WAR_NEWS, 0);
SET_GAME_STATE (SUPOX_WAR_NEWS, 0);
}
SET_GAME_STATE (UTWIG_VISITS, 0);
SET_GAME_STATE (UTWIG_INFO, 0);
SET_GAME_STATE (SUPOX_VISITS, 0);
SET_GAME_STATE (SUPOX_INFO, 0);
SetRaceDest (UTWIG_SHIP, ux, uy, 21, ADVANCE_UTWIG_SUPOX_MISSION);
SetRaceDest (SUPOX_SHIP, sx, sy, 21, (BYTE)~0);
}
}
SET_GAME_STATE (UTWIG_SUPOX_MISSION, MissionState + 1);
UnlockStarShip (&GLOBAL (avail_race_q), hSupox);
UnlockStarShip (&GLOBAL (avail_race_q), hUtwig);
}
static void
mycon_mission (void)
{
HSTARSHIP hMycon;
EXTENDED_SHIP_FRAGMENTPTR MyconPtr;
hMycon = GetStarShipFromIndex (&GLOBAL (avail_race_q), MYCON_SHIP);
MyconPtr = (EXTENDED_SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hMycon);
if (MyconPtr->ShipInfo.actual_strength)
{
if (MyconPtr->ShipInfo.energy_level)
{
SET_GAME_STATE (MYCON_KNOW_AMBUSH, 1);
SetRaceDest (MYCON_SHIP, 6392, 2200, 30, (BYTE)~0);
MyconPtr->ShipInfo.energy_level = 0;
MyconPtr->ShipInfo.growth_fract = 0;
}
else if (MyconPtr->ShipInfo.loc.x != 6858
|| MyconPtr->ShipInfo.loc.y != 577)
SetRaceDest (MYCON_SHIP, 6858, 577, 30, ADVANCE_MYCON_MISSION);
else
{
SIZE strength_loss;
AddEvent (RELATIVE_EVENT, 0, 14, 0, ADVANCE_MYCON_MISSION);
strength_loss = (SIZE)(MyconPtr->ShipInfo.actual_strength >> 1);
MyconPtr->ShipInfo.energy_level =
(BYTE)(-strength_loss / 14);
MyconPtr->ShipInfo.growth_fract =
(BYTE)(((strength_loss % 14) << 8) / 14);
MyconPtr->ShipInfo.growth_err_term = 255 >> 1;
}
}
UnlockStarShip (&GLOBAL (avail_race_q), hMycon);
}
+58
View File
@@ -0,0 +1,58 @@
/*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _GAMEEV_H
#define _GAMEEV_H
#include "libs/compiler.h"
enum
{
ARILOU_ENTRANCE_EVENT = 0,
ARILOU_EXIT_EVENT,
HYPERSPACE_ENCOUNTER_EVENT,
KOHR_AH_VICTORIOUS_EVENT,
ADVANCE_PKUNK_MISSION,
ADVANCE_THRADD_MISSION,
ZOQFOT_DISTRESS_EVENT,
ZOQFOT_DEATH_EVENT,
SHOFIXTI_RETURN_EVENT,
ADVANCE_UTWIG_SUPOX_MISSION,
KOHR_AH_GENOCIDE_EVENT,
SPATHI_SHIELD_EVENT,
ADVANCE_ILWRATH_MISSION,
ADVANCE_MYCON_MISSION,
ARILOU_UMGAH_CHECK,
YEHAT_REBEL_EVENT,
SLYLANDRO_RAMP_UP,
SLYLANDRO_RAMP_DOWN,
NUM_EVENTS
};
typedef enum
{
CLOSING = 0,
OPENING
} ARILOU_GATE_STATE;
extern void AddInitialGameEvents (void);
extern void EventHandler (BYTE selector);
#endif /* _GAMEEV_H */
+9 -1
View File
@@ -16,13 +16,21 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "controls.h"
#include "init.h"
#include "planets/planets.h"
#include "settings.h"
#include "sounds.h"
#include "libs/timelib.h"
#include "libs/threadlib.h"
battle_summary_func ComputerInput, HumanInput[NUM_PLAYERS];
battle_summary_func PlayerInput[NUM_PLAYERS];
#define ACCELERATION_INCREMENT (ONE_SECOND / 12)
#define MENU_REPEAT_DELAY (ONE_SECOND >> 1)
typedef struct
{
+15 -5
View File
@@ -16,13 +16,23 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <ctype.h>
#include "starcon.h"
#include "build.h"
#include "colors.h"
#include "commglue.h"
#include "options.h"
#include "libs/graphics/gfx_common.h"
#include "inplib.h"
#include "controls.h"
#include "encount.h"
#include "gamestr.h"
#include "options.h"
#include "inplib.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
#include "state.h"
#include "util.h"
#include "libs/graphics/gfx_common.h"
#include <ctype.h>
//Added by Chris
+52
View File
@@ -0,0 +1,52 @@
/*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* This file contains definitions relating to using strings specific to
* the game. libs/strlib.h is for the string library.
*/
#ifndef _GAMESTR_H
#define _GAMESTR_H
#include "libs/strlib.h"
#define STAR_STRING_BASE 0
#define DEVICE_STRING_BASE 133
#define CARGO_STRING_BASE 162
#define ELEMENTS_STRING_BASE 172
#define SCAN_STRING_BASE 305
#define STAR_NUMBER_BASE 361
#define PLANET_NUMBER_BASE 375
#define MONTHS_STRING_BASE 407
#define FEEDBACK_STRING_BASE 419
#define STARBASE_STRING_BASE 420
#define ENCOUNTER_STRING_BASE 425
#define NAVIGATION_STRING_BASE 433
#define NAMING_STRING_BASE 439
#define MELEE_STRING_BASE 443
#define SAVEGAME_STRING_BASE 452
#define OPTION_STRING_BASE 455
#define GAME_STRING(i) ((UNICODE *)GetStringAddress (SetAbsStringTableIndex (GameStrings, (i))))
extern STRING GameStrings;
#endif /* _GAMESTR_H */
+1 -1
View File
@@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "encount.h"
PLAN_GEN_FUNC
GenerateIP (BYTE Index)
+2 -1
View File
@@ -17,7 +17,8 @@
*/
#include <ctype.h>
#include "starcon.h"
#include "controls.h"
static UWORD cur_char = ' ';
+19 -10
View File
@@ -16,8 +16,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "globdata.h"
#include "coderes.h"
#include "encount.h"
#include "setup.h"
#include "resinst.h"
#include "build.h"
#include "state.h"
#include "gamestr.h"
#include <stdlib.h>
//Added by Chris
@@ -62,15 +71,15 @@ LoadSC2Data (void)
hOldIndex = SetResourceIndex (hResIndex);
if ((flagship_status = CaptureDrawable (
LoadGraphic (FLAGSTAT_MASK_PMAP_ANIM)
)) == 0)
return (FALSE);
flagship_status = CaptureDrawable (
LoadGraphic (FLAGSTAT_MASK_PMAP_ANIM));
if (flagship_status == NULL)
return FALSE;
if ((misc_data = CaptureDrawable (
LoadGraphic (MISCDATA_MASK_PMAP_ANIM)
)) == 0)
return (FALSE);
misc_data = CaptureDrawable (
LoadGraphic (MISCDATA_MASK_PMAP_ANIM));
if (misc_data == NULL)
return FALSE;
SetResourceIndex (hOldIndex);
}
@@ -83,7 +92,7 @@ LoadSC2Data (void)
GLOBAL (ShipStamp.origin.y) = -1;
}
return (TRUE);
return TRUE;
}
BOOLEAN
+8 -27
View File
@@ -20,6 +20,10 @@
#define _GLOBDATA_H
#include "clock.h"
#include "libs/gfxlib.h"
#include "sis.h"
#include "velocity.h"
#define RANDOM_ANIM (1 << 0)
#define CIRCULAR_ANIM (1 << 1)
@@ -959,38 +963,15 @@ void setGameState (int startBit, int endBit, BYTE val
setGameState ((SName), (END_##SName), (val))
#endif
extern CONTEXT RadarContext;
extern void DiscardStarMap (PVOID CodeRef);
extern void RetrieveStarMap (void);
#define STAR_STRING_BASE 0
#define DEVICE_STRING_BASE 133
#define CARGO_STRING_BASE 162
#define ELEMENTS_STRING_BASE 172
#define SCAN_STRING_BASE 305
#define STAR_NUMBER_BASE 361
#define PLANET_NUMBER_BASE 375
#define MONTHS_STRING_BASE 407
#define FEEDBACK_STRING_BASE 419
#define STARBASE_STRING_BASE 420
#define ENCOUNTER_STRING_BASE 425
#define NAVIGATION_STRING_BASE 433
#define NAMING_STRING_BASE 439
#define MELEE_STRING_BASE 443
#define SAVEGAME_STRING_BASE 452
#define OPTION_STRING_BASE 455
extern void FreeSC2Data (void);
extern BOOLEAN LoadSC2Data (void);
#define GAME_STRING(i) ((UNICODE *)GetStringAddress (SetAbsStringTableIndex (GameStrings, (i))))
#define wsprintf sprintf
#define wstrlen strlen
#define wstrcpy strcpy
#define wstrcat strcat
#define wstrupr strupr
#define wstrncpy strncpy
#define wstricmp stricmp
#define wstrtoul strtoul
#define wstrcspn strcspn
#endif /* _GLOBDATA_H */
+3 -1
View File
@@ -16,8 +16,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "collide.h"
#include "races.h"
#include "units.h"
//#define DEBUG_GRAVITY
+3 -1
View File
@@ -16,7 +16,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "resinst.h"
#include "setup.h"
FRAME planet[NUM_VIEWS];
+11 -2
View File
@@ -16,11 +16,20 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "build.h"
#include "encount.h"
#include "file.h"
#include "globdata.h"
#include "intel.h"
#include "sis.h"
#include "state.h"
#include "libs/mathlib.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "file.h"
//#define DEBUG_GROUPS
+31 -35
View File
@@ -16,9 +16,20 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "build.h"
#include "collide.h"
#include "colors.h"
#include "controls.h"
#include "encount.h"
#include "globdata.h"
#include "init.h"
#include "nameref.h"
#include "resinst.h"
#include "setup.h"
#include "sounds.h"
#include "libs/graphics/gfx_common.h"
#include "libs/mathlib.h"
//Added by Chris
@@ -274,16 +285,13 @@ LoadHyperData (void)
if (hyperstars[0] == 0)
{
hyperstars[0] = CaptureDrawable (
LoadGraphic (AMBIENT_MASK_PMAP_ANIM)
);
LoadGraphic (AMBIENT_MASK_PMAP_ANIM));
hyperstars[1] = CaptureDrawable (
LoadGraphic (HYPERSTARS_MASK_PMAP_ANIM)
);
LoadGraphic (HYPERSTARS_MASK_PMAP_ANIM));
hypercmaps[0] = CaptureColorMap (LoadColorMap (HYPER_COLOR_TAB));
hyperstars[2] = CaptureDrawable (
LoadGraphic (ARISPACE_MASK_PMAP_ANIM)
);
LoadGraphic (ARISPACE_MASK_PMAP_ANIM));
hypercmaps[1] = CaptureColorMap (LoadColorMap (ARISPACE_COLOR_TAB));
}
}
@@ -954,17 +962,12 @@ AddEncounterElement (ENCOUNTERPTR EncounterPtr,
HSTARSHIP hStarShip;
SHIP_FRAGMENTPTR TemplatePtr;
hStarShip = GetStarShipFromIndex (
&GLOBAL (avail_race_q), Type
);
hStarShip = GetStarShipFromIndex (&GLOBAL (avail_race_q), Type);
TemplatePtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
&GLOBAL (avail_race_q), hStarShip);
EncounterPtr->SD.ShipList[i] = TemplatePtr->ShipInfo;
EncounterPtr->SD.ShipList[i].var1 = Type;
UnlockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
UnlockStarShip (&GLOBAL (avail_race_q), hStarShip);
}
@@ -1015,10 +1018,8 @@ AddEncounterElement (ENCOUNTERPTR EncounterPtr,
if (i == 0 || i > NUM_VORTEX_TRANSITIONS)
i = NUM_VORTEX_TRANSITIONS;
ElementPtr->current.image.frame =
SetRelFrameIndex (
ElementPtr->current.image.farray[0], -i
);
ElementPtr->current.image.frame = SetRelFrameIndex (
ElementPtr->current.image.farray[0], -i);
ElementPtr->death_func = encounter_transition;
}
else
@@ -1057,7 +1058,8 @@ DrawHyperGrid (COORD ux, COORD uy, COORD ox,
RECT r;
ClearDrawable ();
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x00, 0x10, 0x00), 0x6B));
SetContextForeGroundColor (
BUILD_COLOR (MAKE_RGB15 (0x00, 0x10, 0x00), 0x6B));
if ((sx = ux - (RADAR_SCAN_WIDTH >> 1)) < 0)
sx = 0;
@@ -1073,22 +1075,20 @@ DrawHyperGrid (COORD ux, COORD uy, COORD ox,
if ((ey = uy + (RADAR_SCAN_HEIGHT >> 1)) > MAX_Y_UNIVERSE + 1)
ey = MAX_Y_UNIVERSE + 1;
r.corner.y = (COORD)((long)(MAX_Y_UNIVERSE - ey)
r.corner.y = (COORD) ((long)(MAX_Y_UNIVERSE - ey)
* RADAR_HEIGHT / RADAR_SCAN_HEIGHT) - oy;
r.extent.width = 1;
r.extent.height = ((COORD)((long)(MAX_Y_UNIVERSE - sy)
* RADAR_HEIGHT / RADAR_SCAN_HEIGHT) - oy)
- r.corner.y + 1;
r.extent.height = ((COORD) ((long)(MAX_Y_UNIVERSE - sy)
* RADAR_HEIGHT / RADAR_SCAN_HEIGHT) - oy) - r.corner.y + 1;
for (ux = sx; ux <= ex; ux += GRID_OFFSET)
{
r.corner.x = (COORD)((long)ux
r.corner.x = (COORD) ((long)ux
* RADAR_WIDTH / RADAR_SCAN_WIDTH) - ox;
DrawFilledRectangle (&r);
} while ((ux += GRID_OFFSET) < ex);
r.corner.x = (COORD)((long)sx
* RADAR_WIDTH / RADAR_SCAN_WIDTH) - ox;
r.extent.width = ((COORD)((long)ex
r.corner.x = (COORD) ((long)sx * RADAR_WIDTH / RADAR_SCAN_WIDTH) - ox;
r.extent.width = ((COORD) ((long)ex
* RADAR_WIDTH / RADAR_SCAN_WIDTH) - ox)
- r.corner.x + 1;
r.extent.height = 1;
@@ -1119,9 +1119,7 @@ ProcessEncounters (PPOINT puniverse, COORD ox,
hNextEncounter = GetSuccEncounter (EncounterPtr);
if (EncounterPtr->hElement == 0
&& AddEncounterElement (
EncounterPtr, puniverse
) == 0)
&& AddEncounterElement (EncounterPtr, puniverse) == 0)
{
DeleteEncounter:
UnlockEncounter (hEncounter);
@@ -1171,13 +1169,11 @@ DeleteEncounter:
COUNT cur_facing, delta_facing;
cur_facing = ANGLE_TO_FACING (
GetVelocityTravelAngle (&ElementPtr->velocity)
);
GetVelocityTravelAngle (&ElementPtr->velocity));
delta_facing = NORMALIZE_FACING (cur_facing
- ANGLE_TO_FACING (ARCTAN (
puniverse->x - EncounterPtr->SD.star_pt.x,
puniverse->y - EncounterPtr->SD.star_pt.y
)));
puniverse->y - EncounterPtr->SD.star_pt.y)));
if (delta_facing || (delta_x == 0 && delta_y == 0))
{
SIZE s, RaceHyperSpeed[] =
+2 -1
View File
@@ -20,7 +20,8 @@
#define _HYPER_H
extern ENCOUNTER_INFO SISinfo;
extern void FreeHyperData (void);
extern void check_hyperspace_encounter (void);
#endif /* _HYPER_H */
+19 -38
View File
@@ -16,19 +16,22 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "build.h"
#include "colors.h"
#include "element.h"
#include "globdata.h"
#include "init.h"
#include "port.h"
#include "starcon.h"
#include "libs/uio.h"
#include "resinst.h"
#include "setup.h"
#include "units.h"
FRAME stars_in_space,
asteroid[NUM_VIEWS],
blast[NUM_VIEWS],
explosion[NUM_VIEWS];
uio_Repository *repository;
uio_DirHandle *rootDir;
BOOLEAN
load_animation (PFRAME pixarray, DWORD big_res, DWORD med_res, DWORD
sml_res)
@@ -78,31 +81,31 @@ InitSpace (void)
if (space_ini_cnt++ == 0
&& LOBYTE (GLOBAL (CurrentActivity)) <= IN_ENCOUNTER)
{
if ((stars_in_space = CaptureDrawable (
LoadGraphic (STAR_MASK_PMAP_ANIM)
)) == 0)
return (FALSE);
stars_in_space = CaptureDrawable (
LoadGraphic (STAR_MASK_PMAP_ANIM));
if (stars_in_space == NULL)
return FALSE;
if (!load_animation (explosion,
BOOM_BIG_MASK_PMAP_ANIM,
BOOM_MED_MASK_PMAP_ANIM,
BOOM_SML_MASK_PMAP_ANIM))
return (FALSE);
return FALSE;
if (!load_animation (blast,
BLAST_BIG_MASK_PMAP_ANIM,
BLAST_MED_MASK_PMAP_ANIM,
BLAST_SML_MASK_PMAP_ANIM))
return (FALSE);
return FALSE;
if (!load_animation (asteroid,
ASTEROID_BIG_MASK_PMAP_ANIM,
ASTEROID_MED_MASK_PMAP_ANIM,
ASTEROID_SML_MASK_PMAP_ANIM))
return (FALSE);
return FALSE;
}
return (TRUE);
return TRUE;
}
void
@@ -272,29 +275,7 @@ InitGlobData (void)
// but it is always cleared before set, so it toggled between
// 2 and 1, which doesn't actually do anything.
GLOBAL (GameClock.clock_sem) = CreateSemaphore(0, "Clock", SYNC_CLASS_TOPLEVEL);
GLOBAL (GameClock.clock_sem) =
CreateSemaphore(0, "Clock", SYNC_CLASS_TOPLEVEL);
}
int
initIO (void)
{
uio_init ();
repository = uio_openRepository (0);
rootDir = uio_openDir(repository, "/", 0);
if (rootDir == NULL) {
fprintf(stderr, "Could not open '/' dir.\n");
return -1;
}
return 0;
}
void
uninitIO (void)
{
uio_closeDir (rootDir);
uio_closeRepository (repository);
uio_unInit ();
}
+29
View File
@@ -0,0 +1,29 @@
/*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _INIT_H
#define _INIT_H
#include "libs/gfxlib.h"
#define NUM_PLAYERS 2
#define NUM_SIDES 2
extern FRAME stars_in_space;
#endif /* _INIT_H */
+5 -1
View File
@@ -16,8 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "intel.h"
#include "controls.h"
#include "globdata.h"
#include "setup.h"
SIZE cur_player;
+15
View File
@@ -20,6 +20,8 @@
#define _INTEL_H
#include "controls.h"
#include "element.h"
#include "races.h"
typedef enum
{
@@ -59,6 +61,7 @@ enum
};
extern STARSHIPPTR CyborgDescPtr;
extern SIZE cur_player;
extern BATTLE_INPUT_STATE computer_intelligence (void);
extern BATTLE_INPUT_STATE tactical_intelligence (void);
@@ -73,5 +76,17 @@ extern void Avoid (ELEMENTPTR ShipPtr, EVALUATE_DESCPTR EvalDescPtr);
extern BOOLEAN TurnShip (ELEMENTPTR ShipPtr, COUNT angle);
extern BOOLEAN ThrustShip (ELEMENTPTR ShipPtr, COUNT angle);
#define HUMAN_CONTROL (BYTE)(1 << 0)
#define CYBORG_CONTROL (BYTE)(1 << 1)
#define PSYTRON_CONTROL (BYTE)(1 << 2)
#define COMPUTER_CONTROL (CYBORG_CONTROL | PSYTRON_CONTROL)
#define STANDARD_RATING (BYTE)(1 << 3)
#define GOOD_RATING (BYTE)(1 << 4)
#define AWESOME_RATING (BYTE)(1 << 5)
#endif /* _INTEL_H */
+7 -67
View File
@@ -16,20 +16,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <ctype.h>
#include "starcon.h"
#include "libs/vidlib.h"
#include "controls.h"
#include "options.h"
#include "settings.h"
#include "setup.h"
#include "sounds.h"
#include "libs/graphics/gfx_common.h"
#include "libs/sound/sound.h"
#include "libs/vidlib.h"
#include "libs/inplib.h"
//Added by Chris
#include <ctype.h>
BOOLEAN InitGameKernel (void);
void LoadMasterShipList (void);
//End Added by Chris
typedef struct
{
@@ -563,62 +561,4 @@ ShowPresentation (char *name)
return TRUE;
}
/* //Already defined in fmv.c
void
Introduction (void)
{
BYTE xform_buf[1];
STAMP s;
DWORD TimeOut;
BOOLEAN InputState;
xform_buf[0] = FadeAllToBlack;
SleepThreadUntil (XFormColorMap (
(COLORMAPPTR)xform_buf, ONE_SECOND / 120));
LockMutex (GraphicsLock);
SetContext (ScreenContext);
s.origin.x = s.origin.y = 0;
s.frame = CaptureDrawable (LoadGraphic (TITLE_ANIM));
DrawStamp (&s);
DestroyDrawable (ReleaseDrawable (s.frame));
UnlockMutex (GraphicsLock);
FlushInput ();
xform_buf[0] = FadeAllToColor;
TimeOut = XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2);
LoadMasterShipList ();
SleepThreadUntil (TimeOut);
GLOBAL (CurrentActivity) |= CHECK_ABORT;
TimeOut += ONE_SECOND * 3;
while (!(InputState = AnyButtonPress (FALSE)) && TaskSwitch () <= TimeOut)
;
GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
xform_buf[0] = FadeAllToBlack;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2));
if (InputState == 0)
DoFMV ("intro", NULL, FALSE);
InitGameKernel ();
}
*/
/* //Already defined in fmv.c
void
Victory (void)
{
BYTE xform_buf[1];
xform_buf[0] = FadeAllToBlack;
SleepThreadUntil (XFormColorMap ((COLORMAPPTR)xform_buf, ONE_SECOND / 2));
DoFMV ("victory", NULL, TRUE);
InitGameKernel ();
}
*/
+12 -16
View File
@@ -16,8 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "starcon.h"
#include "collide.h"
#include "globdata.h"
#include "init.h"
#include "races.h"
#include "libs/mathlib.h"
void
NotifyOthers (COUNT which_race, BYTE target_loc)
@@ -30,8 +34,7 @@ NotifyOthers (COUNT which_race, BYTE target_loc)
SHIP_FRAGMENTPTR StarShipPtr;
StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip
);
&GLOBAL (npc_built_ship_q), hStarShip);
hNextShip = _GetSuccLink (StarShipPtr);
if (GET_RACE_ID (StarShipPtr) == which_race)
@@ -53,8 +56,7 @@ NotifyOthers (COUNT which_race, BYTE target_loc)
#ifdef OLD
target_loc = (BYTE)((
(COUNT)TFB_Random ()
% pSolarSysState->SunDesc[0].NumPlanets
) + 1);
% pSolarSysState->SunDesc[0].NumPlanets) + 1);
#endif /* OLD */
if (!(task & REFORM_GROUP))
{
@@ -62,8 +64,7 @@ NotifyOthers (COUNT which_race, BYTE target_loc)
StarShipPtr->ShipInfo.group_counter = 0;
else
StarShipPtr->ShipInfo.group_counter =
((COUNT)TFB_Random ()
% MAX_REVOLUTIONS)
((COUNT) TFB_Random () % MAX_REVOLUTIONS)
<< FACING_SHIFT;
}
}
@@ -72,9 +73,7 @@ NotifyOthers (COUNT which_race, BYTE target_loc)
SET_GROUP_DEST (StarShipPtr, target_loc);
}
UnlockStarShip (
&GLOBAL (npc_built_ship_q), hStarShip
);
UnlockStarShip (&GLOBAL (npc_built_ship_q), hStarShip);
}
}
@@ -166,7 +165,7 @@ ip_group_preprocess (PELEMENT ElementPtr)
{
if (target_loc == 0 && task != FLEE)
{
/* if intercepting flagship */
/* if intercepting flagship */
target_loc = flagship_loc;
if (EPtr->thrust_wait > TRACK_WAIT)
{
@@ -286,11 +285,8 @@ ip_group_preprocess (PELEMENT ElementPtr)
if (GET_GROUP_DEST (StarShipPtr) == 0)
dest_pt = pSolarSysState->SunDesc[0].location;
else
XFormIPLoc (
&pSolarSysState->PlanetDesc[target_loc - 1].image.origin,
&dest_pt,
FALSE
);
XFormIPLoc (&pSolarSysState->PlanetDesc[
target_loc - 1].image.origin, &dest_pt, FALSE);
}
else
{
+4
View File
@@ -1,2 +1,6 @@
uqm_SUBDIRS="decomp file graphics input math memory resource sound strings
task threads time uio video"
#if [ "$DEBUG" = 1 ]; then
# uqm_SUBDIRS="$UQM_SUBDIRS debug"
#fi
+2
View File
@@ -44,6 +44,8 @@ typedef SWORD SIZE;
typedef SIZE *PSIZE;
typedef unsigned char UNICODE;
#include "strtemp.h"
// XXX: this include should be removed in the future.
#define NULL_PTR 0L
+2 -4
View File
@@ -57,10 +57,8 @@ InitTree (void)
*(MEM_HANDLE *)lson = h;
lson = (PSWORD)((PBYTE)lson + sizeof (h));
rson = lson;
((BYTE *) rson) += (N + 1) * sizeof (lson[0]);
dad = rson;
((BYTE *) dad) += (N + 257) * sizeof (rson[0]);
rson = lson + (N + 1);
dad = rson + (N + 257);
for (i = N + 1; i <= N + 256; i++)
rson[i] = NIL; /* root */
+10
View File
@@ -223,6 +223,16 @@ typedef struct
BYTE type;
} FONTEFFECT;
enum
{
FadeAllToWhite = 250,
FadeSomeToWhite,
FadeAllToBlack,
FadeAllToColor,
FadeSomeToBlack,
FadeSomeToColor
};
#endif /* _GFXLIB_H */
+2
View File
@@ -18,6 +18,8 @@
#include "gfx_common.h"
#include "libs/tasklib.h"
#include <string.h>
static struct
{
+1 -1
View File
@@ -57,7 +57,7 @@ LoadFontFile (PVOID pStr)
return 0;
fp = res_OpenResFile (contentDir, pStr, "rb");
if (fp == ~0)
if (fp == (uio_Stream *) ~0)
{
MEM_HANDLE hData;
+3 -1
View File
@@ -19,7 +19,9 @@
#include "gfxintrn.h"
#include "tfb_prim.h"
extern FRAME Build_Font_Effect (FRAME FramePtr, DWORD from, DWORD to, BYTE type);
extern FRAME Build_Font_Effect (FRAME FramePtr, DWORD from, DWORD to,
BYTE type);
static BYTE char_delta_array[MAX_DELTAS];
@@ -22,7 +22,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "starcon.h"
#include "libs/gfxlib.h"
#include "libs/vidlib.h"
#include "libs/misc.h"
@@ -19,6 +19,8 @@
#include "libs/graphics/sdl/sdl_common.h"
#include "2xscalers.h"
#include "types.h"
static const Uint32 bilinear_table[4][4] =
{
@@ -22,9 +22,11 @@
#include "pure.h"
#include "opengl.h"
#include "primitives.h"
#include "units.h"
#include "graphics/drawcmd.h"
#include "graphics/tfb_draw.h"
int batch_depth = 0;
@@ -4,6 +4,7 @@
#include "libs/graphics/sdl/primitives.h"
#include "libs/graphics/tfb_draw.h"
#include "options.h"
#include "types.h"
typedef SDL_Surface *NativeCanvas;
+17 -5
View File
@@ -24,8 +24,11 @@
#include "libs/graphics/drawcmd.h"
#include "libs/graphics/sdl/dcqueue.h"
static RecursiveMutex DCQ_Mutex;
CondVar RenderingCond;
TFB_DrawCommand DCQ[DCQ_MAX];
TFB_DrawCommandQueue DrawCommandQueue;
@@ -35,7 +38,10 @@ static void
TFB_WaitForSpace (int requested_slots)
{
int old_depth, i;
fprintf (stderr, "DCQ overload (Size = %d, FullSize = %d, Requested = %d). Sleeping until renderer is done.\n", DrawCommandQueue.Size, DrawCommandQueue.FullSize, requested_slots);
fprintf (stderr, "DCQ overload (Size = %d, FullSize = %d, "
"Requested = %d). Sleeping until renderer is done.\n",
DrawCommandQueue.Size, DrawCommandQueue.FullSize,
requested_slots);
// Restore the DCQ locking level. I *think* this is
// always 1, but...
TFB_BatchReset ();
@@ -45,7 +51,8 @@ TFB_WaitForSpace (int requested_slots)
WaitCondVar (RenderingCond);
for (i = 0; i < old_depth; i++)
LockRecursiveMutex (DCQ_Mutex);
fprintf (stderr, "DCQ clear (Size = %d, FullSize = %d). Continuing.\n", DrawCommandQueue.Size, DrawCommandQueue.FullSize);
fprintf (stderr, "DCQ clear (Size = %d, FullSize = %d). Continuing.\n",
DrawCommandQueue.Size, DrawCommandQueue.FullSize);
}
void
@@ -144,7 +151,8 @@ TFB_DrawCommandQueue_Push (TFB_DrawCommand* Command)
{
Lock_DCQ (1);
DCQ[DrawCommandQueue.InsertionPoint] = *Command;
DrawCommandQueue.InsertionPoint = (DrawCommandQueue.InsertionPoint + 1) % DCQ_MAX;
DrawCommandQueue.InsertionPoint = (DrawCommandQueue.InsertionPoint + 1)
% DCQ_MAX;
DrawCommandQueue.FullSize++;
Synchronize_DCQ ();
Unlock_DCQ ();
@@ -161,9 +169,11 @@ TFB_DrawCommandQueue_Pop (TFB_DrawCommand *target)
return (0);
}
if (DrawCommandQueue.Front == DrawCommandQueue.Back && DrawCommandQueue.Size != DCQ_MAX)
if (DrawCommandQueue.Front == DrawCommandQueue.Back &&
DrawCommandQueue.Size != DCQ_MAX)
{
fprintf (stderr, "Augh! Assertion failure in DCQ! Front == Back, Size != DCQ_MAX\n");
fprintf (stderr, "Augh! Assertion failure in DCQ! Front == Back, "
"Size != DCQ_MAX\n");
DrawCommandQueue.Size = 0;
Unlock_DCQ ();
return (0);
@@ -239,3 +249,5 @@ TFB_EnqueueDrawCommand (TFB_DrawCommand* DrawCommand)
}
#endif
@@ -50,4 +50,8 @@
#define DCQ_LIVELOCK_MAX 4096
#endif
extern CondVar RenderingCond;
#endif
+41 -21
View File
@@ -31,6 +31,8 @@
#include "bbox.h"
#include "port.h"
#include "libs/uio.h"
#include "controls.h"
// XXX: Should not be included from here.
#include "uqmdebug.h"
SDL_Surface *SDL_Video;
@@ -60,9 +62,10 @@ void
TFB_PreInit (void)
{
fprintf (stderr, "Initializing base SDL functionality.\n");
fprintf (stderr, "Using SDL version %d.%d.%d (compiled with %d.%d.%d)\n",
SDL_Linked_Version ()->major, SDL_Linked_Version ()->minor, SDL_Linked_Version ()->patch,
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
fprintf (stderr, "Using SDL version %d.%d.%d (compiled with "
"%d.%d.%d)\n", SDL_Linked_Version ()->major,
SDL_Linked_Version ()->minor, SDL_Linked_Version ()->patch,
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1))
{
fprintf (stderr, "Could not initialize SDL: %s.\n", SDL_GetError());
@@ -92,7 +95,8 @@ TFB_InitGraphics (int driver, int flags, int width, int height, int bpp)
result = TFB_GL_InitGraphics (driver, flags, width, height, bpp);
#else
driver = TFB_GFXDRIVER_SDL_PURE;
fprintf (stderr, "OpenGL support not compiled in, so using pure sdl driver\n");
fprintf (stderr, "OpenGL support not compiled in, so using pure "
"sdl driver\n");
result = TFB_Pure_InitGraphics (driver, flags, width, height, bpp);
#endif
}
@@ -113,6 +117,9 @@ TFB_InitGraphics (int driver, int flags, int width, int height, int bpp)
TFB_FlushPaletteCache ();
TFB_DrawCanvas_Initialize ();
RenderingCond = CreateCondVar ("DCQ empty",
SYNC_CLASS_TOPLEVEL | SYNC_CLASS_VIDEO);
return 0;
}
@@ -341,7 +348,8 @@ void TFB_BlitSurface (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
if (nb > 255)
nb = 255;
putpix (dst, dst_x2, dst_y2, SDL_MapRGB (dst->format, nr, ng, nb));
putpix (dst, dst_x2, dst_y2,
SDL_MapRGB (dst->format, nr, ng, nb));
}
}
}
@@ -378,7 +386,8 @@ void TFB_BlitSurface (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
if (nb < 0)
nb = 0;
putpix (dst, dst_x2, dst_y2, SDL_MapRGB (dst->format, nr, ng, nb));
putpix (dst, dst_x2, dst_y2,
SDL_MapRGB (dst->format, nr, ng, nb));
}
}
}
@@ -414,7 +423,8 @@ void TFB_BlitSurface (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst,
if (nb > 255)
nb = 255;
putpix (dst, dst_x2, dst_y2, SDL_MapRGB (dst->format, nr, ng, nb));
putpix (dst, dst_x2, dst_y2,
SDL_MapRGB (dst->format, nr, ng, nb));
}
}
}
@@ -459,7 +469,8 @@ TFB_FlushGraphics () // Only call from main thread!!
int current_transition = TransitionAmount;
if ((current_fade != 255 && current_fade != last_fade) ||
(current_transition != 255 && current_transition != last_transition) ||
(current_transition != 255 &&
current_transition != last_transition) ||
(current_fade == 255 && last_fade != 255) ||
(current_transition == 255 && last_transition != 255))
{
@@ -508,7 +519,8 @@ TFB_FlushGraphics () // Only call from main thread!!
}
++commands_handled;
if (!livelock_deterrence && commands_handled + DrawCommandQueue.Size > DCQ_LIVELOCK_MAX)
if (!livelock_deterrence && commands_handled + DrawCommandQueue.Size
> DCQ_LIVELOCK_MAX)
{
// fprintf (stderr, "Initiating livelock deterrence!\n");
livelock_deterrence = TRUE;
@@ -523,7 +535,8 @@ TFB_FlushGraphics () // Only call from main thread!!
int index = DC.data.setpalette.index;
if (index < 0 || index > 255)
{
fprintf(stderr, "DCQ panic: Tried to set palette #%i", index);
fprintf(stderr, "DCQ panic: Tried to set palette #%i",
index);
}
else
{
@@ -572,9 +585,11 @@ TFB_FlushGraphics () // Only call from main thread!!
int x = DC.data.filledimage.x;
int y = DC.data.filledimage.y;
TFB_DrawCanvas_FilledImage (DC.data.filledimage.image, DC.data.filledimage.x, DC.data.filledimage.y,
DC.data.filledimage.scale, DC.data.filledimage.r, DC.data.filledimage.g,
DC.data.filledimage.b, SDL_Screens[DC.data.filledimage.destBuffer]);
TFB_DrawCanvas_FilledImage (DC.data.filledimage.image,
DC.data.filledimage.x, DC.data.filledimage.y,
DC.data.filledimage.scale, DC.data.filledimage.r,
DC.data.filledimage.g, DC.data.filledimage.b,
SDL_Screens[DC.data.filledimage.destBuffer]);
if (DC.data.filledimage.destBuffer == 0)
{
@@ -595,8 +610,8 @@ TFB_FlushGraphics () // Only call from main thread!!
TFB_BBox_RegisterPoint (DC.data.line.x1, DC.data.line.y1);
TFB_BBox_RegisterPoint (DC.data.line.x2, DC.data.line.y2);
}
TFB_DrawCanvas_Line (DC.data.line.x1, DC.data.line.y1,
DC.data.line.x2, DC.data.line.y2,
TFB_DrawCanvas_Line (DC.data.line.x1, DC.data.line.y1,
DC.data.line.x2, DC.data.line.y2,
DC.data.line.r, DC.data.line.g, DC.data.line.b,
SDL_Screens[DC.data.line.destBuffer]);
break;
@@ -605,8 +620,8 @@ TFB_FlushGraphics () // Only call from main thread!!
{
if (DC.data.rect.destBuffer == 0)
TFB_BBox_RegisterRect (&DC.data.rect.rect);
TFB_DrawCanvas_Rect (&DC.data.rect.rect, DC.data.rect.r,
DC.data.rect.g, DC.data.rect.b,
TFB_DrawCanvas_Rect (&DC.data.rect.rect, DC.data.rect.r,
DC.data.rect.g, DC.data.rect.b,
SDL_Screens[DC.data.rect.destBuffer]);
break;
@@ -635,7 +650,8 @@ TFB_FlushGraphics () // Only call from main thread!!
if (DC_image == 0)
{
fprintf (stderr, "DCQ ERROR: COPYTOIMAGE passed null image ptr\n");
fprintf (stderr, "DCQ ERROR: COPYTOIMAGE passed null "
"image ptr\n");
break;
}
LockMutex (DC_image->mutex);
@@ -647,7 +663,8 @@ TFB_FlushGraphics () // Only call from main thread!!
dest.x = 0;
dest.y = 0;
SDL_BlitSurface(SDL_Screens[DC.data.copytoimage.srcBuffer], &src, DC_image->NormalImg, &dest);
SDL_BlitSurface(SDL_Screens[DC.data.copytoimage.srcBuffer],
&src, DC_image->NormalImg, &dest);
UnlockMutex (DC_image->mutex);
break;
}
@@ -665,7 +682,8 @@ TFB_FlushGraphics () // Only call from main thread!!
TFB_BBox_RegisterPoint (src.x + src.w, src.y + src.h);
}
SDL_BlitSurface(SDL_Screens[DC.data.copy.srcBuffer], &src, SDL_Screens[DC.data.copy.destBuffer], &dest);
SDL_BlitSurface(SDL_Screens[DC.data.copy.srcBuffer], &src,
SDL_Screens[DC.data.copy.destBuffer], &dest);
break;
}
case TFB_DRAWCOMMANDTYPE_DELETEIMAGE:
@@ -678,7 +696,8 @@ TFB_FlushGraphics () // Only call from main thread!!
ClearSemaphore (DC.data.sendsignal.sem);
break;
case TFB_DRAWCOMMANDTYPE_REINITVIDEO:
fprintf (stderr, "TODO: REINITVIDEO command set. Not yet implemented.\n");
fprintf (stderr, "TODO: REINITVIDEO command set. Not yet"
" implemented.\n");
break;
}
}
@@ -707,3 +726,4 @@ TFB_SetGamma (float gamma)
}
#endif
+43 -16
View File
@@ -1,9 +1,28 @@
/*
* 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, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "gfx_common.h"
#include "tfb_draw.h"
#include "drawcmd.h"
#include "units.h"
void
TFB_DrawScreen_Line (int x1, int y1, int x2, int y2, int r, int g, int b, SCREEN dest)
TFB_DrawScreen_Line (int x1, int y1, int x2, int y2, int r, int g, int b,
SCREEN dest)
{
TFB_DrawCommand DC;
@@ -76,7 +95,8 @@ TFB_FlushPaletteCache ()
}
void
TFB_DrawScreen_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *palette, SCREEN dest)
TFB_DrawScreen_Image (TFB_Image *img, int x, int y, int scale,
TFB_Palette *palette, SCREEN dest)
{
TFB_DrawCommand DC;
@@ -101,13 +121,13 @@ TFB_DrawScreen_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *pale
_localpal[i][0] = palette[i].r;
_localpal[i][1] = palette[i].g;
_localpal[i][2] = palette[i].b;
TFB_DrawScreen_SetPalette (i, palette[i].r, palette[i].g,
TFB_DrawScreen_SetPalette (i, palette[i].r, palette[i].g,
palette[i].b);
}
}
// if (changed) { fprintf (stderr, "Actually changing palette! "); }
DC.data.image.UsePalette = TRUE;
}
}
else
{
Lock_DCQ (1);
@@ -121,7 +141,8 @@ TFB_DrawScreen_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *pale
}
void
TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, SCREEN dest)
TFB_DrawScreen_FilledImage (TFB_Image *img, int x, int y, int scale,
int r, int g, int b, SCREEN dest)
{
TFB_DrawCommand DC;
@@ -209,7 +230,8 @@ TFB_DrawScreen_WaitForSignal (void)
}
void
TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height, int bpp)
TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height,
int bpp)
{
TFB_DrawCommand DrawCommand;
DrawCommand.Type = TFB_DRAWCOMMANDTYPE_REINITVIDEO;
@@ -222,7 +244,8 @@ TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height, int bp
}
void
TFB_DrawImage_Line (int x1, int y1, int x2, int y2, int r, int g, int b, TFB_Image *dest)
TFB_DrawImage_Line (int x1, int y1, int x2, int y2, int r, int g, int b,
TFB_Image *dest)
{
LockMutex (dest->mutex);
TFB_DrawCanvas_Line (x1, y1, x2, y2, r, g, b, dest->NormalImg);
@@ -240,7 +263,8 @@ TFB_DrawImage_Rect (PRECT rect, int r, int g, int b, TFB_Image *image)
}
void
TFB_DrawImage_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *palette, TFB_Image *target)
TFB_DrawImage_Image (TFB_Image *img, int x, int y, int scale,
TFB_Palette *palette, TFB_Image *target)
{
LockMutex (target->mutex);
TFB_DrawCanvas_Image (img, x, y, scale, palette, target->NormalImg);
@@ -249,7 +273,8 @@ TFB_DrawImage_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *palet
}
void
TFB_DrawImage_FilledImage (TFB_Image *img, int x, int y, int scale, int r, int g, int b, TFB_Image *target)
TFB_DrawImage_FilledImage (TFB_Image *img, int x, int y, int scale,
int r, int g, int b, TFB_Image *target)
{
LockMutex (target->mutex);
TFB_DrawCanvas_FilledImage (img, x, y, scale, r, g, b, target->NormalImg);
@@ -327,10 +352,12 @@ void
TFB_DrawImage_FixScaling (TFB_Image *image, int target, int type)
{
EXTENT old = image->extent;
TFB_DrawCanvas_GetScaledExtent (image->NormalImg, image->MipmapImg, target, &image->extent);
TFB_DrawCanvas_GetScaledExtent (image->NormalImg, image->MipmapImg,
target, &image->extent);
if ((old.width != image->extent.width) || (old.height != image->extent.height) ||
image->dirty || !image->ScaledImg || type != image->last_scale_type)
if ((old.width != image->extent.width) ||
(old.height != image->extent.height) || image->dirty ||
!image->ScaledImg || type != image->last_scale_type)
{
image->dirty = FALSE;
image->ScaledImg = TFB_DrawCanvas_New_ScaleTarget (image->NormalImg,
@@ -338,10 +365,10 @@ TFB_DrawImage_FixScaling (TFB_Image *image, int target, int type)
image->last_scale_type = type;
if (type == TFB_SCALE_NEAREST)
TFB_DrawCanvas_Rescale_Nearest (image->NormalImg, image->ScaledImg,
image->extent);
TFB_DrawCanvas_Rescale_Nearest (image->NormalImg,
image->ScaledImg, image->extent);
else
TFB_DrawCanvas_Rescale_Trilinear (image->NormalImg, image->ScaledImg,
image->MipmapImg, image->extent);
TFB_DrawCanvas_Rescale_Trilinear (image->NormalImg,
image->ScaledImg, image->MipmapImg, image->extent);
}
}
+3
View File
@@ -21,6 +21,7 @@
#include "libs/threadlib.h"
typedef void *TFB_Canvas;
typedef enum {
@@ -44,6 +45,8 @@ typedef struct tfb_palette
UBYTE unused;
} TFB_Palette;
#include "graphics/gfx_common.h"
typedef struct tfb_image
{
TFB_Canvas NormalImg;
+1 -1
View File
@@ -1,4 +1,4 @@
#include "starcon.h"
#include "graphics/gfx_common.h"
#include "graphics/widgets.h"
void
@@ -20,3 +20,4 @@
#include "inpintrn.h"
volatile BOOLEAN ExitRequested, GamePaused;
+3
View File
@@ -22,6 +22,9 @@
#ifndef MISC_H
#define MISC_H
#include <sys/types.h>
extern void *HMalloc (int size);
extern void HFree (void *p);
extern void *HCalloc (int size);
+2 -1
View File
@@ -289,7 +289,8 @@ load_package (INDEX_HEADERPTR ResHeaderPtr, RES_PACKAGE res_package)
#ifdef DEBUG
if (hData == 0)
fprintf (stderr, "fp = 0x%08lx(%d), type = %u, "
"file_offs = %lu, len = %lu\n", fp,
"file_offs = %lu, len = %lu\n",
(unsigned long) fp,
DanglingOpen, type, file_offs, data_len);
#endif /* DEBUG */
}

Some files were not shown because too many files have changed in this diff Show More