Atrinik Client 2.5
Functions | Variables
client/sprite.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

static void red_scale (_Sprite *sprite)
static void grey_scale (_Sprite *sprite)
static void fow_scale (_Sprite *sprite)
static int GetBitmapBorders (SDL_Surface *Surface, int *up, int *down, int *left, int *right, uint32 ckey)
void sprite_init_system ()
_Spritesprite_load_file (char *fname, uint32 flags)
_Spritesprite_tryload_file (char *fname, uint32 flag, SDL_RWops *rwop)
void sprite_free_sprite (_Sprite *sprite)
void sprite_blt (_Sprite *sprite, int x, int y, SDL_Rect *box, _BLTFX *bltfx)
void sprite_blt_map (_Sprite *sprite, int x, int y, SDL_Rect *box, _BLTFX *bltfx, uint32 stretch, sint16 zoom, sint16 rotate)
Uint32 getpixel (SDL_Surface *surface, int x, int y)
void putpixel (SDL_Surface *surface, int x, int y, Uint32 pixel)
struct _animadd_anim (int type, int mapx, int mapy, int value)
void remove_anim (struct _anim *anim)
void play_anims ()
int sprite_collision (int x, int y, int x2, int y2, _Sprite *sprite1, _Sprite *sprite2)
void surface_pan (SDL_Surface *surface, SDL_Rect *box)
void draw_frame (SDL_Surface *surface, int x, int y, int w, int h)
void border_create (SDL_Surface *surface, int x, int y, int w, int h, int color, int size)
void border_create_color (SDL_Surface *surface, SDL_Rect *coords, const char *color_notation)

Variables

struct _animstart_anim
SDL_Surface * FormatHolder
static int dark_alpha [DARK_LEVELS]
static SDL_Surface * darkness_filter [DARK_LEVELS]

Detailed Description

Sprite related functions.

Definition in file sprite.c.


Function Documentation

struct _anim* add_anim ( int  type,
int  mapx,
int  mapy,
int  value 
) [read]

Add an animation.

Parameters:
type
mapx
mapy
value
Returns:

Definition at line 672 of file sprite.c.

void border_create ( SDL_Surface *  surface,
int  x,
int  y,
int  w,
int  h,
int  color,
int  size 
)

Create a border around the specified coordinates.

Parameters:
surfaceSurface to use.
xX start of the border.
yY start of the border.
wMaximum border width.
hMaximum border height.
colorColor to use for the border.
sizeBorder's size.

Definition at line 974 of file sprite.c.

void draw_frame ( SDL_Surface *  surface,
int  x,
int  y,
int  w,
int  h 
)

Draw a single frame.

Parameters:
surfaceSurface to draw on.
xX position.
yY position.
wWidth of the frame.
hHeight of the frame.

Definition at line 943 of file sprite.c.

static void fow_scale ( _Sprite sprite) [static]

Create _Sprite::fow surface for a sprite.

Parameters:
spriteSprite.

Definition at line 565 of file sprite.c.

static int GetBitmapBorders ( SDL_Surface *  Surface,
int *  up,
int *  down,
int *  left,
int *  right,
uint32  ckey 
) [static]

Get bitmap borders.

Parameters:
SurfaceBitmap's surface.
[out]upTop border.
[out]downBottom border.
[out]leftLeft border.
[out]rightRight border.
ckeyColor key.
Returns:
1 on success, 0 on failure.

Definition at line 595 of file sprite.c.

Uint32 getpixel ( SDL_Surface *  surface,
int  x,
int  y 
)

Get pixel from an SDL surface at specified X/Y position

Parameters:
surfaceSDL surface to get the pixel from.
xX position.
yY position.
Returns:
The pixel.

Definition at line 440 of file sprite.c.

static void grey_scale ( _Sprite sprite) [static]

Create _Sprite::grey surface for a sprite.

Parameters:
spriteSprite.

Definition at line 542 of file sprite.c.

void play_anims ( )

Walk through the map anim list, and display the anims.

Definition at line 777 of file sprite.c.

void putpixel ( SDL_Surface *  surface,
int  x,
int  y,
Uint32  pixel 
)

Puts a pixel to specified X/Y position on SDL surface.

Parameters:
surfaceThe surface.
xX position.
yY position.
pixelPixel to put.

Definition at line 477 of file sprite.c.

static void red_scale ( _Sprite sprite) [static]

Create _Sprite::red surface for a sprite.

Parameters:
spriteSprite.

Definition at line 518 of file sprite.c.

void remove_anim ( struct _anim anim)

Remove an animation.

Parameters:
animThe animation to remove.

Definition at line 747 of file sprite.c.

void sprite_blt ( _Sprite sprite,
int  x,
int  y,
SDL_Rect *  box,
_BLTFX bltfx 
)

Blit a sprite.

Parameters:
spriteSprite.
xX position.
yY position.
boxBox.
bltfxBltfx.

Definition at line 201 of file sprite.c.

void sprite_blt_map ( _Sprite sprite,
int  x,
int  y,
SDL_Rect *  box,
_BLTFX bltfx,
uint32  stretch,
sint16  zoom,
sint16  rotate 
)

Blit a sprite on map surface.

Parameters:
spriteSprite.
xX position.
yY position.
boxBox.
bltfxBltfx.
stretchHow much to stretch the sprite.

Definition at line 261 of file sprite.c.

int sprite_collision ( int  x,
int  y,
int  x2,
int  y2,
_Sprite sprite1,
_Sprite sprite2 
)

Check for possible sprite collision.

Used to make the player overlapping objects transparent.

Parameters:
x1
y1
x2
y2
sprite1
sprite2
Returns:

Definition at line 867 of file sprite.c.

void sprite_free_sprite ( _Sprite sprite)

Free a sprite.

Parameters:
spriteSprite to free.

Definition at line 146 of file sprite.c.

void sprite_init_system ( )

Initialize the sprite system.

Definition at line 57 of file sprite.c.

_Sprite* sprite_load_file ( char *  fname,
uint32  flags 
)

Load sprite file.

Parameters:
fnameSprite filename.
flagsFlags for the sprite.
Returns:
NULL if failed, the sprite otherwise.

Definition at line 68 of file sprite.c.

_Sprite* sprite_tryload_file ( char *  fname,
uint32  flag,
SDL_RWops *  rwop 
)

Try to load a sprite image file.

Parameters:
fnameSprite filename
flagFlags
rwopPointer to memory for the image
Returns:
The sprite if success, NULL otherwise

Definition at line 87 of file sprite.c.

void surface_pan ( SDL_Surface *  surface,
SDL_Rect *  box 
)

Pans the surface.

Parameters:
surfaceSurface.
boxCoordinates.

Definition at line 913 of file sprite.c.


Variable Documentation

int dark_alpha[DARK_LEVELS] [static]
Initial value:
{
    0, 44, 80, 117, 153, 190, 226
}

Darkness alpha values.

Definition at line 39 of file sprite.c.

SDL_Surface* darkness_filter[DARK_LEVELS] [static]
Initial value:
{
    NULL, NULL, NULL, NULL, NULL, NULL, NULL
}

Darkness filter.

Definition at line 45 of file sprite.c.

SDL_Surface* FormatHolder

Format holder for red_scale(), fow_scale() and grey_scale() functions.

Definition at line 36 of file sprite.c.

struct _anim* start_anim

Anim queue of current active map

Definition at line 33 of file sprite.c.