FS2_Open
Open source remastering of the Freespace 2 engine
generic.cpp
Go to the documentation of this file.
1 #include "anim/packunpack.h"
2 #include "globalincs/globals.h"
3 #include "graphics/2d.h"
4 #include "graphics/generic.h"
5 #define BMPMAN_INTERNAL
6 #include "bmpman/bm_internal.h"
7 #ifdef _WIN32
8 #include <windows.h> // for MAX_PATH
9 #else
10 #define MAX_PATH 255
11 #endif
12 //#define TIMER
13 #ifdef TIMER
14 #include "io/timer.h"
15 #endif
16 
17 //we check background type to avoid messed up colours for ANI
18 #define ANI_BPP_CHECK (ga->ani.bg_type == BM_TYPE_PCX) ? 16 : 32
19 
20 // These two functions find if a bitmap or animation exists by filename, no extension needed.
22 {
23  return cf_exists_full_ext(filename, CF_TYPE_ANY, BM_NUM_TYPES, bm_ext_list) != 0;
24 }
25 
26 bool generic_anim_exists(const char *filename)
27 {
29 }
30 
31 // Goober5000
32 int generic_anim_init_and_stream(generic_anim *ga, const char *anim_filename, BM_TYPE bg_type, bool attempt_hi_res)
33 {
34  int stream_result = -1;
35  char filename[NAME_LENGTH];
36  char *p;
37 
38  Assert(ga != NULL);
39  Assert(anim_filename != NULL);
40 
41  // hi-res support
42  if (attempt_hi_res && (gr_screen.res == GR_1024)) {
43  // attempt to load a hi-res animation
44  memset(filename, 0, NAME_LENGTH);
45  strcpy_s(filename, "2_");
46  strncat(filename, anim_filename, NAME_LENGTH - 3);
47 
48  // remove extension
49  p = strchr(filename, '.');
50  if(p) {
51  *p = '\0';
52  }
53 
54  // attempt to stream the hi-res ani
55  generic_anim_init(ga, filename);
56  ga->ani.bg_type = bg_type;
57  stream_result = generic_anim_stream(ga);
58  }
59 
60  // we failed to stream hi-res, or we aren't running in hi-res, so try low-res
61  if (stream_result < 0) {
62  strcpy_s(filename, anim_filename);
63 
64  // remove extension
65  p = strchr(filename, '.');
66  if(p) {
67  *p = '\0';
68  }
69 
70  // attempt to stream the low-res ani
71  generic_anim_init(ga, filename);
72  ga->ani.bg_type = bg_type;
73  stream_result = generic_anim_stream(ga);
74  }
75 
76  return stream_result;
77 }
78 
79 // Goober5000
81 {
82  generic_anim_init(ga, NULL);
83 }
84 
85 // Goober5000
86 void generic_anim_init(generic_anim *ga, const char *filename)
87 {
88  if (filename != NULL)
89  strcpy_s(ga->filename, filename);
90  else
91  memset(ga->filename, 0, MAX_FILENAME_LEN);
92  ga->first_frame = -1;
93  ga->num_frames = 0;
94  ga->keyframe = 0;
95  ga->keyoffset = 0;
96  ga->current_frame = 0;
97  ga->previous_frame = -1;
99  ga->done_playing = 0;
100  ga->total_time = 0.0f;
101  ga->anim_time = 0.0f;
102 
103  //we only care about the stuff below if we're streaming
104  ga->ani.animation = NULL;
105  ga->ani.instance = NULL;
106  ga->ani.bg_type = BM_TYPE_NONE;
107  ga->type = BM_TYPE_NONE;
108  ga->streaming = 0;
109  ga->buffer = NULL;
110  ga->height = 0;
111  ga->width = 0;
112  ga->bitmap_id = -1;
113  ga->use_hud_color = false;
114 }
115 
116 // CommanderDJ - same as generic_anim_init, just with an SCP_string
118 {
119  generic_anim_init(ga);
120  filename.copy(ga->filename, MAX_FILENAME_LEN - 1);
121 }
122 
123 // Goober5000
125 {
126  if (filename == NULL) {
127  gb->filename[0] = '\0';
128  } else {
129  strncpy(gb->filename, filename, MAX_FILENAME_LEN - 1);
130  }
131 
132  gb->bitmap_id = -1;
133 }
134 
135 // Goober5000
136 // load a generic_anim
137 // return 0 is successful, otherwise return -1
139 {
140  int fps;
141 
142  if ( !VALID_FNAME(ga->filename) )
143  return -1;
144 
145  ga->first_frame = bm_load_animation(ga->filename, &ga->num_frames, &fps, &ga->keyframe);
146  //mprintf(("generic_anim_load: %s - keyframe = %d\n", ga->filename, ga->keyframe));
147 
148  if (ga->first_frame < 0)
149  return -1;
150 
151  Assert(fps != 0);
152  ga->total_time = ga->num_frames / (float)fps;
153  ga->done_playing = 0;
154  ga->anim_time = 0.0f;
155 
156  return 0;
157 }
158 
160 {
161  CFILE *img_cfp = NULL;
162  int anim_fps = 0;
163  char full_path[MAX_PATH];
164  int size = 0, offset = 0;
165  const int NUM_TYPES = 2;
166  const ubyte type_list[NUM_TYPES] = {BM_TYPE_EFF, BM_TYPE_ANI};
167  const char *ext_list[NUM_TYPES] = {".eff", ".ani"};
168  int rval = -1;
169  int bpp;
170 
171  ga->type = BM_TYPE_NONE;
172 
173  rval = cf_find_file_location_ext(ga->filename, NUM_TYPES, ext_list, CF_TYPE_ANY, sizeof(full_path) - 1, full_path, &size, &offset, 0);
174 
175  // could not be found, or is invalid for some reason
176  if ( (rval < 0) || (rval >= NUM_TYPES) )
177  return -1;
178 
179  //make sure we can open it
180  img_cfp = cfopen_special(full_path, "rb", size, offset, CF_TYPE_ANY);
181 
182  if (img_cfp == NULL) {
183  return -1;
184  }
185 
186  strcat_s(ga->filename, ext_list[rval]);
187  ga->type = type_list[rval];
188  //seek to the end
189  cfseek(img_cfp, 0, CF_SEEK_END);
190 
191  cfclose(img_cfp);
192 
193  if(ga->type == BM_TYPE_ANI) {
194  bpp = ANI_BPP_CHECK;
195  if(ga->use_hud_color)
196  bpp = 8;
197  if (ga->ani.animation == nullptr) {
198  ga->ani.animation = anim_load(ga->filename, CF_TYPE_ANY, 0);
199  }
200  if (ga->ani.instance == nullptr) {
201  ga->ani.instance = init_anim_instance(ga->ani.animation, bpp);
202  }
203 
204  #ifndef NDEBUG
205  // for debug of ANI sizes
206  strcpy_s(ga->ani.animation->name, ga->filename);
207  #endif
208 
209  ga->num_frames = ga->ani.animation->total_frames;
210  anim_fps = ga->ani.animation->fps;
211  ga->height = ga->ani.animation->height;
212  ga->width = ga->ani.animation->width;
213  ga->buffer = ga->ani.instance->frame;
214  ga->bitmap_id = bm_create(bpp, ga->width, ga->height, ga->buffer, (bpp==8)?BMP_AABITMAP:0);
215  ga->ani.instance->last_bitmap = -1;
216 
217  ga->ani.instance->file_offset = ga->ani.animation->file_offset;
218  ga->ani.instance->data = ga->ani.animation->data;
219 
220  ga->previous_frame = -1;
221  }
222  else {
223  bpp = 32;
224  if(ga->use_hud_color)
225  bpp = 8;
226  bm_load_and_parse_eff(ga->filename, CF_TYPE_ANY, &ga->num_frames, &anim_fps, &ga->keyframe, 0);
227  char *p = strrchr( ga->filename, '.' );
228  if ( p )
229  *p = 0;
230  char frame_name[MAX_FILENAME_LEN];
231  snprintf(frame_name, MAX_FILENAME_LEN, "%s_0000", ga->filename);
232  ga->bitmap_id = bm_load(frame_name);
233  if(ga->bitmap_id < 0) {
234  mprintf(("Cannot find first frame for eff streaming. eff Filename: %s", ga->filename));
235  return -1;
236  }
237  snprintf(frame_name, MAX_FILENAME_LEN, "%s_0001", ga->filename);
238  ga->eff.next_frame = bm_load(frame_name);
239  bm_get_info(ga->bitmap_id, &ga->width, &ga->height);
240  ga->previous_frame = 0;
241  }
242 
243  // keyframe info
244  if (ga->type == BM_TYPE_ANI) {
245  //we only care if there are 2 keyframes - first frame, other frame to jump to for ship/weapons
246  //mainhall door anis hav every frame as keyframe, so we don't care
247  //other anis only have the first frame
248  if(ga->ani.animation->num_keys == 2) {
249  int key1 = ga->ani.animation->keys[0].frame_num;
250  int key2 = ga->ani.animation->keys[1].frame_num;
251 
252  if (key1 < 0 || key1 >= ga->num_frames) key1 = -1;
253  if (key2 < 0 || key2 >= ga->num_frames) key2 = -1;
254 
255  // some retail anis have their keyframes reversed
256  // and some have their keyframes out of bounds
257  if (key1 >= 0 && key1 >= key2) {
258  ga->keyframe = ga->ani.animation->keys[0].frame_num;
259  ga->keyoffset = ga->ani.animation->keys[0].offset;
260  }
261  else if (key2 >= 0 && key2 >= key1) {
262  ga->keyframe = ga->ani.animation->keys[1].frame_num;
263  ga->keyoffset = ga->ani.animation->keys[1].offset;
264  }
265  }
266  }
267 
268  ga->streaming = 1;
269 
270  Assert(anim_fps != 0);
271  ga->total_time = ga->num_frames / (float) anim_fps;
272  ga->done_playing = 0;
273  ga->anim_time = 0.0f;
274 
275  return 0;
276 }
277 
279 {
280  if ( !VALID_FNAME(gb->filename) )
281  return -1;
282 
283  gb->bitmap_id = bm_load(gb->filename);
284 
285  if (gb->bitmap_id < 0)
286  return -1;
287 
288  return 0;
289 }
290 
292 {
293  if(ga->num_frames > 0) {
294  if(ga->streaming) {
295  if(ga->type == BM_TYPE_ANI) {
296  anim_free(ga->ani.animation);
297  free_anim_instance(ga->ani.instance);
298  }
299  if(ga->type == BM_TYPE_EFF) {
300  if(ga->eff.next_frame >= 0)
301  bm_release(ga->eff.next_frame);
302  if(ga->bitmap_id >= 0)
303  bm_release(ga->bitmap_id);
304  }
305  }
306  else {
307  //trying to release the first frame will release ALL frames
308  bm_release(ga->first_frame);
309  }
310  if(ga->buffer) {
311  bm_release(ga->bitmap_id);
312  }
313  }
314  generic_anim_init(ga, NULL);
315 }
316 
317 //for timer debug, #define TIMER
319 {
320  if(ga->current_frame == ga->previous_frame)
321  return;
322  ubyte bpp = 32;
323  if(ga->use_hud_color)
324  bpp = 8;
325  #ifdef TIMER
326  int start_time = timer_get_fixed_seconds();
327  #endif
328 
329  #ifdef TIMER
330  mprintf(("=========================\n"));
331  mprintf(("frame: %d\n", ga->current_frame));
332  #endif
333  char frame_name[MAX_FILENAME_LEN];
334  snprintf(frame_name, MAX_FILENAME_LEN, "%s_%.4d", ga->filename, ga->current_frame);
335  if(bm_reload(ga->eff.next_frame, frame_name) == ga->eff.next_frame)
336  {
337  bitmap* next_frame_bmp = bm_lock(ga->eff.next_frame, bpp, (bpp==8)?BMP_AABITMAP:BMP_TEX_NONCOMP, true);
338  if(next_frame_bmp->data)
339  gr_update_texture(ga->bitmap_id, bpp, (ubyte*)next_frame_bmp->data, ga->width, ga->height);
340  bm_unlock(ga->eff.next_frame);
341  bm_unload(ga->eff.next_frame, 0, true);
342  if (ga->current_frame == ga->num_frames-1)
343  {
344  snprintf(frame_name, MAX_FILENAME_LEN, "%s_0001", ga->filename);
345  bm_reload(ga->eff.next_frame, frame_name);
346  }
347  }
348  #ifdef TIMER
349  mprintf(("end: %d\n", timer_get_fixed_seconds() - start_time));
350  mprintf(("=========================\n"));
351  #endif
352 }
353 
355 {
356  int i;
357  int bpp = ANI_BPP_CHECK;
358  if(ga->use_hud_color)
359  bpp = 8;
360  #ifdef TIMER
361  int start_time = timer_get_fixed_seconds();
362  #endif
363 
364  if(ga->current_frame == ga->previous_frame)
365  return;
366 
367  #ifdef TIMER
368  mprintf(("=========================\n"));
369  mprintf(("frame: %d\n", ga->current_frame));
370  #endif
371 
372  anim_check_for_palette_change(ga->ani.instance);
373  // if we're using bitmap polys
376  //grab the keyframe - every frame is a keyframe for ANI
377  if(ga->ani.animation->flags & ANF_STREAMED) {
378  ga->ani.instance->file_offset = ga->ani.animation->file_offset + ga->ani.animation->keys[ga->current_frame].offset;
379  } else {
380  ga->ani.instance->data = ga->ani.animation->data + ga->ani.animation->keys[ga->current_frame].offset;
381  }
382  if(ga->ani.animation->flags & ANF_STREAMED) {
383  ga->ani.instance->file_offset = unpack_frame_from_file(ga->ani.instance, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
384  }
385  else {
386  ga->ani.instance->data = unpack_frame(ga->ani.instance, ga->ani.instance->data, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
387  }
388  }
389  else {
390  //looping back
391  if((ga->current_frame == 0) || (ga->current_frame < ga->previous_frame)) {
392  //go back to keyframe if there is one
393  if(ga->keyframe && (ga->current_frame > 0)) {
394  if(ga->ani.animation->flags & ANF_STREAMED) {
395  ga->ani.instance->file_offset = ga->ani.animation->file_offset + ga->keyoffset;
396  } else {
397  ga->ani.instance->data = ga->ani.animation->data + ga->keyoffset;
398  }
399  ga->previous_frame = ga->keyframe - 1;
400  }
401  //go back to the start
402  else {
403  ga->ani.instance->file_offset = ga->ani.animation->file_offset;
404  ga->ani.instance->data = ga->ani.animation->data;
405  ga->previous_frame = -1;
406  }
407  }
408  #ifdef TIMER
409  mprintf(("proc: %d\n", timer_get_fixed_seconds() - start_time));
410  mprintf(("previous frame: %d\n", ga->previous_frame));
411  #endif
412  for(i = ga->previous_frame + 1; i <= ga->current_frame; i++) {
413  if(ga->ani.animation->flags & ANF_STREAMED) {
414  ga->ani.instance->file_offset = unpack_frame_from_file(ga->ani.instance, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
415  }
416  else {
417  ga->ani.instance->data = unpack_frame(ga->ani.instance, ga->ani.instance->data, ga->buffer, ga->width * ga->height, (ga->ani.instance->xlate_pal) ? ga->ani.animation->palette_translation : NULL, (bpp==8)?1:0, bpp);
418  }
419  }
420  }
421  // always go back to screen format
423  //we need to use this because performance is worse if we flush the gfx card buffer
424 
425  gr_update_texture(ga->bitmap_id, bpp, ga->buffer, ga->width, ga->height);
426 
427  //in case we want to check that the frame is actually changing
428  //mprintf(("frame crc = %08X\n", cf_add_chksum_long(0, ga->buffer, ga->width * ga->height * (bpp >> 3))));
429  ga->ani.instance->last_bitmap = ga->bitmap_id;
430 
431  #ifdef TIMER
432  mprintf(("end: %d\n", timer_get_fixed_seconds() - start_time));
433  mprintf(("=========================\n"));
434  #endif
435 }
436 
437 void generic_anim_render(generic_anim *ga, float frametime, int x, int y, bool menu)
438 {
439  float keytime = 0.0;
440 
441  if(ga->keyframe)
442  keytime = (ga->total_time * ((float)ga->keyframe / (float)ga->num_frames));
443  //don't mess with the frame time if we're paused
444  if((ga->direction & GENERIC_ANIM_DIRECTION_PAUSED) == 0) {
446  //keep going forwards if we're in a keyframe loop
447  if(ga->keyframe && (ga->anim_time >= keytime)) {
448  ga->anim_time += frametime;
449  if(ga->anim_time >= ga->total_time) {
450  ga->anim_time = keytime - 0.001f;
451  ga->done_playing = 0;
452  }
453  }
454  else {
455  //playing backwards
456  ga->anim_time -= frametime;
457  if((ga->direction & GENERIC_ANIM_DIRECTION_NOLOOP) && ga->anim_time <= 0.0) {
458  ga->anim_time = 0; //stop on first frame when playing in reverse
459  }
460  else {
461  while(ga->anim_time <= 0.0)
462  ga->anim_time += ga->total_time; //make sure we're always positive, so we can go back to the end
463  }
464  }
465  }
466  else {
467  ga->anim_time += frametime;
468  if(ga->anim_time >= ga->total_time) {
470  ga->anim_time = ga->total_time - 0.001f; //stop on last frame when playing - if it's equal we jump to the first frame
471  }
472  if(!ga->done_playing){
473  //we've played this at least once
474  ga->done_playing = 1;
475  }
476  }
477  }
478  }
479  if(ga->num_frames > 0)
480  {
481  ga->current_frame = 0;
482  if(ga->done_playing && ga->keyframe) {
483  ga->anim_time = fmod(ga->anim_time - keytime, ga->total_time - keytime) + keytime;
484  }
485  else {
486  ga->anim_time = fmod(ga->anim_time, ga->total_time);
487  }
488  ga->current_frame += fl2i(ga->anim_time * ga->num_frames / ga->total_time);
489  //sanity check
490  CLAMP(ga->current_frame, 0, ga->num_frames - 1);
491  if(ga->streaming) {
492  //handle streaming - render one frame
493  if(ga->type == BM_TYPE_ANI) {
495  } else {
497  }
499  }
500  else {
502  }
503  ga->previous_frame = ga->current_frame;
504  if(ga->use_hud_color)
505  gr_aabitmap(x, y, (menu ? GR_RESIZE_MENU : GR_RESIZE_FULL));
506  else
507  gr_bitmap(x, y, (menu ? GR_RESIZE_MENU : GR_RESIZE_FULL));
508  }
509 }
void bm_unlock(int handle)
Unlocks a bitmap.
Definition: bmpman.cpp:3005
#define MAX_FILENAME_LEN
Definition: pstypes.h:324
int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp)
Unpack frame from file.
Definition: packunpack.cpp:858
const char * bm_ext_list[]
List of extensions for those types.
Definition: bmpman.cpp:69
int i
Definition: multi_pxo.cpp:466
int bitmap_id
Definition: generic.h:46
int previous_frame
Definition: generic.h:24
int current_frame
Definition: generic.h:23
#define GR_RESIZE_MENU
Definition: 2d.h:684
bool bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, BM_TYPE *type)
Loads and parses an .EFF.
Definition: bmpman.cpp:1239
unsigned char done_playing
Definition: generic.h:26
int generic_anim_load(generic_anim *ga)
Definition: generic.cpp:138
Assert(pm!=NULL)
void generic_bitmap_init(generic_bitmap *gb, const char *filename)
Definition: generic.cpp:124
#define mprintf(args)
Definition: pstypes.h:238
int res
Definition: 2d.h:370
float total_time
Definition: generic.h:27
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
Definition: bmpman.cpp:769
int generic_bitmap_load(generic_bitmap *gb)
Definition: generic.cpp:278
const int BM_ANI_NUM_TYPES
Calculated number of bitmap animation types.
Definition: bmpman.cpp:74
bool generic_anim_exists(const char *filename)
Definition: generic.cpp:26
#define gr_update_texture
Definition: 2d.h:950
Definition: cfile.h:28
#define BMP_TEX_NONCOMP
Non-compressed textures.
Definition: bmpman.h:62
int cf_find_file_location_ext(const char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out=0, char *pack_filename=NULL, int *size=NULL, int *offset=NULL, bool localize=false)
int bitmap_id
Definition: generic.h:53
int width
Definition: generic.h:45
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
Definition: 2d.cpp:2105
void generic_render_ani_stream(generic_anim *ga)
Definition: generic.cpp:354
GLsizeiptr size
Definition: Glext.h:5496
int height
Definition: generic.h:44
No type.
Definition: bmpman.h:73
void free_anim_instance(anim_instance *inst)
Definition: packunpack.cpp:68
#define cfopen_special(...)
Definition: cfile.h:140
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
Definition: bmpman.cpp:2603
in-house ANI format
Definition: bmpman.h:80
void BM_SELECT_TEX_FORMAT()
Sets bm_set_components and bm_get_components to reference texture format functions.
Definition: bmpman.cpp:2745
#define BMP_AABITMAP
antialiased bitmap
Definition: bmpman.h:52
void generic_anim_unload(generic_anim *ga)
Definition: generic.cpp:291
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads a bitmap sequance so we can draw with it.
Definition: bmpman.cpp:1420
#define CLAMP(x, min, max)
Definition: pstypes.h:488
int keyoffset
Definition: generic.h:22
int num_frames
Definition: generic.h:20
GLintptr offset
Definition: Glext.h:5497
#define GENERIC_ANIM_DIRECTION_FORWARDS
Definition: generic.h:11
const char * bm_ani_ext_list[]
List of extensions for those types.
Definition: bmpman.cpp:73
#define CF_SEEK_END
Definition: cfile.h:26
int first_frame
Definition: generic.h:19
#define ANI_BPP_CHECK
Definition: generic.cpp:18
specifies any type of animated image, the EFF itself is just text
Definition: bmpman.h:81
char * filename
bool use_hud_color
Definition: generic.h:47
void generic_anim_render(generic_anim *ga, float frametime, int x, int y, bool menu)
Definition: generic.cpp:437
GLuint64EXT GLuint GLuint GLenum GLenum GLuint GLuint GLenum GLuint GLuint key1
Definition: Glext.h:10079
int anim_free(anim *ptr)
Free an animation that was loaded with anim_load().
Definition: animplay.cpp:813
Definition: bmpman.h:101
bitmap * bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug)
Locks down the bitmap indexed by bitmapnum.
Definition: bmpman.cpp:1754
BM_TYPE
Definition: bmpman.h:71
ubyte * unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp)
Unpack frame.
Definition: packunpack.cpp:669
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
unsigned char ubyte
Definition: pstypes.h:62
int bm_create(int bpp, int w, int h, void *data, int flags)
Definition: bmpman.cpp:469
const int BM_NUM_TYPES
Calculated number of bitmap types.
Definition: bmpman.cpp:70
#define GR_RESIZE_FULL
Definition: 2d.h:682
#define GENERIC_ANIM_DIRECTION_PAUSED
Definition: generic.h:14
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
Definition: bmpman.cpp:1119
void generic_render_eff_stream(generic_anim *ga)
Definition: generic.cpp:318
struct generic_anim::@239::@241 ani
#define GENERIC_ANIM_DIRECTION_NOLOOP
Definition: generic.h:13
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
unsigned char streaming
Definition: generic.h:42
#define strcat_s(...)
Definition: safe_strings.h:68
#define NAME_LENGTH
Definition: globals.h:15
#define fl2i(fl)
Definition: floating.h:33
fix timer_get_fixed_seconds()
Definition: timer.cpp:116
screen gr_screen
Definition: 2d.cpp:46
float anim_time
Definition: generic.h:28
void generic_anim_init(generic_anim *ga)
Definition: generic.cpp:80
int keyframe
Definition: generic.h:21
GLfloat GLfloat p
Definition: Glext.h:8373
unsigned char direction
Definition: generic.h:25
ubyte * buffer
Definition: generic.h:43
__inline void gr_aabitmap(int x, int y, int resize_mode=GR_RESIZE_FULL, bool mirror=false)
Definition: 2d.h:750
#define ANF_STREAMED
Definition: packunpack.h:35
ptr_u data
Pointer to data, or maybe offset into VRAM.
Definition: bmpman.h:109
struct generic_anim::@239::@242 eff
#define VALID_FNAME(x)
Definition: pstypes.h:418
void gr_bitmap(int _x, int _y, int resize_mode)
Definition: 2d.cpp:1303
anim_instance * init_anim_instance(anim *ptr, int bpp)
Definition: packunpack.cpp:28
int generic_anim_init_and_stream(generic_anim *ga, const char *anim_filename, BM_TYPE bg_type, bool attempt_hi_res)
Definition: generic.cpp:32
bool generic_bitmap_exists(const char *filename)
Definition: generic.cpp:21
char filename[MAX_FILENAME_LEN]
Definition: generic.h:52
int bm_unload(int handle, int clear_render_targets, bool nodebug)
Unloads a bitmap's data, but not the bitmap info.
Definition: bmpman.cpp:2890
char filename[MAX_FILENAME_LEN]
Definition: generic.h:18
ubyte type
Definition: generic.h:41
int cfclose(CFILE *cfile)
Definition: cfile.cpp:895
#define CF_TYPE_ANY
Definition: cfile.h:42
int generic_anim_stream(generic_anim *ga)
Definition: generic.cpp:159
#define GR_1024
Definition: 2d.h:653
#define MAX_PATH
Definition: generic.cpp:10
#define GENERIC_ANIM_DIRECTION_BACKWARDS
Definition: generic.h:12
anim * anim_load(char *real_filename, int cf_dir_type, int file_mapped)
Load an animation. This stores the compressed data, which instances of the animation can reference...
Definition: animplay.cpp:687
GLint y
Definition: Gl.h:1505
int cf_exists_full_ext(const char *filename, int dir_type, const int num_ext, const char **ext_list)
Definition: cfile.cpp:536
#define strcpy_s(...)
Definition: safe_strings.h:67
void BM_SELECT_SCREEN_FORMAT()
Sets bm_set_components and bm_get_components to reference screen format functions.
Definition: bmpman.cpp:2733
int bm_reload(int bitmap_handle, const char *filename)
Reloads an existing bmpman slot with different bitmap.
Definition: bmpman.cpp:2699
int cfseek(CFILE *fp, int offset, int where)
void anim_check_for_palette_change(anim_instance *instance)
Definition: packunpack.cpp:21