서버에서 바로 빌드하고 고칠 수 있게 저장소 줄바꿈을 LF로 맞췄습니다. CRLF로 들어가 있던 sh 빌드 스크립트도 이제 리눅스에서 그대로 돌아갑니다. 내용은 바뀌지 않았습니다.
1567 lines
36 KiB
C
1567 lines
36 KiB
C
#ifndef __WL_DEF_H_
|
|
#define __WL_DEF_H_
|
|
|
|
#define SDL_MAIN_HANDLED
|
|
|
|
// Defines which version shall be built and configures supported extra features
|
|
#include "version.h"
|
|
|
|
#include <assert.h>
|
|
#include <fcntl.h>
|
|
#include <math.h>
|
|
#include <ctype.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#if defined(_arch_dreamcast)
|
|
# include <string.h>
|
|
# include "dc/dc_main.h"
|
|
#elif !defined(_WIN32)
|
|
# include <stdint.h>
|
|
# include <string.h>
|
|
# include <stdarg.h>
|
|
#endif
|
|
|
|
#if !defined O_BINARY
|
|
# define O_BINARY 0
|
|
#endif
|
|
|
|
#pragma pack(1)
|
|
|
|
#if defined(_arch_dreamcast)
|
|
#define YESBUTTONNAME "A"
|
|
#define NOBUTTONNAME "B"
|
|
#define DEFAULT_AUDIO_BUFFER_SIZE 1024
|
|
#elif defined(GP2X)
|
|
#define YESBUTTONNAME "Y"
|
|
#define NOBUTTONNAME "B"
|
|
#define DEFAULT_AUDIO_BUFFER_SIZE 128
|
|
#else
|
|
#ifdef SPANISH
|
|
#define YESBUTTONNAME "S"
|
|
#else
|
|
#define YESBUTTONNAME "Y"
|
|
#endif
|
|
#define NOBUTTONNAME "N"
|
|
#define DEFAULT_AUDIO_BUFFER_SIZE 2048
|
|
#endif
|
|
|
|
#include "foreign.h"
|
|
|
|
#ifndef SPEAR
|
|
#include "audiowl6.h"
|
|
#ifdef UPLOAD
|
|
#include "gfxv_apo.h"
|
|
#else
|
|
#ifdef JAPAN
|
|
#include "gfxv_jap.h"
|
|
#else
|
|
#ifdef GOODTIMES
|
|
#include "gfxv_wl6.h"
|
|
#else
|
|
#include "gfxv_apo.h"
|
|
#endif
|
|
#endif
|
|
#endif
|
|
#else
|
|
#include "audiosod.h"
|
|
#include "gfxv_sod.h"
|
|
#include "f_spear.h"
|
|
#endif
|
|
|
|
#ifndef __cplusplus
|
|
enum
|
|
{
|
|
false,
|
|
true,
|
|
};
|
|
|
|
typedef int8_t bool;
|
|
#endif
|
|
|
|
typedef uint8_t byte;
|
|
typedef uint16_t word;
|
|
typedef int32_t fixed;
|
|
typedef uint32_t longword;
|
|
typedef int8_t boolean;
|
|
|
|
typedef struct
|
|
{
|
|
int x,y;
|
|
} Point;
|
|
|
|
typedef struct
|
|
{
|
|
Point ul,lr;
|
|
} Rect;
|
|
|
|
void Quit (const char *errorStr, ...);
|
|
|
|
#include "pmx.h" /* Paramix: replaces id_pm/sd/in/vl/vh/us/ca and wl_menu */
|
|
#include "wl_utils.h"
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
MACROS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
#define MAPSPOT(x,y,plane) (mapsegs[(plane)][((y) << MAPSHIFT) + (x)])
|
|
#define VALIDAREA(x) ((x) >= AREATILE && (x) < (AREATILE + NUMAREAS))
|
|
|
|
#define SIGN(x) ((x) > 0 ? 1 : -1)
|
|
#define ABS(x) ((int)(x) > 0 ? (x) : -(x))
|
|
#define LABS(x) ((int32_t)(x) > 0 ? (x) : -(x))
|
|
|
|
#define abs(x) ABS((x))
|
|
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
|
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
|
|
|
#define lengthof(x) (sizeof((x)) / sizeof(*(x)))
|
|
#define endof(x) ((x) + lengthof((x)))
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
GLOBAL CONSTANTS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
#define MAXTICS 10
|
|
#define DEMOTICS 4
|
|
|
|
#define WALLSHIFT 6
|
|
|
|
#define BIT_WALL (1 << WALLSHIFT)
|
|
#define BIT_DOOR (1 << (WALLSHIFT + 1))
|
|
#define BIT_ALLTILES (1 << (WALLSHIFT + 2))
|
|
|
|
// the door is the last picture before the sprites
|
|
#define DOORWALL (PMSpriteStart - 8)
|
|
|
|
#define MAXACTORS 150 // max number of nazis, etc / map
|
|
#define MAXSTATS 400 // max number of lamps, bonus, etc
|
|
#define MAXDOORS 64 // max number of sliding doors
|
|
#define MAXWALLTILES 64 // max number of wall tiles
|
|
#define MAXVISABLE 250 // max number of visible sprites
|
|
|
|
#if WALLSHIFT >= 7
|
|
typedef uint16_t tiletype;
|
|
#else
|
|
typedef uint8_t tiletype;
|
|
#endif
|
|
|
|
//
|
|
// tile constants
|
|
//
|
|
|
|
#define ICONARROWS 90
|
|
#define PUSHABLETILE 98
|
|
#define EXITTILE 99 // at end of castle
|
|
#define AREATILE 107 // first of NUMAREAS floor tiles
|
|
#define NUMAREAS 37
|
|
#define ELEVATORTILE 21
|
|
#define AMBUSHTILE 106
|
|
#define ALTELEVATORTILE 107
|
|
|
|
#define NUMBERCHARS 9
|
|
|
|
|
|
//----------------
|
|
|
|
#define EXTRAPOINTS 40000
|
|
|
|
#define RUNSPEED 6000
|
|
|
|
#define HEIGHTRATIO 0.50
|
|
|
|
#ifndef SPEAR
|
|
#define LRpack 8 // # of levels to store in endgame
|
|
#else
|
|
#define LRpack 20
|
|
#endif
|
|
|
|
#define PLAYERSIZE MINDIST // player radius
|
|
#define MINACTORDIST 0x10000l // minimum dist from player center
|
|
// to any actor center
|
|
|
|
#undef M_PI
|
|
#define PI 3.141592657
|
|
#define M_PI PI
|
|
|
|
#define GLOBAL1 (1l<<16)
|
|
#define TILEGLOBAL GLOBAL1
|
|
#define TILESHIFT 16l
|
|
#define UNSIGNEDSHIFT 8
|
|
|
|
#define ANGLES 360 // must be divisable by 4
|
|
#define ANGLEQUAD (ANGLES/4)
|
|
#define FINEANGLES 3600
|
|
#define ANG90 (FINEANGLES/4)
|
|
#define ANG180 (ANG90*2)
|
|
#define ANG270 (ANG90*3)
|
|
#define ANG360 (ANG90*4)
|
|
#define VANG90 (ANGLES/4)
|
|
#define VANG180 (VANG90*2)
|
|
#define VANG270 (VANG90*3)
|
|
#define VANG360 (VANG90*4)
|
|
|
|
#define MINDIST 0x5800l
|
|
|
|
#define MAPSHIFT 6
|
|
#define MAPSIZE (1 << MAPSHIFT)
|
|
#define MAPAREA (MAPSIZE * MAPSIZE)
|
|
|
|
#define TEXTURESHIFT 6
|
|
|
|
#if TEXTURESHIFT == 8
|
|
|
|
#define FIXED2TEXSHIFT 0
|
|
|
|
#elif TEXTURESHIFT == 7
|
|
|
|
#define FIXED2TEXSHIFT 2
|
|
|
|
#else
|
|
|
|
#define FIXED2TEXSHIFT 4
|
|
|
|
#endif
|
|
|
|
#define TEXTURESIZE (1 << TEXTURESHIFT)
|
|
#define TEXTUREMASK (TEXTURESIZE * (TEXTURESIZE - 1))
|
|
|
|
#define NORTH 0
|
|
#define EAST 1
|
|
#define SOUTH 2
|
|
#define WEST 3
|
|
|
|
|
|
#ifdef PARAMIX
|
|
#define STATUSLINES 32 // Paramix: our status bar on the 128 x 128 screen
|
|
#else
|
|
#define STATUSLINES 40
|
|
#endif
|
|
|
|
#define STARTAMMO 8
|
|
|
|
|
|
// object flag values
|
|
|
|
enum objflags
|
|
{
|
|
FL_SHOOTABLE = 0x00000001,
|
|
FL_BONUS = 0x00000002,
|
|
FL_NEVERMARK = 0x00000004,
|
|
FL_VISABLE = 0x00000008,
|
|
FL_ATTACKMODE = 0x00000010,
|
|
FL_FIRSTATTACK = 0x00000020,
|
|
FL_AMBUSH = 0x00000040,
|
|
FL_NONMARK = 0x00000080,
|
|
FL_FULLBRIGHT = 0x00000100,
|
|
#ifdef USE_DIR3DSPR
|
|
// you can choose one of the following values in wl_act1.cpp
|
|
// to make a static sprite a directional 3d sprite
|
|
// (see example at the end of the statinfo array)
|
|
FL_DIR_HORIZ_MID = 0x00000200,
|
|
FL_DIR_HORIZ_FW = 0x00000400,
|
|
FL_DIR_HORIZ_BW = 0x00000600,
|
|
FL_DIR_VERT_MID = 0x00000a00,
|
|
FL_DIR_VERT_FW = 0x00000c00,
|
|
FL_DIR_VERT_BW = 0x00000e00,
|
|
|
|
// these values are just used to improve readability of code
|
|
FL_DIR_NONE = 0x00000000,
|
|
FL_DIR_POS_MID = 0x00000200,
|
|
FL_DIR_POS_FW = 0x00000400,
|
|
FL_DIR_POS_BW = 0x00000600,
|
|
FL_DIR_POS_MASK = 0x00000600,
|
|
FL_DIR_VERT_FLAG = 0x00000800,
|
|
FL_DIR_MASK = 0x00000e00,
|
|
#endif
|
|
// next free bit is 0x00001000
|
|
};
|
|
|
|
|
|
//
|
|
// sprite constants
|
|
//
|
|
|
|
enum
|
|
{
|
|
SPR_DEMO,
|
|
#ifndef APOGEE_1_0
|
|
SPR_DEATHCAM,
|
|
#endif
|
|
//
|
|
// static sprites
|
|
//
|
|
SPR_STAT_0,SPR_STAT_1,SPR_STAT_2,SPR_STAT_3,
|
|
SPR_STAT_4,SPR_STAT_5,SPR_STAT_6,SPR_STAT_7,
|
|
|
|
SPR_STAT_8,SPR_STAT_9,SPR_STAT_10,SPR_STAT_11,
|
|
SPR_STAT_12,SPR_STAT_13,SPR_STAT_14,SPR_STAT_15,
|
|
|
|
SPR_STAT_16,SPR_STAT_17,SPR_STAT_18,SPR_STAT_19,
|
|
SPR_STAT_20,SPR_STAT_21,SPR_STAT_22,SPR_STAT_23,
|
|
|
|
SPR_STAT_24,SPR_STAT_25,SPR_STAT_26,SPR_STAT_27,
|
|
SPR_STAT_28,SPR_STAT_29,SPR_STAT_30,SPR_STAT_31,
|
|
|
|
SPR_STAT_32,SPR_STAT_33,SPR_STAT_34,SPR_STAT_35,
|
|
SPR_STAT_36,SPR_STAT_37,SPR_STAT_38,SPR_STAT_39,
|
|
|
|
SPR_STAT_40,SPR_STAT_41,SPR_STAT_42,SPR_STAT_43,
|
|
SPR_STAT_44,SPR_STAT_45,SPR_STAT_46,SPR_STAT_47,
|
|
|
|
#ifdef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oke and small explosion
|
|
//
|
|
SPR_ROCKET_1,SPR_ROCKET_2,SPR_ROCKET_3,SPR_ROCKET_4,
|
|
SPR_ROCKET_5,SPR_ROCKET_6,SPR_ROCKET_7,SPR_ROCKET_8,
|
|
|
|
SPR_SMOKE_1,SPR_SMOKE_2,SPR_SMOKE_3,SPR_SMOKE_4,
|
|
SPR_BOOM_1,SPR_BOOM_2,SPR_BOOM_3,
|
|
|
|
//
|
|
// Angel of Death's DeathSparks(tm)
|
|
//
|
|
#ifdef SPEAR
|
|
SPR_HROCKET_1,SPR_HROCKET_2,SPR_HROCKET_3,SPR_HROCKET_4,
|
|
SPR_HROCKET_5,SPR_HROCKET_6,SPR_HROCKET_7,SPR_HROCKET_8,
|
|
|
|
SPR_HSMOKE_1,SPR_HSMOKE_2,SPR_HSMOKE_3,SPR_HSMOKE_4,
|
|
SPR_HBOOM_1,SPR_HBOOM_2,SPR_HBOOM_3,
|
|
|
|
SPR_SPARK1,SPR_SPARK2,SPR_SPARK3,SPR_SPARK4,
|
|
#endif
|
|
|
|
#ifndef SPEAR
|
|
//
|
|
// gretel
|
|
//
|
|
SPR_GRETEL_W1,SPR_GRETEL_W2,SPR_GRETEL_W3,SPR_GRETEL_W4,
|
|
SPR_GRETEL_SHOOT1,SPR_GRETEL_SHOOT2,SPR_GRETEL_SHOOT3,SPR_GRETEL_DEAD,
|
|
|
|
SPR_GRETEL_DIE1,SPR_GRETEL_DIE2,SPR_GRETEL_DIE3,
|
|
|
|
//
|
|
// fat face
|
|
//
|
|
SPR_FAT_W1,SPR_FAT_W2,SPR_FAT_W3,SPR_FAT_W4,
|
|
SPR_FAT_SHOOT1,SPR_FAT_SHOOT2,SPR_FAT_SHOOT3,SPR_FAT_SHOOT4,
|
|
|
|
SPR_FAT_DIE1,SPR_FAT_DIE2,SPR_FAT_DIE3,SPR_FAT_DEAD,
|
|
|
|
//
|
|
// bj
|
|
//
|
|
#ifdef APOGEE_1_0
|
|
SPR_BJ_W1=360,
|
|
#elif defined(APOGEE_1_1) && defined(UPLOAD)
|
|
SPR_BJ_W1=406,
|
|
#else
|
|
SPR_BJ_W1,
|
|
#endif
|
|
SPR_BJ_W2,SPR_BJ_W3,SPR_BJ_W4,
|
|
SPR_BJ_JUMP1,SPR_BJ_JUMP2,SPR_BJ_JUMP3,SPR_BJ_JUMP4,
|
|
#else
|
|
//
|
|
// THESE ARE FOR 'SPEAR OF DESTINY'
|
|
//
|
|
|
|
//
|
|
// Trans Grosse
|
|
//
|
|
SPR_TRANS_W1,SPR_TRANS_W2,SPR_TRANS_W3,SPR_TRANS_W4,
|
|
SPR_TRANS_SHOOT1,SPR_TRANS_SHOOT2,SPR_TRANS_SHOOT3,SPR_TRANS_DEAD,
|
|
|
|
SPR_TRANS_DIE1,SPR_TRANS_DIE2,SPR_TRANS_DIE3,
|
|
|
|
//
|
|
// Wilhelm
|
|
//
|
|
SPR_WILL_W1,SPR_WILL_W2,SPR_WILL_W3,SPR_WILL_W4,
|
|
SPR_WILL_SHOOT1,SPR_WILL_SHOOT2,SPR_WILL_SHOOT3,SPR_WILL_SHOOT4,
|
|
|
|
SPR_WILL_DIE1,SPR_WILL_DIE2,SPR_WILL_DIE3,SPR_WILL_DEAD,
|
|
|
|
//
|
|
// UberMutant
|
|
//
|
|
SPR_UBER_W1,SPR_UBER_W2,SPR_UBER_W3,SPR_UBER_W4,
|
|
SPR_UBER_SHOOT1,SPR_UBER_SHOOT2,SPR_UBER_SHOOT3,SPR_UBER_SHOOT4,
|
|
|
|
SPR_UBER_DIE1,SPR_UBER_DIE2,SPR_UBER_DIE3,SPR_UBER_DIE4,
|
|
SPR_UBER_DEAD,
|
|
|
|
//
|
|
// Death Knight
|
|
//
|
|
SPR_DEATH_W1,SPR_DEATH_W2,SPR_DEATH_W3,SPR_DEATH_W4,
|
|
SPR_DEATH_SHOOT1,SPR_DEATH_SHOOT2,SPR_DEATH_SHOOT3,SPR_DEATH_SHOOT4,
|
|
|
|
SPR_DEATH_DIE1,SPR_DEATH_DIE2,SPR_DEATH_DIE3,SPR_DEATH_DIE4,
|
|
SPR_DEATH_DIE5,SPR_DEATH_DIE6,SPR_DEATH_DEAD,
|
|
|
|
//
|
|
// Ghost
|
|
//
|
|
SPR_SPECTRE_W1,SPR_SPECTRE_W2,SPR_SPECTRE_W3,SPR_SPECTRE_W4,
|
|
SPR_SPECTRE_F1,SPR_SPECTRE_F2,SPR_SPECTRE_F3,SPR_SPECTRE_F4,
|
|
|
|
//
|
|
// Angel of Death
|
|
//
|
|
SPR_ANGEL_W1,SPR_ANGEL_W2,SPR_ANGEL_W3,SPR_ANGEL_W4,
|
|
SPR_ANGEL_SHOOT1,SPR_ANGEL_SHOOT2,SPR_ANGEL_TIRED1,SPR_ANGEL_TIRED2,
|
|
|
|
SPR_ANGEL_DIE1,SPR_ANGEL_DIE2,SPR_ANGEL_DIE3,SPR_ANGEL_DIE4,
|
|
SPR_ANGEL_DIE5,SPR_ANGEL_DIE6,SPR_ANGEL_DIE7,SPR_ANGEL_DEAD,
|
|
|
|
#endif
|
|
|
|
//
|
|
// player attack frames
|
|
//
|
|
SPR_KNIFEREADY,SPR_KNIFEATK1,SPR_KNIFEATK2,SPR_KNIFEATK3,
|
|
SPR_KNIFEATK4,
|
|
|
|
SPR_PISTOLREADY,SPR_PISTOLATK1,SPR_PISTOLATK2,SPR_PISTOLATK3,
|
|
SPR_PISTOLATK4,
|
|
|
|
SPR_MACHINEGUNREADY,SPR_MACHINEGUNATK1,SPR_MACHINEGUNATK2,MACHINEGUNATK3,
|
|
SPR_MACHINEGUNATK4,
|
|
|
|
SPR_CHAINREADY,SPR_CHAINATK1,SPR_CHAINATK2,SPR_CHAINATK3,
|
|
SPR_CHAINATK4,
|
|
|
|
};
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
GLOBAL TYPES
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
enum controldirs
|
|
{
|
|
di_north,
|
|
di_east,
|
|
di_south,
|
|
di_west,
|
|
};
|
|
|
|
enum doortypes
|
|
{
|
|
dr_normal,
|
|
dr_lock1,
|
|
dr_lock2,
|
|
dr_lock3,
|
|
dr_lock4,
|
|
dr_elevator,
|
|
};
|
|
|
|
enum activetypes
|
|
{
|
|
ac_badobject = -1,
|
|
ac_no,
|
|
ac_yes,
|
|
ac_allways,
|
|
};
|
|
|
|
enum classtypes
|
|
{
|
|
nothing,
|
|
playerobj,
|
|
inertobj,
|
|
guardobj,
|
|
officerobj,
|
|
ssobj,
|
|
dogobj,
|
|
bossobj,
|
|
schabbobj,
|
|
fakeobj,
|
|
mechahitlerobj,
|
|
mutantobj,
|
|
needleobj,
|
|
fireobj,
|
|
bjobj,
|
|
ghostobj,
|
|
realhitlerobj,
|
|
gretelobj,
|
|
giftobj,
|
|
fatobj,
|
|
rocketobj,
|
|
|
|
spectreobj,
|
|
angelobj,
|
|
transobj,
|
|
uberobj,
|
|
willobj,
|
|
deathobj,
|
|
hrocketobj,
|
|
sparkobj,
|
|
};
|
|
|
|
enum wl_stat_types
|
|
{
|
|
none,
|
|
block,
|
|
bo_gibs,
|
|
bo_alpo,
|
|
bo_firstaid,
|
|
bo_key1,
|
|
bo_key2,
|
|
bo_key3,
|
|
bo_key4,
|
|
bo_cross,
|
|
bo_chalice,
|
|
bo_bible,
|
|
bo_crown,
|
|
bo_clip,
|
|
bo_clip2,
|
|
bo_machinegun,
|
|
bo_chaingun,
|
|
bo_food,
|
|
bo_fullheal,
|
|
bo_25clip,
|
|
bo_spear,
|
|
};
|
|
|
|
enum objdirtypes
|
|
{
|
|
east,
|
|
northeast,
|
|
north,
|
|
northwest,
|
|
west,
|
|
southwest,
|
|
south,
|
|
southeast,
|
|
nodir,
|
|
};
|
|
|
|
|
|
enum enemytypes
|
|
{
|
|
en_guard,
|
|
en_officer,
|
|
en_ss,
|
|
en_dog,
|
|
en_boss,
|
|
en_schabbs,
|
|
en_fake,
|
|
en_hitler,
|
|
en_mutant,
|
|
en_blinky,
|
|
en_clyde,
|
|
en_pinky,
|
|
en_inky,
|
|
en_gretel,
|
|
en_gift,
|
|
en_fat,
|
|
en_spectre,
|
|
en_angel,
|
|
en_trans,
|
|
en_uber,
|
|
en_will,
|
|
en_death,
|
|
|
|
NUMENEMIES
|
|
};
|
|
|
|
|
|
//---------------------
|
|
//
|
|
// trivial actor structure
|
|
//
|
|
//---------------------
|
|
|
|
typedef struct statstruct
|
|
{
|
|
byte tilex,tiley;
|
|
short shapenum; // if shapenum == -1 the obj has been removed
|
|
uint32_t flags;
|
|
byte itemnumber;
|
|
} statobj_t;
|
|
|
|
|
|
//---------------------
|
|
//
|
|
// door actor structure
|
|
//
|
|
//---------------------
|
|
|
|
enum dooractiontypes
|
|
{
|
|
dr_open,dr_closed,dr_opening,dr_closing,
|
|
};
|
|
|
|
typedef struct doorstruct
|
|
{
|
|
byte tilex,tiley;
|
|
boolean vertical;
|
|
byte lock;
|
|
byte action;
|
|
short ticcount;
|
|
uint16_t position; // leading edge of door (0 = closed, 0xffff = fully open)
|
|
} doorobj_t;
|
|
|
|
|
|
//--------------------
|
|
//
|
|
// thinking actor structure
|
|
//
|
|
//--------------------
|
|
|
|
typedef struct objstruct
|
|
{
|
|
int8_t active;
|
|
short ticcount;
|
|
byte obclass;
|
|
struct statestruct *state;
|
|
|
|
uint32_t flags; // FL_SHOOTABLE, etc
|
|
|
|
int32_t distance; // if negative, wait for that door to open
|
|
byte dir;
|
|
|
|
fixed x,y;
|
|
|
|
byte tilex,tiley;
|
|
byte areanumber;
|
|
|
|
short viewx;
|
|
word viewheight;
|
|
fixed transx; // in global coord
|
|
|
|
short angle;
|
|
short hitpoints;
|
|
int32_t speed;
|
|
|
|
short temp1,temp2;
|
|
bool hidden;
|
|
|
|
/**
|
|
//
|
|
// WARNING: DO NOT ADD ANY MEMBERS AFTER THESE!!!
|
|
*/
|
|
struct objstruct *next,*prev;
|
|
} objtype;
|
|
|
|
|
|
typedef struct statestruct
|
|
{
|
|
boolean rotate;
|
|
short shapenum; // a shapenum of -1 means get from ob->temp1
|
|
short tictime;
|
|
void (*think)(objtype *),(*action)(objtype *);
|
|
struct statestruct *next;
|
|
} statetype;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
byte tilex,tiley;
|
|
int16_t viewx;
|
|
int16_t viewheight;
|
|
int16_t shapenum;
|
|
uint32_t flags;
|
|
} visobj_t;
|
|
|
|
|
|
enum buttontypes
|
|
{
|
|
bt_nobutton=-1,
|
|
bt_attack=0,
|
|
bt_strafe,
|
|
bt_run,
|
|
bt_use,
|
|
bt_readyknife,
|
|
bt_readypistol,
|
|
bt_readymachinegun,
|
|
bt_readychaingun,
|
|
bt_nextweapon,
|
|
bt_prevweapon,
|
|
bt_esc,
|
|
bt_pause,
|
|
bt_strafeleft,
|
|
bt_straferight,
|
|
bt_moveforward,
|
|
bt_movebackward,
|
|
bt_turnleft,
|
|
bt_turnright,
|
|
|
|
NUMBUTTONS
|
|
};
|
|
|
|
|
|
enum weapontypes
|
|
{
|
|
wp_knife,
|
|
wp_pistol,
|
|
wp_machinegun,
|
|
wp_chaingun,
|
|
|
|
NUMWEAPONS
|
|
};
|
|
|
|
|
|
enum difficultytypes
|
|
{
|
|
gd_baby,
|
|
gd_easy,
|
|
gd_medium,
|
|
gd_hard,
|
|
};
|
|
|
|
//---------------
|
|
//
|
|
// gamestate structure
|
|
//
|
|
//---------------
|
|
|
|
typedef struct
|
|
{
|
|
short difficulty;
|
|
short mapon;
|
|
int32_t oldscore,score,nextextra;
|
|
short lives;
|
|
short health;
|
|
short ammo;
|
|
short keys;
|
|
int16_t bestweapon,weapon,chosenweapon;
|
|
|
|
short faceframe;
|
|
short attackframe,attackcount,weaponframe;
|
|
|
|
short episode,secretcount,treasurecount,killcount,
|
|
secrettotal,treasuretotal,killtotal;
|
|
int32_t TimeCount;
|
|
int32_t killx,killy;
|
|
boolean victoryflag; // set during victory animations
|
|
} gametype;
|
|
|
|
|
|
enum playstatetypes
|
|
{
|
|
ex_stillplaying,
|
|
ex_completed,
|
|
ex_died,
|
|
ex_warped,
|
|
ex_resetgame,
|
|
ex_loadedgame,
|
|
ex_victorious,
|
|
ex_abort,
|
|
ex_demodone,
|
|
ex_secretlevel,
|
|
};
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_MAIN DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
extern char str[80];
|
|
extern char configdir[256];
|
|
extern char configname[13];
|
|
|
|
extern fixed focallength;
|
|
extern unsigned screenofs;
|
|
extern int viewscreenx,viewscreeny;
|
|
extern int viewwidth;
|
|
extern int viewheight;
|
|
extern short centerx,centery;
|
|
extern int shootdelta;
|
|
|
|
extern int dirangle[9];
|
|
|
|
extern boolean startgame,loadedgame;
|
|
extern int mouseadjustment;
|
|
|
|
//
|
|
// derived constants
|
|
//
|
|
extern int32_t heightnumerator;
|
|
extern fixed scale;
|
|
|
|
//
|
|
// command line parameter variables
|
|
//
|
|
extern boolean param_debugmode;
|
|
extern boolean param_nowait;
|
|
extern int param_difficulty;
|
|
extern int param_tedlevel;
|
|
extern int param_joystickindex;
|
|
extern int param_joystickhat;
|
|
extern int param_samplerate;
|
|
extern int param_audiobuffer;
|
|
extern int param_mission;
|
|
extern boolean param_goodtimes;
|
|
extern boolean param_ignorenumchunks;
|
|
|
|
|
|
void NewGame (int difficulty, int episode);
|
|
void CalcProjection (int32_t focal);
|
|
void NewViewSize (int width);
|
|
boolean SetViewSize (unsigned width, unsigned height);
|
|
boolean LoadTheGame (FILE *file, int x, int y);
|
|
boolean SaveTheGame (FILE *file, int x, int y);
|
|
void ShowViewSize (int width);
|
|
void ShutdownId (void);
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_GAME DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
extern gametype gamestate;
|
|
extern byte bordercol;
|
|
|
|
extern char demoname[13];
|
|
|
|
#ifdef SPEAR
|
|
extern int32_t spearx,speary;
|
|
extern unsigned spearangle;
|
|
extern boolean spearflag;
|
|
#endif
|
|
|
|
void SetupGameLevel (void);
|
|
void GameLoop (void);
|
|
void DrawPlayBorder (void);
|
|
void DrawStatusBorder (byte color);
|
|
void DrawPlayScreen (void);
|
|
void DrawPlayBorderSides (void);
|
|
void ShowActStatus (void);
|
|
|
|
void PlayDemo (int demonumber);
|
|
void RecordDemo (void);
|
|
|
|
#define ClearMemory SD_StopDigitized
|
|
|
|
|
|
// JAB
|
|
#define PlaySoundLocTile(s,tx,ty) PlaySoundLocGlobal(s,(((fixed)(tx) << TILESHIFT) + (TILEGLOBAL/2)),(((fixed)ty << TILESHIFT) + (TILEGLOBAL/2)))
|
|
#define PlaySoundLocActor(s,ob) PlaySoundLocGlobal(s,(ob)->x,(ob)->y)
|
|
void PlaySoundLocGlobal (int s, fixed gx, fixed gy);
|
|
void UpdateSoundLoc (void);
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_PLAY DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
#define BASEMOVE 35
|
|
#define RUNMOVE 70
|
|
#define BASETURN 35
|
|
#define RUNTURN 70
|
|
|
|
#define JOYSCALE 2
|
|
|
|
#ifdef SPEAR
|
|
extern int32_t funnyticount; // FOR FUNNY BJ FACE
|
|
#endif
|
|
|
|
extern int8_t playstate;
|
|
|
|
extern int DebugOk;
|
|
|
|
extern boolean madenoise;
|
|
|
|
extern objtype objlist[MAXACTORS];
|
|
extern objtype *player,*objfreelist;
|
|
|
|
extern tiletype tilemap[MAPSIZE][MAPSIZE]; // wall values only
|
|
extern bool spotvis[MAPSIZE][MAPSIZE];
|
|
extern objtype *actorat[MAPSIZE][MAPSIZE];
|
|
#ifdef REVEALMAP
|
|
extern bool mapseen[MAPSIZE][MAPSIZE];
|
|
#endif
|
|
extern boolean singlestep,godmode,noclip,ammocheat,mapreveal;
|
|
extern int extravbls;
|
|
|
|
extern word mapwidth,mapheight;
|
|
extern unsigned tics;
|
|
extern int lastgamemusicoffset;
|
|
|
|
//
|
|
// control info
|
|
//
|
|
extern boolean mouseenabled,joystickenabled;
|
|
extern int dirscan[4];
|
|
extern int buttonscan[NUMBUTTONS];
|
|
extern int buttonmouse[4];
|
|
extern int buttonjoy[32];
|
|
|
|
extern boolean buttonheld[NUMBUTTONS];
|
|
|
|
extern int viewsize;
|
|
|
|
//
|
|
// current user input
|
|
//
|
|
extern int controlx,controly; // range from -100 to 100
|
|
extern boolean buttonstate[NUMBUTTONS];
|
|
|
|
extern boolean demorecord,demoplayback;
|
|
extern int8_t *demoptr, *lastdemoptr;
|
|
extern void *demobuffer;
|
|
|
|
|
|
|
|
void InitActorList (void);
|
|
objtype *GetNewActor (void);
|
|
void PlayLoop (void);
|
|
void CenterWindow (word w, word h);
|
|
void InitRedShifts (void);
|
|
void FinishPaletteShifts (void);
|
|
void RemoveObj (objtype *gone);
|
|
void PollControls (void);
|
|
int StopMusic (void);
|
|
void StartMusic (void);
|
|
void ContinueMusic (int offs);
|
|
void StartDamageFlash (int damage);
|
|
void StartBonusFlash (void);
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_INTER
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
|
|
typedef struct
|
|
{
|
|
int16_t kill,secret,treasure;
|
|
int32_t time;
|
|
} LRstruct;
|
|
|
|
extern LRstruct LevelRatios[LRpack];
|
|
|
|
void Write (int x, int y, const char *string);
|
|
void NonShareware (void);
|
|
int GetYorN (int x, int y, int pic);
|
|
void IntroScreen (void);
|
|
void PG13 (void);
|
|
void DrawHighScores (void);
|
|
void CheckHighScore (int32_t score, word other);
|
|
void Victory (void);
|
|
void LevelCompleted (void);
|
|
void ClearSplitVWB (void);
|
|
|
|
void PreloadGraphics (void);
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_DEBUG
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
int DebugKeys (void);
|
|
void ViewMap (void);
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_DRAW DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
extern byte *vbuf;
|
|
|
|
extern int32_t lasttimecount;
|
|
extern int32_t frameon;
|
|
extern boolean fizzlein,fpscounter;
|
|
|
|
#if defined(USE_FLOORCEILINGTEX) || defined(USE_CLOUDSKY)
|
|
extern int16_t *spanstart;
|
|
#endif
|
|
extern int16_t *wallheight;
|
|
|
|
//
|
|
// math tables
|
|
//
|
|
extern short *pixelangle;
|
|
#ifdef PARAMIX
|
|
extern const int32_t finetangent[FINEANGLES/4];
|
|
extern const fixed sintable[ANGLES+ANGLES/4];
|
|
extern const fixed *costable;
|
|
#else
|
|
extern int32_t finetangent[FINEANGLES/4];
|
|
extern fixed sintable[ANGLES+ANGLES/4];
|
|
extern fixed *costable;
|
|
#endif
|
|
|
|
//
|
|
// refresh variables
|
|
//
|
|
extern fixed viewx,viewy; // the focal point
|
|
extern fixed viewsin,viewcos;
|
|
|
|
extern int postx;
|
|
extern byte *postsource;
|
|
|
|
extern short midangle;
|
|
|
|
extern word horizwall[MAXWALLTILES],vertwall[MAXWALLTILES];
|
|
|
|
|
|
void ScalePost (void);
|
|
void ThreeDRefresh (void);
|
|
void CalcTics (void);
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_SCALE DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
typedef struct
|
|
{
|
|
word leftpix,rightpix;
|
|
word dataofs[64];
|
|
// table data after dataofs[rightpix-leftpix+1]
|
|
} compshape_t;
|
|
|
|
|
|
void ScaleShape (int xcenter, int shapenum, int height, uint32_t flags);
|
|
void SimpleScaleShape (int xcenter, int shapenum, int height);
|
|
#ifdef USE_DIR3DSPR
|
|
void Transform3DShape (visobj_t *sprite);
|
|
#endif
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_STATE DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
#define TURNTICS 10
|
|
#define SPDPATROL 512
|
|
#define SPDDOG 1500
|
|
|
|
|
|
objtype *SpawnNewObj (unsigned tilex, unsigned tiley, statetype *state);
|
|
void NewState (objtype *ob, statetype *state);
|
|
|
|
boolean TryWalk (objtype *ob);
|
|
void SelectChaseDir (objtype *ob);
|
|
void SelectDodgeDir (objtype *ob);
|
|
void SelectRunDir (objtype *ob);
|
|
void MoveObj (objtype *ob, int32_t move);
|
|
boolean SightPlayer (objtype *ob);
|
|
|
|
void KillActor (objtype *ob);
|
|
void DamageActor (objtype *ob, unsigned damage);
|
|
|
|
boolean CheckLine (objtype *ob);
|
|
boolean CheckSight (objtype *ob);
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_AGENT DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
//
|
|
// player state info
|
|
//
|
|
extern int32_t thrustspeed;
|
|
extern word plux,pluy; // player coordinates scaled to unsigned
|
|
extern objtype *LastAttacker;
|
|
|
|
extern short anglefrac;
|
|
extern int facecount,facetimes;
|
|
|
|
void Thrust (int angle, int32_t speed);
|
|
void SpawnPlayer (int tilex, int tiley, int dir);
|
|
void TakeDamage (int points, objtype *attacker);
|
|
void GivePoints (int32_t points);
|
|
void GetBonus (statobj_t *check);
|
|
void GiveWeapon (int weapon);
|
|
void GiveAmmo (int ammo);
|
|
void GiveKey (int key);
|
|
void StatusDrawFace (unsigned picnum);
|
|
void DrawFace (void);
|
|
void DrawHealth (void);
|
|
void HealSelf (int points);
|
|
void DrawLevel (void);
|
|
void DrawLives (void);
|
|
void GiveExtraMan (void);
|
|
void DrawScore (void);
|
|
void DrawWeapon (void);
|
|
void DrawKeys (void);
|
|
void DrawAmmo (void);
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_ACT1 DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
extern statobj_t statobjlist[MAXSTATS];
|
|
extern statobj_t *laststatobj;
|
|
|
|
extern doorobj_t doorobjlist[MAXDOORS];
|
|
extern doorobj_t *lastdoorobj;
|
|
extern short doornum;
|
|
|
|
extern byte areaconnect[NUMAREAS][NUMAREAS];
|
|
|
|
extern boolean areabyplayer[NUMAREAS];
|
|
|
|
extern word pwallstate;
|
|
extern word pwallpos; // amount a pushable wall has been moved (0-63)
|
|
extern word pwallx,pwally;
|
|
extern byte pwalldir;
|
|
extern tiletype pwalltile;
|
|
|
|
void InitDoorList (void);
|
|
void InitStaticList (void);
|
|
void SpawnStatic (int tilex, int tiley, int type);
|
|
void SpawnDoor (int tilex, int tiley, boolean vertical, int lock);
|
|
void MoveDoors (void);
|
|
void MovePWalls (void);
|
|
void OpenDoor (int door);
|
|
void PlaceItemType (int itemtype, int tilex, int tiley);
|
|
void PushWall (int checkx, int checky, int dir);
|
|
void OperateDoor (int door);
|
|
void InitAreas (void);
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_ACT2 DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
#define s_nakedbody s_static10
|
|
|
|
extern statetype s_grddie1;
|
|
extern statetype s_dogdie1;
|
|
extern statetype s_ofcdie1;
|
|
extern statetype s_mutdie1;
|
|
extern statetype s_ssdie1;
|
|
extern statetype s_bossdie1;
|
|
extern statetype s_schabbdie1;
|
|
extern statetype s_fakedie1;
|
|
extern statetype s_mechadie1;
|
|
extern statetype s_hitlerdie1;
|
|
extern statetype s_greteldie1;
|
|
extern statetype s_giftdie1;
|
|
extern statetype s_fatdie1;
|
|
|
|
extern statetype s_spectredie1;
|
|
extern statetype s_angeldie1;
|
|
extern statetype s_transdie0;
|
|
extern statetype s_uberdie0;
|
|
extern statetype s_willdie1;
|
|
extern statetype s_deathdie1;
|
|
|
|
|
|
extern statetype s_grdchase1;
|
|
extern statetype s_dogchase1;
|
|
extern statetype s_ofcchase1;
|
|
extern statetype s_sschase1;
|
|
extern statetype s_mutchase1;
|
|
extern statetype s_bosschase1;
|
|
extern statetype s_schabbchase1;
|
|
extern statetype s_fakechase1;
|
|
extern statetype s_mechachase1;
|
|
extern statetype s_gretelchase1;
|
|
extern statetype s_giftchase1;
|
|
extern statetype s_fatchase1;
|
|
|
|
extern statetype s_spectrechase1;
|
|
extern statetype s_angelchase1;
|
|
extern statetype s_transchase1;
|
|
extern statetype s_uberchase1;
|
|
extern statetype s_willchase1;
|
|
extern statetype s_deathchase1;
|
|
|
|
extern statetype s_blinkychase1;
|
|
extern statetype s_hitlerchase1;
|
|
|
|
extern statetype s_grdpain;
|
|
extern statetype s_grdpain1;
|
|
extern statetype s_ofcpain;
|
|
extern statetype s_ofcpain1;
|
|
extern statetype s_sspain;
|
|
extern statetype s_sspain1;
|
|
extern statetype s_mutpain;
|
|
extern statetype s_mutpain1;
|
|
|
|
extern statetype s_deathcam;
|
|
|
|
extern statetype s_schabbdeathcam2;
|
|
extern statetype s_hitlerdeathcam2;
|
|
extern statetype s_giftdeathcam2;
|
|
extern statetype s_fatdeathcam2;
|
|
|
|
void SpawnStand (int which, int tilex, int tiley, int dir);
|
|
void SpawnPatrol (int which, int tilex, int tiley, int dir);
|
|
|
|
void SpawnDeadGuard (int tilex, int tiley);
|
|
void SpawnBoss (int tilex, int tiley);
|
|
void SpawnGretel (int tilex, int tiley);
|
|
void SpawnTrans (int tilex, int tiley);
|
|
void SpawnUber (int tilex, int tiley);
|
|
void SpawnWill (int tilex, int tiley);
|
|
void SpawnDeath (int tilex, int tiley);
|
|
void SpawnAngel (int tilex, int tiley);
|
|
void SpawnSpectre (int tilex, int tiley);
|
|
void SpawnGhosts (int which, int tilex, int tiley);
|
|
void SpawnSchabbs (int tilex, int tiley);
|
|
void SpawnGift (int tilex, int tiley);
|
|
void SpawnFat (int tilex, int tiley);
|
|
void SpawnFakeHitler (int tilex, int tiley);
|
|
void SpawnHitler (int tilex, int tiley);
|
|
|
|
void A_DeathScream (objtype *ob);
|
|
void SpawnBJVictory (void);
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
WL_TEXT DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
extern char helpfilename[13],endfilename[13];
|
|
|
|
extern void HelpScreens (void);
|
|
extern void EndText (void);
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
GP2X DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
#if defined(GP2X)
|
|
|
|
#if defined(GP2X_940)
|
|
void GP2X_MemoryInit (void);
|
|
void GP2X_Shutdown (void);
|
|
#endif
|
|
void GP2X_ButtonDown (int button);
|
|
void GP2X_ButtonUp (int button);
|
|
|
|
#endif
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
MISC DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
#ifdef PLAYDEMOLIKEORIGINAL
|
|
#define DEMOCHOOSE_ORIG_SDL(orig, sdl) ((demorecord || demoplayback) ? (orig) : (sdl))
|
|
#define DEMOCOND_ORIG (demorecord || demoplayback)
|
|
#define DEMOIF_SDL if(DEMOCOND_SDL)
|
|
#else
|
|
#define DEMOCHOOSE_ORIG_SDL(orig, sdl) (sdl)
|
|
#define DEMOCOND_ORIG false
|
|
#define DEMOIF_SDL
|
|
#endif
|
|
#define DEMOCOND_SDL (!DEMOCOND_ORIG)
|
|
|
|
#define GetTicks() ((SDL_GetTicks()*7)/100)
|
|
|
|
#define ISPOINTER(x) ((((uintptr_t)(x)) & ~0xffff) != 0)
|
|
|
|
#if defined(PARAMIX)
|
|
/* Paramix: newlib knows itoa; the original wrappers also used strlen of an empty buffer */
|
|
static inline char *pmx_itoa (long value, char *string) { snprintf (string, 12, "%ld", value); return string; }
|
|
#define itoa(v, s, r) pmx_itoa ((long)(v), (s))
|
|
#define ltoa(v, s, r) pmx_itoa ((long)(v), (s))
|
|
#elif !defined(_WIN32)
|
|
static inline char *itoa (int value, char *string, int radix)
|
|
{
|
|
int len = strlen(string) + 1;
|
|
|
|
snprintf (string,len,"%d",value);
|
|
|
|
return string;
|
|
}
|
|
|
|
static inline char *ltoa (long value, char *string, int radix)
|
|
{
|
|
int len = strlen(string) + 1;
|
|
|
|
snprintf (string,len,"%ld",value);
|
|
|
|
return string;
|
|
}
|
|
#endif
|
|
|
|
|
|
/*
|
|
=============================================================================
|
|
|
|
FEATURE DEFINITIONS
|
|
|
|
=============================================================================
|
|
*/
|
|
|
|
#ifdef USE_FEATUREFLAGS
|
|
// The currently available feature flags
|
|
#define FF_STARSKY 0x0001
|
|
#define FF_PARALLAXSKY 0x0002
|
|
#define FF_CLOUDSKY 0x0004
|
|
#define FF_RAIN 0x0010
|
|
#define FF_SNOW 0x0020
|
|
|
|
// The ffData... variables contain the 16-bit values of the according corners of the current level.
|
|
// The corners are overwritten with adjacent tiles after initialization in SetupGameLevel
|
|
// to avoid interpretation as e.g. doors.
|
|
extern int ffDataTopLeft, ffDataTopRight, ffDataBottomLeft, ffDataBottomRight;
|
|
|
|
/*************************************************************
|
|
* Current usage of ffData... variables:
|
|
* ffDataTopLeft: lower 8-bit: ShadeDefID
|
|
* ffDataTopRight: FeatureFlags
|
|
* ffDataBottomLeft: CloudSkyDefID or ParallaxStartTexture
|
|
* ffDataBottomRight: high byte: ceiling texture - low byte: floor texture
|
|
*************************************************************/
|
|
|
|
// The feature flags are stored as a wall in the upper right corner of each level
|
|
static inline word GetFeatureFlags (void)
|
|
{
|
|
return ffDataTopRight;
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef USE_FLOORCEILINGTEX
|
|
extern byte *ceilingsource,*floorsource;
|
|
|
|
void DrawPlanes (void);
|
|
#ifndef USE_MULTIFLATS
|
|
void GetFlatTextures (void);
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef USE_PARALLAX
|
|
void DrawParallax (void);
|
|
void SetParallaxStartTexture (void);
|
|
#endif
|
|
|
|
#endif
|