"*showFPS: False \n" \
"*wireframe: False \n" \
-# define refresh_fire 0
#define MODE_fire
#include "xlockmore.h" /* from the xscreensaver distribution */
#include "gltrackball.h"
#if defined( USE_XPM ) || defined( USE_XPMINC ) || defined(STANDALONE)
/* USE_XPM & USE_XPMINC in xlock mode ; HAVE_XPM in xscreensaver mode */
-#include "xpm-ximage.h"
+#include "ximage-loader.h"
#define I_HAVE_XPM
-#ifdef STANDALONE
-#include "../images/ground.xpm"
-#include "../images/tree.xpm"
-#else /* !STANDALONE */
-#include "pixmaps/ground.xpm"
-#include "pixmaps/tree.xpm"
-#endif /* !STANDALONE */
+#include "images/gen/ground_png.h"
+#include "images/gen/tree_png.h"
#endif /* HAVE_XPM */
/* vector utility macros */
glBindTexture(GL_TEXTURE_2D, fs->groundid);
#endif /* HAVE_GLBINDTEXTURE */
- if ((fs->gtexture = xpm_to_ximage(MI_DISPLAY(mi), MI_VISUAL(mi),
- MI_COLORMAP(mi), ground)) == None) {
+ if ((fs->gtexture = image_data_to_ximage(MI_DISPLAY(mi), MI_VISUAL(mi),
+ ground_png,
+ sizeof(ground_png)))
+ == None) {
(void) fprintf(stderr, "Error reading the ground texture.\n");
glDeleteTextures(1, &fs->groundid);
do_texture = False;
clear_gl_error();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
fs->gtexture->width, fs->gtexture->height, 0,
- GL_RGBA,
- /* GL_UNSIGNED_BYTE, */
- GL_UNSIGNED_INT_8_8_8_8_REV,
- fs->gtexture->data);
+ GL_RGBA, GL_UNSIGNED_BYTE, fs->gtexture->data);
check_gl_error("texture");
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
#ifdef HAVE_GLBINDTEXTURE
glBindTexture(GL_TEXTURE_2D,fs->treeid);
#endif /* HAVE_GLBINDTEXTURE */
- if ((fs->ttexture = xpm_to_ximage(MI_DISPLAY(mi), MI_VISUAL(mi),
- MI_COLORMAP(mi), tree)) == None) {
+ if ((fs->ttexture = image_data_to_ximage(MI_DISPLAY(mi),
+ MI_VISUAL(mi),
+ tree_png,
+ sizeof(tree_png)))
+ == None) {
(void)fprintf(stderr,"Error reading tree texture.\n");
glDeleteTextures(1, &fs->treeid);
fs->treeid = 0;
clear_gl_error();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
fs->ttexture->width, fs->ttexture->height, 0,
- GL_RGBA,
- /* GL_UNSIGNED_BYTE, */
- GL_UNSIGNED_INT_8_8_8_8_REV,
- fs->ttexture->data);
+ GL_RGBA, GL_UNSIGNED_BYTE, fs->ttexture->data);
check_gl_error("texture");
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
*/
-static void
-free_fire(firestruct *fs)
+ENTRYPOINT void
+free_fire(ModeInfo * mi)
{
+ firestruct *fs = &fire[MI_SCREEN(mi)];
+
if (mode_font != None && fs->fontbase != None) {
glDeleteLists(fs->fontbase, mode_font->max_char_or_byte2 -
mode_font->min_char_or_byte2 + 1);
{
firestruct *fs;
- /* allocate the main fire table if needed */
- if (fire == NULL) {
- if ((fire = (firestruct *) calloc(MI_NUM_SCREENS(mi),
- sizeof(firestruct))) == NULL)
- return;
- }
-
- /* initialise the per screen fire structure */
+ MI_INIT (mi, fire);
fs = &fire[MI_SCREEN(mi)];
fs->np = MI_COUNT(mi);
fs->fog = do_fog;
/* initialise fire particles if any */
if ((fs->np)&&(fs->p == NULL)) {
if ((fs->p = (part *) calloc(fs->np, sizeof(part))) == NULL) {
- free_fire(fs);
+ free_fire(mi);
return;
}
}
else if (fs->r == NULL) {
/* initialise rain particles if no fire particles */
if ((fs->r = (rain *) calloc(NUMPART, sizeof(part))) == NULL) {
- free_fire(fs);
+ free_fire(mi);
return;
}
}
#endif
glDrawBuffer(GL_BACK);
if (!Init(mi)) {
- free_fire(fs);
+ free_fire(mi);
return;
}
} else {
ENTRYPOINT void release_fire(ModeInfo * mi)
{
- if (fire != NULL) {
- int screen;
- for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++)
- free_fire(&fire[screen]);
- (void) free((void *) fire);
- fire = (firestruct *) NULL;
- }
if (mode_font != None)
{
/* only free-ed when there are no more screens used */