/* * resspr.c * * Loading sprites * * © 1994-1998 Straylight */ /*----- Licensing note ----------------------------------------------------* * * This file is part of Straylight's Steel library. * * Steel 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, or (at your option) * any later version. * * Steel 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 Steel. If not, write to the Free Software Foundation, * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "os.h" #include "resspr.h" #include "mem.h" #include "msgs.h" #include "werr.h" #include "res.h" static sprite_area *resspr__area=(sprite_area *)1; /* * void resspr_init(void) * * Use * Loads the applications `Sprites' file into memory. */ void resspr_init(void) { os_filestr f; int size; /* --- Find the file and it's length --- */ f.name=res_name("Sprites"); f.action=17; if (os_file(&f) || f.action!=1) return; /* --- Create a buffer the right size --- * * * The sprite file size may not be word aligned -- cope with this. */ size=(f.start+7) & ~3; resspr__area=mem_alloc(size); if (!resspr__area) { werr(FALSE,msgs_lookup("ressprNEM:Not enough memory to load sprites.")); exit(0); } /* --- Load the sprites into memory --- */ resspr__area->size=size; f.action=16; f.loadaddr=((int)resspr__area)+4; f.execaddr=0; os_file(&f); } /* * sprite_area *resspr_area(void) * * Use * Returns the address of the application's sprite area. */ sprite_area *resspr_area(void) { return (resspr__area); }