MuckyFoot-UrbanChaos/fallen/DDEngine/Headers/texture.h
2017-05-20 11:14:17 +10:00

289 lines
6.9 KiB
C

//
// Texture handling is wierd!
//
#ifndef TEXTURE_H
#define TEXTURE_H
#include "crinkle.h"
//
// The shadow texture page is generated by you! This is its size.
// The is the texture page for video playback.
//
#define TEXTURE_SHADOW_SIZE 64
#define TEXTURE_VIDEO_SIZE 64
#define FACE_PAGE_OFFSET (8*64)
//
// Chooses the texture set to use. If the current texture set is
// different from the new one, then all the textures are released.
//
void TEXTURE_choose_set(SLONG number);
//
// Fixed prims to work with the individual texture pages. Call this function BEFORE
// you load the textures! It works out which pages are needed.
//
void TEXTURE_fix_prim_textures(SLONG flag);
void TEXTURE_fix_texture_styles(void);
//
// The number of standard texture pages.
//
extern SLONG TEXTURE_page_num_standard;
#ifdef TARGET_DC
extern SLONG TEXTURE_page_background_use_instead;
extern SLONG TEXTURE_page_background_use_instead2;
extern SLONG TEXTURE_page_joypad_a;
extern SLONG TEXTURE_page_joypad_b;
extern SLONG TEXTURE_page_joypad_c;
extern SLONG TEXTURE_page_joypad_x;
extern SLONG TEXTURE_page_joypad_y;
extern SLONG TEXTURE_page_joypad_z;
extern SLONG TEXTURE_page_joypad_l;
extern SLONG TEXTURE_page_joypad_r;
extern SLONG TEXTURE_page_joypad_pad_l;
extern SLONG TEXTURE_page_joypad_pad_r;
extern SLONG TEXTURE_page_joypad_pad_d;
extern SLONG TEXTURE_page_joypad_pad_u;
#endif
extern SLONG TEXTURE_page_snowflake;
extern SLONG TEXTURE_page_sparkle;
extern SLONG TEXTURE_page_explode2;
extern SLONG TEXTURE_page_explode1;
extern SLONG TEXTURE_page_bigbang;
extern SLONG TEXTURE_page_face1;
extern SLONG TEXTURE_page_face2;
extern SLONG TEXTURE_page_face3;
extern SLONG TEXTURE_page_face4;
extern SLONG TEXTURE_page_face5;
extern SLONG TEXTURE_page_face6;
extern SLONG TEXTURE_page_fog;
extern SLONG TEXTURE_page_moon;
extern SLONG TEXTURE_page_clouds;
extern SLONG TEXTURE_page_water;
extern SLONG TEXTURE_page_puddle;
extern SLONG TEXTURE_page_drip;
extern SLONG TEXTURE_page_shadow;
extern SLONG TEXTURE_page_bang;
extern SLONG TEXTURE_page_font;
extern SLONG TEXTURE_page_logo;
extern SLONG TEXTURE_page_sky;
extern SLONG TEXTURE_page_flames;
extern SLONG TEXTURE_page_smoke;
extern SLONG TEXTURE_page_flame2;
extern SLONG TEXTURE_page_steam;
extern SLONG TEXTURE_page_menuflame;
extern SLONG TEXTURE_page_barbwire;
extern SLONG TEXTURE_page_font2d;
extern SLONG TEXTURE_page_dustwave;
extern SLONG TEXTURE_page_flames3;
extern SLONG TEXTURE_page_bloodsplat;
extern SLONG TEXTURE_page_bloom1;
extern SLONG TEXTURE_page_bloom2;
extern SLONG TEXTURE_page_hitspang;
extern SLONG TEXTURE_page_lensflare;
extern SLONG TEXTURE_page_tyretrack;
extern SLONG TEXTURE_page_envmap; // The environment map on metal
extern SLONG TEXTURE_page_winmap; // The environment map on windows
extern SLONG TEXTURE_page_leaf;
extern SLONG TEXTURE_page_raindrop;
extern SLONG TEXTURE_page_footprint;
extern SLONG TEXTURE_page_angel;
extern SLONG TEXTURE_page_devil;
extern SLONG TEXTURE_page_smoker;
extern SLONG TEXTURE_page_target;
extern SLONG TEXTURE_page_newfont;
extern SLONG TEXTURE_page_droplet;
extern SLONG TEXTURE_page_press1;
extern SLONG TEXTURE_page_press2;
extern SLONG TEXTURE_page_ic;
extern SLONG TEXTURE_page_ic2;
extern SLONG TEXTURE_page_lcdfont;
extern SLONG TEXTURE_page_smokecloud;
extern SLONG TEXTURE_page_menulogo;
extern SLONG TEXTURE_page_polaroid;
extern SLONG TEXTURE_page_bigbutton;
extern SLONG TEXTURE_page_bigleaf;
extern SLONG TEXTURE_page_bigrain;
extern SLONG TEXTURE_page_finalglow;
extern SLONG TEXTURE_page_tinybutt;
extern SLONG TEXTURE_page_lcdfont_alpha;
extern SLONG TEXTURE_page_flames_alpha;
extern SLONG TEXTURE_page_tyretrack_alpha;
extern SLONG TEXTURE_page_people3;
extern SLONG TEXTURE_page_ladder;
extern SLONG TEXTURE_page_fadecat;
extern SLONG TEXTURE_page_fade_MF;
extern SLONG TEXTURE_page_shadowoval;
extern SLONG TEXTURE_page_rubbish;
extern SLONG TEXTURE_page_lastpanel;
extern SLONG TEXTURE_page_lastpanel2;
extern SLONG TEXTURE_page_sign;
extern SLONG TEXTURE_page_pcflamer;
extern SLONG TEXTURE_page_shadowsquare;
extern SLONG TEXTURE_page_litebolt;
extern SLONG TEXTURE_page_ladshad;
extern SLONG TEXTURE_page_meteor;
extern SLONG TEXTURE_page_splash;
extern SLONG TEXTURE_num_textures; // The total number of pages.
//
// Returns the texture handle of the given page.
// DX6: returns a D3DTexture ptr to give to SET_TEXTURE macro
//
//D3DTEXTUREHANDLE TEXTURE_get_handle(SLONG page);
LPDIRECT3DTEXTURE2 TEXTURE_get_handle(SLONG page);
#ifdef TEX_EMBED
#if USE_FANCY_TEXTURE_PAGES_PLEASE_BOB
D3DTexture *TEXTURE_get_D3DTexture(SLONG page);
#else
UBYTE TEXTURE_get_offset(SLONG page);
#endif
#endif
//
// The handle of each crinkle. NULL => No crinkle for that page.
//
extern CRINKLE_Handle TEXTURE_crinkle[22 * 64];
//
// To update the shadow texture page, first lock it, then
// write into it, then unlock it, then update it... phew!
//
//
// These are only valid after a successful lock.
//
extern UWORD *TEXTURE_shadow_bitmap;
extern SLONG TEXTURE_shadow_pitch; // In bytes!
extern SLONG TEXTURE_shadow_mask_red;
extern SLONG TEXTURE_shadow_mask_green;
extern SLONG TEXTURE_shadow_mask_blue;
extern SLONG TEXTURE_shadow_mask_alpha;
extern SLONG TEXTURE_shadow_shift_red;
extern SLONG TEXTURE_shadow_shift_green;
extern SLONG TEXTURE_shadow_shift_blue;
extern SLONG TEXTURE_shadow_shift_alpha;
SLONG TEXTURE_shadow_lock (void); // False on failure.
void TEXTURE_shadow_unlock(void);
void TEXTURE_shadow_update(void);
SLONG TEXTURE_86_lock (void); // False on failure.
void TEXTURE_86_unlock(void);
void TEXTURE_86_update(void);
//
// Returns the four texture coordinates of the given MiniTextureBits structure
//
void TEXTURE_get_minitexturebits_uvs(
UWORD texture,
SLONG *page,
float *u0,
float *v0,
float *u1,
float *v1,
float *u2,
float *v2,
float *u3,
float *v3);
//
// Gives the uv of the top left of the given texture square and
// returns the page.
//
SLONG TEXTURE_get_fiddled_position(
SLONG square_u,
SLONG square_v,
SLONG page,
float *u,
float *v);
//
// Makes black the colour key for the given texture.
//
#ifndef TARGET_DC
void TEXTURE_set_colour_key(SLONG page);
#endif
//
// Makes all the textures greyscale.
//
void TEXTURE_set_greyscale(SLONG is_greyscale);
//
// Change a specific texture to a different tga
//
void TEXTURE_set_tga(SLONG page, CBYTE *fn);
//
// Frees all the texture pages.
//
void TEXTURE_free(void);
// Frees all the non-frontend texture pages.
void TEXTURE_free_unneeded ( void );
//
// Returns what sort it thinks the given page looks like.
//
#define TEXTURE_LOOK_ROAD 0
#define TEXTURE_LOOK_GRASS 1
#define TEXTURE_LOOK_DIRT 2
#define TEXTURE_LOOK_SLIPPERY 3
extern SLONG TEXTURE_liney;
extern SLONG TEXTURE_av_r;
extern SLONG TEXTURE_av_g;
extern SLONG TEXTURE_av_b;
SLONG TEXTURE_looks_like(SLONG page);
#endif