123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- /*
- Copyright (C) 2004 Michael Liebscher
- Copyright (C) 2000-2002 by DarkOne the Hacker
- 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.
- */
- /*
- * wolf_sprites.h: Wolfenstein3-D sprite handling.
- *
- * Author: Michael Liebscher <johnnycanuck@users.sourceforge.net>
- * Date: 2004
- *
- * Acknowledgement:
- * Portion of this code was derived from NewWolf, and was originally
- * written by DarkOne the Hacker.
- *
- * Portion of this code was derived from Wolfenstein3-D, and was originally
- * written by Id Software, Inc.
- *
- */
- /*
- Notes:
- This module is implemented by wolf_sprites.c
- */
- #ifndef __WOLF_SPRITES_H__
- #define __WOLF_SPRITES_H__
- //
- // sprite constants
- //
- enum {
- SPR_DEMO,
- SPR_DEATHCAM,
- //
- // 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,
- SPR_STAT_48,SPR_STAT_49,SPR_STAT_50,SPR_STAT_51,
- //
- // Guard
- //
- SPR_GRD_S_1,SPR_GRD_S_2,SPR_GRD_S_3,SPR_GRD_S_4,
- SPR_GRD_S_5,SPR_GRD_S_6,SPR_GRD_S_7,SPR_GRD_S_8,
- SPR_GRD_W1_1,SPR_GRD_W1_2,SPR_GRD_W1_3,SPR_GRD_W1_4,
- SPR_GRD_W1_5,SPR_GRD_W1_6,SPR_GRD_W1_7,SPR_GRD_W1_8,
- SPR_GRD_W2_1,SPR_GRD_W2_2,SPR_GRD_W2_3,SPR_GRD_W2_4,
- SPR_GRD_W2_5,SPR_GRD_W2_6,SPR_GRD_W2_7,SPR_GRD_W2_8,
- SPR_GRD_W3_1,SPR_GRD_W3_2,SPR_GRD_W3_3,SPR_GRD_W3_4,
- SPR_GRD_W3_5,SPR_GRD_W3_6,SPR_GRD_W3_7,SPR_GRD_W3_8,
- SPR_GRD_W4_1,SPR_GRD_W4_2,SPR_GRD_W4_3,SPR_GRD_W4_4,
- SPR_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ABB_W1,SPR_SCHABB_W2,SPR_SCHABB_W3,SPR_SCHABB_W4,
- SPR_SCHABB_SHOOT1,SPR_SCHABB_SHOOT2,
- SPR_SCHABB_DIE1,SPR_SCHABB_DIE2,SPR_SCHABB_DIE3,SPR_SCHABB_DEAD,
- SPR_HYPO1,SPR_HYPO2,SPR_HYPO3,SPR_HYPO4,
- //
- // Fake
- //
- SPR_FAKE_W1,SPR_FAKE_W2,SPR_FAKE_W3,SPR_FAKE_W4,
- SPR_FAKE_SHOOT,SPR_FIRE1,SPR_FIRE2,
- SPR_FAKE_DIE1,SPR_FAKE_DIE2,SPR_FAKE_DIE3,SPR_FAKE_DIE4,
- SPR_FAKE_DIE5,SPR_FAKE_DEAD,
- //
- // Hitler
- //
- SPR_MECHA_W1,SPR_MECHA_W2,SPR_MECHA_W3,SPR_MECHA_W4,
- SPR_MECHA_SHOOT1,SPR_MECHA_SHOOT2,SPR_MECHA_SHOOT3,SPR_MECHA_DEAD,
- SPR_MECHA_DIE1,SPR_MECHA_DIE2,SPR_MECHA_DIE3,
- SPR_HITLER_W1,SPR_HITLER_W2,SPR_HITLER_W3,SPR_HITLER_W4,
- SPR_HITLER_SHOOT1,SPR_HITLER_SHOOT2,SPR_HITLER_SHOOT3,SPR_HITLER_DEAD,
- SPR_HITLER_DIE1,SPR_HITLER_DIE2,SPR_HITLER_DIE3,SPR_HITLER_DIE4,
- SPR_HITLER_DIE5,SPR_HITLER_DIE6,SPR_HITLER_DIE7,
- //
- // Giftmacher
- //
- SPR_GIFT_W1,SPR_GIFT_W2,SPR_GIFT_W3,SPR_GIFT_W4,
- SPR_GIFT_SHOOT1,SPR_GIFT_SHOOT2,
- SPR_GIFT_DIE1,SPR_GIFT_DIE2,SPR_GIFT_DIE3,SPR_GIFT_DEAD,
- //
- // Rocket, smoke 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)
- //
- 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,
- //
- // 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
- //
- SPR_BJ_W1,SPR_BJ_W2,SPR_BJ_W3,SPR_BJ_W4,
- SPR_BJ_JUMP1,SPR_BJ_JUMP2,SPR_BJ_JUMP3,SPR_BJ_JUMP4,
- //
- // 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,
- //
- // 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,
- };
- #define SPRT_ONE_TEX 1
- #define SPRT_NO_ROT 2
- #define SPRT_CHG_POS 4
- #define SPRT_CHG_TEX 8
- #define SPRT_REMOVE 16
- typedef struct sprite_s
- {
- vec3_t position;
- int x, y, ang;
- // very clever to make it not just (x>>TILESHIFT)
- // but also (x>>TILESHIFT)-1 if (x%TILEWIDTH)<HALFTILE
- // so we will check only 4 files instead of 9 as Carmack did!
- int tilex, tiley;
- // controls appearence of this sprite:
- // SPRT_ONE_TEX: use one texture for each rotation
- // SPRT_NO_ROT: do not rotate sprite (fence)
- // SPRT_CHG_POS
- // SPRT_CHG_TEX
- // SPRT_REMOVE
- int flags;
- // 8 textures: one for each rotation phase!
- // if SPRT_ONE_TEX flag use tex with index 0!
-
- // these are Wolf sprite texture numbers, not OpenGL sprites
- // or indexes in the textureManager list
- int tex[ 8 ];
- } sprite_t;
- // total sprites on level in a moment
- #define MAX_SPRITES 1024
- typedef struct visobj_s
- {
- int viewx, viewheight; // obsolete, but will do in software rendering!
- int dist; // how we will sort them
- int x, y; // position in game space! (for OpenGL)
- int ang; // for md2 rotation
- int tex; // texture to draw (renderer must know what to draw by this number!
- } visobj_t;
- extern visobj_t vislist[];
- extern void Sprite_Reset( void );
- extern void Sprite_RemoveSprite( int sprite_id );
- extern int Sprite_GetNewSprite( void );
- extern void Sprite_SetPos( int sprite_id, int x, int y, int angle );
- extern void Sprite_SetTex( int sprite_id, int index, int tex );
- extern int Sprite_CreateVisList( void );
- #endif /* __WOLF_SPRITES_H__ */
|