[Moeng-cvs] BBRpg/src canvas.cpp,1.3,1.4 canvas.h,1.2,1.3 rpg.cpp,1.9,1.10 rpg.h,1.5,1.6 script.cpp,
Status: Alpha
Brought to you by:
b_lindeijer
From: Bj?rn L. <b_l...@us...> - 2004-04-13 12:40:09
|
Update of /cvsroot/moeng/BBRpg/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15068/src Modified Files: canvas.cpp canvas.h rpg.cpp rpg.h script.cpp script.h sound.cpp Log Message: Commiting engine changes to our beloved BBRpg on SourceForge. Index: canvas.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/canvas.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** canvas.cpp 9 Dec 2003 21:23:06 -0000 1.3 --- canvas.cpp 13 Apr 2004 12:26:08 -0000 1.4 *************** *** 26,196 **** void Canvas::init() { ! curX = 0; ! curY = 0; ! set_clip(buffer, 0, 0, SCREEN_W - 1, SCREEN_H - 1); ! myFont = font; ! drawColor = makecol(255,255,255); ! alpha = 255; ! drawMode = DM_MASKED; } void Canvas::getCursor(int *x, int *y) { ! ASSERT(x && y); ! *x = curX; ! *y = curY; } void Canvas::setCursor(int x, int y) { ! curX = x; ! curY = y; } void Canvas::getClip(int *x1, int *y1, int *x2, int *y2) { ! ASSERT(x1 && y1 && x2 && y2); ! *x1 = buffer->cl; ! *y1 = buffer->ct; ! *x2 = buffer->cr; ! *y2 = buffer->cb; } void Canvas::setClip(int x1, int y1, int x2, int y2) { ! set_clip(buffer, x1, y1, x2, y2); } void Canvas::setColor(int color) { ! drawColor = color; } void Canvas::setDrawMode(int drawMode) { ! this->drawMode = drawMode; } void Canvas::setAlpha(int alpha) { ! this->alpha = alpha; } void Canvas::setFont(FONT *font) { ! if (font) myFont = font; } void Canvas::textSize(const char *text, int *w, int *h) { ! ASSERT(w && h); ! *w = text_length(myFont, text); ! *h = text_height(myFont); } void Canvas::drawText(const char *text) { ! ASSERT(text); ! int tm = text_mode(-1); // Text will be drawn masked ! textout(buffer, myFont, text, curX, curY, drawColor); ! curX += text_length(myFont, text); ! text_mode(tm); } void Canvas::drawBitmap(BITMAP *bmp, int dw, int dh, int sx, int sy, int sw, int sh) { ! /* ! console.log( ! CON_LOG | CON_CONSOLE, ! CON_DEBUG, ! "Processing draw_bitmap(bmp, %d, %d, %d, %d, %d, %d)", ! dw, dh, sx, sy, sw, sh ! ); ! */ ! ASSERT(bitmap); ! BITMAP *src = NULL; ! // Don't try to process invalid surfaces ! if (dw < 0 || dh < 0) return; ! if (sx != 0 || sy != 0 || sw != bmp->w || sh != bmp->h) ! { ! // The source bitmap needs to be adapted first ! src = create_bitmap(sw, sh); ! ASSERT(src); ! // Determine the point where we should start drawing ! int start_x = -sx % bmp->w; ! int start_y = -sy % bmp->h; ! if (start_x > 0) start_x -= bmp->w; ! if (start_y > 0) start_y -= bmp->h; ! int x = start_x; ! int y = start_y; ! // Create tiled pattern ! while (y < sh) { ! while (x < sw) { ! blit(bmp, src, 0, 0, x, y, bmp->w, bmp->h); ! x += bmp->w; ! } ! x = start_x; ! y += bmp->h; ! } ! bmp = src; ! } ! // Now we'll put this sprite on the screen ! switch (drawMode) { ! case DM_ALPHA: ! set_alpha_blender(); ! break; ! case DM_TRANS: ! set_trans_blender(0,0,0,alpha); ! drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0); ! break; ! } ! if ((drawMode == DM_TRANS && alpha < 255) || drawMode == DM_ALPHA || drawMode == DM_ADD) { ! if (sw == dw && sh == dh) { ! draw_trans_sprite(buffer, bmp, curX, curY); ! } ! else { ! BITMAP *stretch = create_bitmap(dw, dh); ! if (stretch) { ! stretch_sprite(stretch, bmp, 0, 0, dw, dh); ! draw_trans_sprite(buffer, stretch, curX, curY); ! destroy_bitmap(stretch); ! } ! } ! } ! else ! { ! if (sw == dw && sh == dh) { ! draw_sprite(buffer, bmp, curX, curY); ! } ! else { ! stretch_sprite(buffer, bmp, curX, curY, dw, dh); ! } ! } ! switch (drawMode) { ! case DM_TRANS: ! drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0); ! break; ! } ! if (src) destroy_bitmap(src); ! // And don't forget to move that cursor ! curX += dw; } void Canvas::drawViewport(int x, int y, int w, int h, int tx, int ty, TiledMap* map) { ! map->setCamera( ! Point(tx, ty), ! Rectangle(x, y, w, h), ! true, true ! ); ! map->draw(buffer); } --- 26,194 ---- void Canvas::init() { ! curX = 0; ! curY = 0; ! set_clip_rect(buffer, 0, 0, SCREEN_W - 1, SCREEN_H - 1); ! myFont = font; ! drawColor = makecol(255,255,255); ! alpha = 255; ! drawMode = DM_MASKED; } void Canvas::getCursor(int *x, int *y) { ! ASSERT(x && y); ! *x = curX; ! *y = curY; } void Canvas::setCursor(int x, int y) { ! curX = x; ! curY = y; } void Canvas::getClip(int *x1, int *y1, int *x2, int *y2) { ! ASSERT(x1 && y1 && x2 && y2); ! *x1 = buffer->cl; ! *y1 = buffer->ct; ! *x2 = buffer->cr; ! *y2 = buffer->cb; } void Canvas::setClip(int x1, int y1, int x2, int y2) { ! set_clip_rect(buffer, x1, y1, x2, y2); } void Canvas::setColor(int color) { ! drawColor = color; } void Canvas::setDrawMode(int drawMode) { ! this->drawMode = drawMode; } void Canvas::setAlpha(int alpha) { ! this->alpha = alpha; } void Canvas::setFont(FONT *font) { ! if (font) myFont = font; } void Canvas::textSize(const char *text, int *w, int *h) { ! ASSERT(w && h); ! *w = text_length(myFont, text); ! *h = text_height(myFont); } void Canvas::drawText(const char *text) { ! ASSERT(text); ! textout_ex(buffer, myFont, text, curX, curY, drawColor, -1); ! curX += text_length(myFont, text); } void Canvas::drawBitmap(BITMAP *bmp, int dw, int dh, int sx, int sy, int sw, int sh) { ! /* ! console.log( ! CON_LOG | CON_CONSOLE, ! CON_DEBUG, ! "Processing draw_bitmap(bmp, %d, %d, %d, %d, %d, %d)", ! dw, dh, sx, sy, sw, sh ! ); ! */ ! ASSERT(bitmap); ! BITMAP *src = NULL; ! // Don't try to process invalid surfaces ! if (dw < 0 || dh < 0) return; ! if (sx != 0 || sy != 0 || sw != bmp->w || sh != bmp->h) ! { ! // The source bitmap needs to be adapted first ! src = create_bitmap(sw, sh); ! ASSERT(src); ! // Determine the point where we should start drawing ! int start_x = -sx % bmp->w; ! int start_y = -sy % bmp->h; ! if (start_x > 0) start_x -= bmp->w; ! if (start_y > 0) start_y -= bmp->h; ! int x = start_x; ! int y = start_y; ! // Create tiled pattern ! while (y < sh) { ! while (x < sw) { ! blit(bmp, src, 0, 0, x, y, bmp->w, bmp->h); ! x += bmp->w; ! } ! x = start_x; ! y += bmp->h; ! } ! bmp = src; ! } ! // Now we'll put this sprite on the screen ! switch (drawMode) { ! case DM_ALPHA: ! set_alpha_blender(); ! break; ! case DM_TRANS: ! set_trans_blender(0,0,0,alpha); ! drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0); ! break; ! } ! if ((drawMode == DM_TRANS && alpha < 255) || drawMode == DM_ALPHA || drawMode == DM_ADD) { ! if (sw == dw && sh == dh) { ! draw_trans_sprite(buffer, bmp, curX, curY); ! } ! else { ! BITMAP *stretch = create_bitmap(dw, dh); ! if (stretch) { ! stretch_sprite(stretch, bmp, 0, 0, dw, dh); ! draw_trans_sprite(buffer, stretch, curX, curY); ! destroy_bitmap(stretch); ! } ! } ! } ! else ! { ! if (sw == dw && sh == dh) { ! draw_sprite(buffer, bmp, curX, curY); ! } ! else { ! stretch_sprite(buffer, bmp, curX, curY, dw, dh); ! } ! } ! switch (drawMode) { ! case DM_TRANS: ! drawing_mode(DRAW_MODE_SOLID, NULL, 0, 0); ! break; ! } ! if (src) destroy_bitmap(src); ! // And don't forget to move that cursor ! curX += dw; } void Canvas::drawViewport(int x, int y, int w, int h, int tx, int ty, TiledMap* map) { ! map->setCamera( ! Point(tx, ty), ! Rectangle(x, y, w, h), ! true, true ! ); ! map->draw(buffer); } Index: script.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/script.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** script.cpp 13 Jan 2004 16:32:35 -0000 1.14 --- script.cpp 13 Apr 2004 12:26:08 -0000 1.15 *************** *** 21,212 **** #include "canvas.h" #include "common.h" - #include <set> #include <vector> - using std::set; using std::vector; lua_State* L = NULL; [...2143 lines suppressed...] ! } ! else if (strcmp(index, "in_air") == 0) { ! obj->in_air = (int)lua_tonumber(L, -1); ! } ! else if (strcmp(index, "bitmap") == 0) { ! obj->bitmap = (BITMAP*)lua_touserdata(L, -1); ! } ! else if (strcmp(index, "map") == 0) { ! TiledMap* newMap = (TiledMap*)lua_touserdata(L, -1); ! if (newMap != obj->getMap()) obj->setMap(newMap); ! } ! else { ! // Deal with the assigned value normally ! lua_rawset(L, -3); ! } ! } ! lua_settop(L, 0); ! return 0; } Index: canvas.h =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/canvas.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** canvas.h 9 Dec 2003 21:23:06 -0000 1.2 --- canvas.h 13 Apr 2004 12:26:08 -0000 1.3 *************** *** 18,45 **** class Canvas { ! public: ! void init(); ! void getCursor(int *x, int *y); ! void setCursor(int x, int y); ! void getClip(int *x1, int *y1, int *x2, int *y2); ! void setClip(int x1, int y1, int x2, int y2); ! void setColor(int color); ! void setDrawMode(int drawMode); ! int getDrawMode() {return drawMode;} ! void setAlpha(int alpha); ! int getAlpha() {return alpha;} ! void setFont(FONT* font); ! void textSize(const char *text, int *width, int *height); ! void bitmapSize(BITMAP *bmp, int *width, int *height); ! void drawText(const char *text); ! void drawBitmap(BITMAP *bmp, int dw, int dh, int sx, int sy, int sw, int sh); ! void drawViewport(int x, int y, int w, int h, int tx, int ty, TiledMap* map); ! private: ! int curX, curY; // The current cursor position ! int drawColor; // The currently used draw color ! int alpha; // The currently used opacity ! FONT* myFont; // The currently used font ! int drawMode; // The currently used drawmode }; --- 18,45 ---- class Canvas { ! public: ! void init(); ! void getCursor(int *x, int *y); ! void setCursor(int x, int y); ! void getClip(int *x1, int *y1, int *x2, int *y2); ! void setClip(int x1, int y1, int x2, int y2); ! void setColor(int color); ! void setDrawMode(int drawMode); ! int getDrawMode() {return drawMode;} ! void setAlpha(int alpha); ! int getAlpha() {return alpha;} ! void setFont(FONT* font); ! void textSize(const char *text, int *width, int *height); ! void bitmapSize(BITMAP *bmp, int *width, int *height); ! void drawText(const char *text); ! void drawBitmap(BITMAP *bmp,int dw,int dh,int sx,int sy,int sw,int sh); ! void drawViewport(int x,int y,int w,int h,int tx,int ty,TiledMap* map); ! private: ! int curX, curY; // The current cursor position ! int drawColor; // The currently used draw color ! int alpha; // The currently used opacity ! FONT* myFont; // The currently used font ! int drawMode; // The currently used drawmode }; Index: rpg.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/rpg.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** rpg.cpp 13 Jan 2004 16:32:35 -0000 1.9 --- rpg.cpp 13 Apr 2004 12:26:08 -0000 1.10 *************** *** 15,18 **** --- 15,19 ---- #include "shared/tiled_map.h" #include "shared/engine.h" + #include "shared/module.h" #include "script.h" #include "canvas.h" *************** *** 39,43 **** char filename[256]; DATAFILE *interface_graphics; ! DATAFILE *bitmap_data; FONT* engine_font; int gameClassInstance = 0; --- 40,44 ---- char filename[256]; DATAFILE *interface_graphics; ! Module *module; FONT* engine_font; int gameClassInstance = 0; *************** *** 47,51 **** Console console("rpg.log"); - //TiledMap *tiledMap = NULL; TileRepository *tileRepository; TileType *selectedTile = NULL; --- 48,51 ---- *************** *** 55,73 **** void main() { ! init_engine(); ! do { ! // Handle user input ! if (frames_to_do > 0) { ! handle_input(); ! frames_to_do--; ! // If less than 2 extra frames are waiting, take time to display current frame ! if (frames_to_do < 2) {draw_screen();} ! else if (frames_to_do > 10) {frames_to_do = frames_to_do % 10;} ! } ! } while (!game_end); ! exit_program(); } END_OF_MAIN(); --- 55,73 ---- void main() { ! init_engine(); ! do { ! // Handle user input ! if (frames_to_do > 0) { ! handle_input(); ! frames_to_do--; ! // If less than 2 extra frames are waiting, take time to display ! if (frames_to_do < 2) {draw_screen();} ! else if (frames_to_do > 10) {frames_to_do = frames_to_do % 10;} ! } ! } while (!game_end); ! exit_program(); } END_OF_MAIN(); *************** *** 76,215 **** void init_engine() { ! // Allegro initialisation ! console.log(CON_LOG, CON_ALWAYS, "Initializing Allegro..."); ! allegro_init(); ! install_keyboard(); ! install_timer(); ! three_finger_flag = 0; ! set_display_switch_mode(SWITCH_BACKAMNESIA); ! //register_datafile_object(DAT_MAPDATA, load_tiledmapdata, destroy_tiledmapdata); ! set_config_file("rpg.cfg"); ! lps = get_config_int("Engine", "GameSpeed", 100); ! debug_mode = (get_config_int("Engine", "DebugMode", 0)) ? 1 : 0; ! debug_mode += (get_config_int("Engine", "DebugVerbose", 0)) ? 1 : 0; ! int driver = GFX_AUTODETECT_WINDOWED; ! if (get_config_int("Video", "Fullscreen", 0)) { ! driver = GFX_AUTODETECT_FULLSCREEN; ! } ! set_color_conversion( ! (COLORCONV_TOTAL & ~( ! COLORCONV_32A_TO_8 | ! COLORCONV_32A_TO_15 | ! COLORCONV_32A_TO_16 | ! COLORCONV_32A_TO_24 ! )) ! ); ! bVSync = get_config_int("Video", "VSync", 0); ! ! sound_enabled = (get_config_int("Sound", "MusicEnabled", 1)) ? 1 : 0; ! sfx_enabled = (get_config_int("Sound", "SfxEnabled", 1)) ? 1 : 0; ! music_vol = get_config_int("Sound", "MusicVolume", 255); ! sfx_vol = get_config_int("Sound", "SfxVolume", 255); ! music_format = (strcmp(get_config_string("Sound", "MusicFormat", "MIDI"), "MIDI") == 0) ? MUSIC_MIDI : MUSIC_OGG; ! console.enableLogfile = (get_config_int("Engine", "LogEnabled", 1)); ! // Screen initialisation ! int width, height, colordepth = 0; ! width = get_config_int("Video", "ResolutionWidth", 640); ! height = get_config_int("Video", "ResolutionHeight", 480); ! if (driver == GFX_AUTODETECT_FULLSCREEN) {colordepth = desktop_color_depth();} ! if (colordepth == 0) {colordepth = 16;} ! colordepth = get_config_int("Video", "ColorDepth", colordepth); ! bDoubleSize = get_config_int("Video", "DoubleSize", 0); ! if (bDoubleSize) { ! width = width * 2; ! height = height * 2; ! } ! console.log(CON_LOG, CON_ALWAYS, "Setting screen mode (%dx%dx%d)...", width, height, colordepth); ! set_color_depth(colordepth); ! if (set_gfx_mode(driver, width, height, 0, 0) < 0) { ! console.log(CON_LOG, CON_ALWAYS, "Failed, trying screen mode (%dx%dx15)...", width, height); ! set_color_depth(15); ! if (set_gfx_mode(driver, width, height, 0, 0) < 0) { ! console.log(CON_QUIT, CON_ALWAYS, "%s", allegro_error); ! } ! } ! set_window_title("Moonlight RPG engine"); ! text_mode(-1); ! textprintf_centre(screen, font, SCREEN_W/2, SCREEN_H/2, makecol(255,0,0), "LOADING..."); ! console.log(CON_LOG, CON_ALWAYS, "Creating screen buffer..."); ! if (bDoubleSize) { ! buffer = create_bitmap(SCREEN_W / 2, SCREEN_H / 2); ! } else { ! buffer = create_bitmap(SCREEN_W, SCREEN_H); ! } ! clear(buffer); ! console.log(CON_LOG, CON_ALWAYS, "Creating tile repository..."); ! tileRepository = new TileRepository(); ! console.log(CON_LOG, CON_ALWAYS, "Loading gui.dat..."); ! interface_graphics = load_datafile("gui.dat"); ! if (!interface_graphics) { ! console.log(CON_QUIT, CON_ALWAYS, "Error while loading: gui.dat"); ! } ! // Set font to use ! DATAFILE *temp = find_datafile_object(interface_graphics, "SmallFont"); ! if (temp) {engine_font = ((FONT *)temp->dat);} ! console.log(CON_LOG, CON_ALWAYS, "Loading data.dat..."); ! bitmap_data = load_datafile("data.dat"); ! if (!bitmap_data) { ! console.log(CON_QUIT, CON_ALWAYS, "Error while loading: data.dat"); ! } ! if (sound_enabled || sfx_enabled) { ! console.log(CON_LOG, CON_ALWAYS, "Initialising sound..."); ! init_sound(); ! } ! // Lua initialisation ! console.log(CON_LOG, CON_ALWAYS, "Initialising Lua scripting environment..."); ! initScripting(); ! console.log(CON_LOG, CON_ALWAYS, "Installing timers..."); ! LOCK_VARIABLE(frames_to_do); // Game speed handler ! LOCK_FUNCTION(handle_game_time); ! LOCK_VARIABLE(fps); // Frames per second counter ! LOCK_VARIABLE(fps_counter); ! LOCK_FUNCTION(handle_fps_counter); ! install_int_ex(handle_game_time, BPS_TO_TIMER(lps)); ! install_int_ex(handle_fps_counter, BPS_TO_TIMER(1)); ! console.log(CON_LOG, CON_ALWAYS, "Initialising canvas..."); ! canvas.init(); ! console.log(CON_LOG, CON_ALWAYS, "All finished, initializing game..."); ! const char* gameClass = get_config_string("Engine", "GameClass", "Game"); ! lua_pushstring(L, gameClass); lua_gettable(L, LUA_GLOBALSINDEX); ! if (!lua_isnil(L, -1)) { ! lua_call(L, 0, 1); ! if (lua_istable(L, -1)) { ! gameClassInstance = lua_ref(L, -1); ! } ! else { ! console.log(CON_QUIT, CON_ALWAYS, "Error while instaniating game class \"%s\"", gameClass); ! } ! } ! else { ! console.log(CON_QUIT, CON_ALWAYS, "Error: could not find game class \"%s\"", gameClass); ! } ! clear(screen); } --- 76,224 ---- void init_engine() { ! // Allegro initialisation ! console.log(CON_LOG, CON_ALWAYS, "Initializing Allegro..."); ! allegro_init(); ! install_keyboard(); ! install_timer(); ! three_finger_flag = 0; ! set_display_switch_mode(SWITCH_BACKAMNESIA); ! //register_datafile_object( ! // DAT_MAPDATA, load_tiledmapdata, destroy_tiledmapdata); ! set_config_file("rpg.cfg"); ! lps = get_config_int("Engine", "GameSpeed", 100); ! debug_mode = (get_config_int("Engine", "DebugMode", 0)) ? 1 : 0; ! debug_mode += (get_config_int("Engine", "DebugVerbose", 0)) ? 1 : 0; ! int driver = GFX_AUTODETECT_WINDOWED; ! if (get_config_int("Video", "Fullscreen", 0)) { ! driver = GFX_AUTODETECT_FULLSCREEN; ! } ! set_color_conversion( ! (COLORCONV_TOTAL & ! ~( ! COLORCONV_32A_TO_8 | ! COLORCONV_32A_TO_15 | ! COLORCONV_32A_TO_16 | ! COLORCONV_32A_TO_24 ! )) ! ); ! bVSync = get_config_int("Video", "VSync", 0); ! sound_enabled = (get_config_int("Sound", "MusicEnabled", 1)) ? 1 : 0; ! sfx_enabled = (get_config_int("Sound", "SfxEnabled", 1)) ? 1 : 0; ! music_vol = get_config_int("Sound", "MusicVolume", 255); ! sfx_vol = get_config_int("Sound", "SfxVolume", 255); ! music_format = (strcmp(get_config_string("Sound", "MusicFormat", "MIDI"), ! "MIDI") == 0) ? MUSIC_MIDI : MUSIC_OGG; ! console.enableLogfile = (get_config_int("Engine", "LogEnabled", 1)); ! // Screen initialisation ! int width, height, colordepth = 0; ! width = get_config_int("Video", "ResolutionWidth", 640); ! height = get_config_int("Video", "ResolutionHeight", 480); ! if (driver == GFX_AUTODETECT_FULLSCREEN) { ! colordepth = desktop_color_depth(); ! } ! if (colordepth == 0) { ! colordepth = 16; ! } ! colordepth = get_config_int("Video", "ColorDepth", colordepth); ! bDoubleSize = get_config_int("Video", "DoubleSize", 0); ! if (bDoubleSize) { ! width = width * 2; ! height = height * 2; ! } ! console.log(CON_LOG, CON_ALWAYS, ! "Setting screen mode (%dx%dx%d)...", width, height, colordepth); ! set_color_depth(colordepth); ! if (set_gfx_mode(driver, width, height, 0, 0) < 0) { ! console.log(CON_LOG, CON_ALWAYS, ! "Failed, trying screen mode (%dx%dx15)...", width, height); ! set_color_depth(15); ! if (set_gfx_mode(driver, width, height, 0, 0) < 0) { ! console.log(CON_QUIT, CON_ALWAYS, "%s", allegro_error); ! } ! } ! set_window_title("Moonlight RPG engine"); ! textprintf_centre_ex( ! screen, font, SCREEN_W/2, SCREEN_H/2, makecol(255,0,0), -1, ! "LOADING..."); ! console.log(CON_LOG, CON_ALWAYS, "Creating screen buffer..."); ! if (bDoubleSize) { ! buffer = create_bitmap(SCREEN_W / 2, SCREEN_H / 2); ! } else { ! buffer = create_bitmap(SCREEN_W, SCREEN_H); ! } ! clear(buffer); ! console.log(CON_LOG, CON_ALWAYS, "Creating tile repository..."); ! tileRepository = new TileRepository(); ! console.log(CON_LOG, CON_ALWAYS, "Loading gui.dat..."); ! interface_graphics = load_datafile("gui.dat"); ! if (!interface_graphics) { ! console.log(CON_QUIT, CON_ALWAYS, "Error while loading: gui.dat"); ! } ! // Set font to use ! DATAFILE *temp = find_datafile_object(interface_graphics, "SmallFont"); ! if (temp) {engine_font = ((FONT *)temp->dat);} ! console.log(CON_LOG, CON_ALWAYS, "Loading module \"data\"..."); ! module = new Module("data"); ! if (sound_enabled || sfx_enabled) { ! console.log(CON_LOG, CON_ALWAYS, "Initialising sound..."); ! init_sound(); ! } ! // Lua initialisation ! console.log(CON_LOG, CON_ALWAYS, "Initialising scripting environment..."); ! initScripting(); ! console.log(CON_LOG, CON_ALWAYS, "Installing timers..."); ! LOCK_VARIABLE(frames_to_do); // Game speed handler ! LOCK_FUNCTION(handle_game_time); ! LOCK_VARIABLE(fps); // Frames per second counter ! LOCK_VARIABLE(fps_counter); ! LOCK_FUNCTION(handle_fps_counter); ! install_int_ex(handle_game_time, BPS_TO_TIMER(lps)); ! install_int_ex(handle_fps_counter, BPS_TO_TIMER(1)); ! console.log(CON_LOG, CON_ALWAYS, "Initialising canvas..."); ! canvas.init(); ! console.log(CON_LOG, CON_ALWAYS, "All finished, initializing game..."); ! ! const char* gameClass = get_config_string("Engine", "GameClass", "Game"); ! lua_pushstring(L, gameClass); lua_gettable(L, LUA_GLOBALSINDEX); ! if (!lua_isnil(L, -1)) { ! lua_call(L, 0, 1); ! if (lua_istable(L, -1)) { ! gameClassInstance = lua_ref(L, -1); ! } ! else { ! console.log(CON_QUIT, CON_ALWAYS, ! "Error while instaniating game class \"%s\"", gameClass); ! } ! } ! else { ! console.log(CON_QUIT, CON_ALWAYS, ! "Error: could not find game class \"%s\"", gameClass); ! } ! clear(screen); } *************** *** 217,256 **** void handle_input() { ! if (keypressed()) { ! inkey = (readkey() >> 8); ! if (console.handleInput(inkey)) inkey = 0; ! } ! else { ! inkey = 0; ! } ! if (inkey > 0) ! { ! char *key_name = "anykey"; ! if (inkey == KEY_ESC) key_name = "esc"; ! if (inkey == KEY_TAB) key_name = "tab"; ! if (inkey == KEY_SPACE || inkey == KEY_ENTER) key_name = "action"; ! if (inkey == KEY_UP) key_name = "up"; ! if (inkey == KEY_LEFT) key_name = "left"; ! if (inkey == KEY_RIGHT) key_name = "right"; ! if (inkey == KEY_DOWN) key_name = "down"; ! if (inkey == KEY_LCONTROL || inkey == KEY_RCONTROL) key_name = "ctrl"; ! callMemberFunction(gameClassInstance, "event_keypress", "s", key_name); ! } ! update_objects(); ! callMemberFunction(gameClassInstance, "event_logic_update"); ! console.update(); #ifdef ENABLE_MUSIC ! if (sound_enabled && sound_counter == 0) { ! poll_sound(); ! sound_counter = 10; ! } ! sound_counter--; #endif } --- 226,265 ---- void handle_input() { ! if (keypressed()) { ! inkey = (readkey() >> 8); ! if (console.handleInput(inkey)) inkey = 0; ! } ! else { ! inkey = 0; ! } ! if (inkey > 0) ! { ! char *key_name = "anykey"; ! if (inkey == KEY_ESC) key_name = "esc"; ! if (inkey == KEY_TAB) key_name = "tab"; ! if (inkey == KEY_SPACE || inkey == KEY_ENTER) key_name = "action"; ! if (inkey == KEY_UP) key_name = "up"; ! if (inkey == KEY_LEFT) key_name = "left"; ! if (inkey == KEY_RIGHT) key_name = "right"; ! if (inkey == KEY_DOWN) key_name = "down"; ! if (inkey == KEY_LCONTROL || inkey == KEY_RCONTROL) key_name = "ctrl"; ! callMemberFunction(gameClassInstance, "event_keypress", "s", key_name); ! } ! update_objects(); ! callMemberFunction(gameClassInstance, "event_logic_update"); ! console.update(); #ifdef ENABLE_MUSIC ! if (sound_enabled && sound_counter == 0) { ! poll_sound(); ! sound_counter = 10; ! } ! sound_counter--; #endif } *************** *** 259,287 **** void draw_screen() { ! clear_bitmap(buffer); ! callMemberFunction(gameClassInstance, "event_render"); ! canvas.init(); ! if (debug_mode) { ! font = engine_font; ! textprintf_centre(buffer, font, buffer->w / 2 + 1, 12, makecol(0,0,0) , "%d fps", fps); ! textprintf_centre(buffer, font, buffer->w / 2, 11, makecol(128,128,150), "%d fps", fps); ! } ! console.draw(buffer); ! update_screen(); ! fps_counter++; } void update_screen() { ! if (bVSync) vsync(); ! if (bDoubleSize) { ! stretch_blit(buffer, screen, 0, 0, buffer->w, buffer->h, 0, 0, buffer->w * 2, buffer->h * 2); ! } else { ! blit(buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h); ! } } --- 268,302 ---- void draw_screen() { ! clear_bitmap(buffer); ! callMemberFunction(gameClassInstance, "event_render"); ! canvas.init(); ! if (debug_mode) { ! font = engine_font; ! textprintf_centre_ex( ! buffer, font, buffer->w / 2 + 1, 12, makecol(0,0,0), -1, ! "%d fps", fps); ! textprintf_centre_ex( ! buffer, font, buffer->w / 2, 11, makecol(128,128,150), -1, ! "%d fps", fps); ! } ! console.draw(buffer); ! update_screen(); ! fps_counter++; } void update_screen() { ! if (bVSync) vsync(); ! if (bDoubleSize) { ! stretch_blit(buffer, screen, ! 0, 0, buffer->w, buffer->h, ! 0, 0, buffer->w * 2, buffer->h * 2); ! } else { ! blit(buffer, screen, 0, 0, 0, 0, buffer->w, buffer->h); ! } } *************** *** 289,325 **** void exit_program() { ! console.log(CON_LOG, CON_ALWAYS, "Game ended"); ! console.log(CON_LOG, CON_ALWAYS, "Deleting objects..."); ! list<TiledMap*>::iterator i; ! while (!maps.empty()) ! { ! i = maps.begin(); ! delete (*i); ! maps.erase(i); ! } ! console.log(CON_LOG, CON_ALWAYS, "Deleting tile repository..."); ! delete tileRepository; ! console.log(CON_LOG, CON_ALWAYS, "Removing timers..."); ! remove_int(handle_fps_counter); ! remove_int(handle_game_time); ! console.log(CON_LOG, CON_ALWAYS, "Unloading datafiles..."); ! unload_datafile(interface_graphics); ! unload_datafile(bitmap_data); ! if (sound_enabled || sfx_enabled) { ! console.log(CON_LOG, CON_ALWAYS, "Deinitializing sound..."); ! exit_sound(); ! } ! console.log(CON_LOG, CON_ALWAYS, "Destroying screen buffer..."); ! destroy_bitmap(buffer); ! console.log(CON_LOG, CON_ALWAYS, "Closing Lua scripting environment..."); ! exitScripting(); ! exit(0); } --- 304,342 ---- void exit_program() { ! console.log(CON_LOG, CON_ALWAYS, "Game ended"); ! console.log(CON_LOG, CON_ALWAYS, "Deleting objects..."); ! list<TiledMap*>::iterator i; ! while (!maps.empty()) ! { ! i = maps.begin(); ! delete (*i); ! maps.erase(i); ! } ! console.log(CON_LOG, CON_ALWAYS, "Deleting tile repository..."); ! delete tileRepository; ! console.log(CON_LOG, CON_ALWAYS, "Removing timers..."); ! remove_int(handle_fps_counter); ! remove_int(handle_game_time); ! console.log(CON_LOG, CON_ALWAYS, "Unloading datafiles..."); ! unload_datafile(interface_graphics); ! delete module; ! if (sound_enabled || sfx_enabled) { ! console.log(CON_LOG, CON_ALWAYS, "Deinitializing sound..."); ! exit_sound(); ! } ! console.log(CON_LOG, CON_ALWAYS, "Destroying screen buffer..."); ! destroy_bitmap(buffer); ! console.log(CON_LOG, CON_ALWAYS, "Closing scripting environment..."); ! exitScripting(); ! ! console.log(CON_LOG, CON_ALWAYS, "Shutdown complete, exiting..."); ! exit(0); } Index: sound.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/sound.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sound.cpp 13 Jan 2004 16:32:35 -0000 1.9 --- sound.cpp 13 Apr 2004 12:26:08 -0000 1.10 *************** *** 33,41 **** // Currently playing OGG file struct { ! SAMPLE *sample; ! int voice; ! struct alogg_stream *stream; ! AUDIOSTREAM *ass; ! char filename[128]; } channels[CHANNELS]; --- 33,41 ---- // Currently playing OGG file struct { ! SAMPLE *sample; ! int voice; ! struct alogg_stream *stream; ! AUDIOSTREAM *ass; ! char filename[128]; } channels[CHANNELS]; *************** *** 45,80 **** void init_sound() { ! // To achieve the max possible volume ! set_volume_per_voice(0); ! // Initialize alogg ! int midi_driver = MIDI_NONE; ! int sound_driver = DIGI_NONE; ! if (music_format == MUSIC_MIDI) { ! midi_driver = MIDI_AUTODETECT; ! } ! if (sfx_enabled || (sound_enabled && music_format != MUSIC_MIDI)) { #ifdef ENABLE_MUSIC ! alogg_init(); #endif ! sound_driver = DIGI_AUTODETECT; ! } ! // Install sound driver ! if (install_sound(sound_driver, midi_driver, NULL) != 0) { ! console.log(CON_LOG, CON_ALWAYS, "Error initialising sound system: %s", allegro_error); ! return; ! } #ifdef ENABLE_MUSIC ! // Initialize channels to NULL ! for (int i = 0; i < CHANNELS; i++) { ! channels[i].voice = 0; ! channels[i].sample = NULL; ! channels[i].stream = NULL; ! channels[i].ass = NULL; ! } #endif } --- 45,80 ---- void init_sound() { ! // To achieve the max possible volume ! set_volume_per_voice(0); ! // Initialize alogg ! int midi_driver = MIDI_NONE; ! int sound_driver = DIGI_NONE; ! if (sound_enabled && music_format == MUSIC_MIDI) { ! midi_driver = MIDI_AUTODETECT; ! } ! if (sfx_enabled || (sound_enabled && music_format != MUSIC_MIDI)) { #ifdef ENABLE_MUSIC ! alogg_init(); #endif ! sound_driver = DIGI_AUTODETECT; ! } ! // Install sound driver ! if (install_sound(sound_driver, midi_driver, NULL) != 0) { ! console.log(CON_LOG, CON_ALWAYS, "Error initialising sound system: %s", allegro_error); ! return; ! } #ifdef ENABLE_MUSIC ! // Initialize channels to NULL ! for (int i = 0; i < CHANNELS; i++) { ! channels[i].voice = 0; ! channels[i].sample = NULL; ! channels[i].stream = NULL; ! channels[i].ass = NULL; ! } #endif } *************** *** 83,136 **** /* play_music(filename, channel) ! */ int l_play_music(lua_State *L) { ! char* filename; ! int channel; ! getLuaArguments(L, "si", &filename, &channel); ! error = NULL; ! if (channel < 0 || channel > CHANNELS) {error = "invalid channel";} ! if (sound_enabled && error == NULL) { ! if (music_format == MUSIC_MIDI) { ! replace_extension(channels[channel].filename, get_filename(filename), "mid", 128); ! ! DATAFILE *found_object = find_datafile_object(bitmap_data, channels[channel].filename); ! if (found_object) { ! play_looped_midi((MIDI*)found_object->dat, 0, -1); ! } else { ! console.log(CON_QUIT, CON_ALWAYS, "Could not find MIDI file in datafile (%s)", channels[channel].filename); ! } ! } else { #ifdef ENABLE_MUSIC ! // Stop currently playing music ! stop_music(channel); ! ! if (!exists(filename)) {error = "file does not exist";} ! ! strncpy(channels[channel].filename, filename, 128); ! ! channels[channel].stream = alogg_start_streaming(channels[channel].filename, BLOCK_SIZE); ! if (!channels[channel].stream) { ! fprintf(stderr,"Error opening %s\n", channels[channel].filename); ! alogg_exit(); ! exit(1); ! } ! channels[channel].ass = alogg_get_audio_stream(channels[channel].stream); ! voice_set_volume(channels[channel].ass->voice, music_vol); #endif ! } ! } ! ! if (error == NULL) { ! console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, "Playing music file (%s)", filename); ! } ! else { ! console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, "Error playing music file \"%s\" (%s)", filename, error); ! } ! ! return 0; } --- 83,138 ---- /* play_music(filename, channel) ! */ int l_play_music(lua_State *L) { ! char* filename; ! int channel; ! getLuaArguments(L, "si", &filename, &channel); ! error = NULL; ! if (channel < 0 || channel > CHANNELS) {error = "invalid channel";} ! if (sound_enabled && error == NULL) { ! if (music_format == MUSIC_MIDI) { ! replace_extension(channels[channel].filename, get_filename(filename), "mid", 128); ! ! MIDI *midi = module->findMidi(channels[channel].filename); ! if (midi) { ! play_looped_midi(midi, 0, -1); ! } else { ! console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, ! "Could not find MIDI file in datafile (%s)", ! channels[channel].filename); ! } ! } else { #ifdef ENABLE_MUSIC ! // Stop currently playing music ! stop_music(channel); ! ! if (!exists(filename)) {error = "file does not exist";} ! ! strncpy(channels[channel].filename, filename, 128); ! ! channels[channel].stream = alogg_start_streaming(channels[channel].filename, BLOCK_SIZE); ! if (!channels[channel].stream) { ! fprintf(stderr,"Error opening %s\n", channels[channel].filename); ! alogg_exit(); ! exit(1); ! } ! channels[channel].ass = alogg_get_audio_stream(channels[channel].stream); ! voice_set_volume(channels[channel].ass->voice, music_vol); #endif ! } ! } ! ! if (error == NULL) { ! console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, "Playing music file (%s)", filename); ! } ! else { ! console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, "Error playing music file \"%s\" (%s)", filename, error); ! } ! ! return 0; } *************** *** 139,173 **** /* adjust_channel(channel, volume, panning, speed) ! */ int l_adjust_channel(lua_State *L) { ! int channel, vol, pan, speed; ! getLuaArguments(L, "iiii", &channel, &vol, &pan, &speed); ! error = NULL; ! if (sound_enabled && music_format != MUSIC_MIDI) { ! if (channel < 0 || channel > CHANNELS) {error = "invalid channel";} ! else if (!channels[channel].ass) {error = "no music on this channel to adjust";} ! else if (vol < 0 || vol > 255) {error = "illegal volume value";} ! else if (pan < 0 || pan > 255) {error = "illegal panning value";} ! else if (speed < 0) {error = "illegal speed value";} ! if (error == NULL) { ! voice_set_volume(channels[channel].ass->voice, int(vol * (float(music_vol) / 255.0f))); ! //console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, "Adjusted channel parameters (%d, %d, %d, %d)", channel, vol, pan, speed); ! } else { ! console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, "Error adjusting channel parameters (%s)", error); ! } ! } ! return 0; } /* get_number_of_channels() ! */ int l_get_number_of_channels(lua_State *L) { ! return putLuaArguments(L, "i", CHANNELS); } --- 141,175 ---- /* adjust_channel(channel, volume, panning, speed) ! */ int l_adjust_channel(lua_State *L) { ! int channel, vol, pan, speed; ! getLuaArguments(L, "iiii", &channel, &vol, &pan, &speed); ! error = NULL; ! if (sound_enabled && music_format != MUSIC_MIDI) { ! if (channel < 0 || channel > CHANNELS) {error = "invalid channel";} ! else if (!channels[channel].ass) {error = "no music on this channel to adjust";} ! else if (vol < 0 || vol > 255) {error = "illegal volume value";} ! else if (pan < 0 || pan > 255) {error = "illegal panning value";} ! else if (speed < 0) {error = "illegal speed value";} ! if (error == NULL) { ! voice_set_volume(channels[channel].ass->voice, int(vol * (float(music_vol) / 255.0f))); ! //console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, "Adjusted channel parameters (%d, %d, %d, %d)", channel, vol, pan, speed); ! } else { ! console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, "Error adjusting channel parameters (%s)", error); ! } ! } ! return 0; } /* get_number_of_channels() ! */ int l_get_number_of_channels(lua_State *L) { ! return putLuaArguments(L, "i", CHANNELS); } *************** *** 175,233 **** void poll_sound() { ! if (music_format != MUSIC_MIDI) { ! for (int i = 0; i < CHANNELS; i++) { ! if (channels[i].stream) { ! int ret = alogg_update_streaming(channels[i].stream); ! if (ret == 0) { ! // Loop song ! stop_music(i); ! channels[i].stream = alogg_start_streaming(channels[i].filename, BLOCK_SIZE); ! if (!channels[i].stream) { ! fprintf(stderr,"Error opening %s\n", channels[i].filename); ! alogg_exit(); ! exit(1); ! } ! channels[i].ass = alogg_get_audio_stream(channels[i].stream); ! break; ! } ! } ! } ! } } void stop_music(int channel) { ! /* ! if (channels[channel].voice) { ! deallocate_voice(channels[channel].voice); ! destroy_sample(channels[channel].sample); ! channels[channel].voice = 0; ! channels[channel].sample = NULL; ! } ! */ ! if (music_format != MUSIC_MIDI && channels[channel].stream) { ! alogg_stop_streaming(channels[channel].stream); ! channels[channel].stream = NULL; ! channels[channel].ass = NULL; ! } } /* stop_music(channel) ! */ int l_stop_music(lua_State *L) { ! int channel; ! getLuaArguments(L, "i", &channel); ! error = NULL; ! if (channel < 0 || channel >= CHANNELS) {error = "invalid channel";} ! if (error == NULL) { ! stop_music(channel); ! } else { ! console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, "Error stopping music (%s)", error); ! } ! return 0; } --- 177,235 ---- void poll_sound() { ! if (music_format != MUSIC_MIDI) { ! for (int i = 0; i < CHANNELS; i++) { ! if (channels[i].stream) { ! int ret = alogg_update_streaming(channels[i].stream); ! if (ret == 0) { ! // Loop song ! stop_music(i); ! channels[i].stream = alogg_start_streaming(channels[i].filename, BLOCK_SIZE); ! if (!channels[i].stream) { ! fprintf(stderr,"Error opening %s\n", channels[i].filename); ! alogg_exit(); ! exit(1); ! } ! channels[i].ass = alogg_get_audio_stream(channels[i].stream); ! break; ! } ! } ! } ! } } void stop_music(int channel) { ! /* ! if (channels[channel].voice) { ! deallocate_voice(channels[channel].voice); ! destroy_sample(channels[channel].sample); ! channels[channel].voice = 0; ! channels[channel].sample = NULL; ! } ! */ ! if (music_format != MUSIC_MIDI && channels[channel].stream) { ! alogg_stop_streaming(channels[channel].stream); ! channels[channel].stream = NULL; ! channels[channel].ass = NULL; ! } } /* stop_music(channel) ! */ int l_stop_music(lua_State *L) { ! int channel; ! getLuaArguments(L, "i", &channel); ! error = NULL; ! if (channel < 0 || channel >= CHANNELS) {error = "invalid channel";} ! if (error == NULL) { ! stop_music(channel); ! } else { ! console.log(CON_LOG | CON_CONSOLE, CON_ALWAYS, "Error stopping music (%s)", error); ! } ! return 0; } *************** *** 236,257 **** /* play_sample(filename) ! */ int l_play_sample(lua_State *L) { ! char* name; ! getLuaArguments(L, "s", &name); ! if (sfx_enabled) { ! DATAFILE *found_object = find_datafile_object(bitmap_data, name); ! if (found_object) { ! console.log(CON_LOG, CON_ALWAYS, "Playing sample: %s", name); ! play_sample((SAMPLE*)found_object->dat, sfx_vol, 128, 1000, 0); ! } else { ! return luaL_error(L, "Error: Cannot find requested sample (%s)!", name); ! } ! } ! return 0; } --- 238,260 ---- /* play_sample(filename) ! */ int l_play_sample(lua_State *L) { ! char* name; ! getLuaArguments(L, "s", &name); ! if (sfx_enabled) { ! SAMPLE *sample = module->findSample(name); ! if (sample) { ! console.log(CON_LOG, CON_ALWAYS, "Playing sample: %s", name); ! play_sample(sample, sfx_vol, 128, 1000, 0); ! } else { ! return luaL_error(L, ! "Error: Cannot find requested sample (%s)!", name); ! } ! } ! return 0; } *************** *** 259,269 **** { #ifdef ENABLE_MUSIC ! for (int i = 0; i < CHANNELS; i++) { ! stop_music(i); ! } ! if (sound_enabled && music_format != MUSIC_MIDI) { ! alogg_exit(); ! } #endif } --- 262,272 ---- { #ifdef ENABLE_MUSIC ! for (int i = 0; i < CHANNELS; i++) { ! stop_music(i); ! } ! if (sound_enabled && music_format != MUSIC_MIDI) { ! alogg_exit(); ! } #endif } Index: script.h =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/script.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** script.h 1 Jan 2004 17:10:55 -0000 1.6 --- script.h 13 Apr 2004 12:26:08 -0000 1.7 *************** *** 26,30 **** ! //=================== The engine to script interface ============================/ void initScripting(); --- 26,30 ---- ! //============ The engine to script interface ============================/ void initScripting(); *************** *** 33,37 **** void handleLuaError(int err, const char *string); ! int callMemberFunction(int tableRef, const char *function, const char *argfmt = NULL, ...); int callFunction(const char *function, const char *argfmt = NULL, ...); --- 33,38 ---- void handleLuaError(int err, const char *string); ! int callMemberFunction( ! int tableRef, const char *function, const char *argfmt = NULL, ...); int callFunction(const char *function, const char *argfmt = NULL, ...); *************** *** 40,44 **** ! //=================== The script to engine interface ============================/ int l_alert(lua_State *L); --- 41,45 ---- ! //============ The script to engine interface ============================/ int l_alert(lua_State *L); *************** *** 75,78 **** --- 76,80 ---- int l_map_to_screen(lua_State *L); int l_get_tile_at(lua_State *L); + int l_set_tile_at(lua_State *L); int l_walk_obj(lua_State *L); *************** *** 91,95 **** ! //=================== Tag methods ====================================================/ int object_gettable(lua_State *L); --- 93,97 ---- ! //======= Tag methods ====================================================/ int object_gettable(lua_State *L); Index: rpg.h =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/rpg.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** rpg.h 9 Dec 2003 01:42:46 -0000 1.5 --- rpg.h 13 Apr 2004 12:26:08 -0000 1.6 *************** *** 16,19 **** --- 16,20 ---- #include "shared/engine.h" #include "shared/console.h" + #include "shared/module.h" #include <map> #include <allegro.h> *************** *** 30,34 **** extern DATAFILE *interface_graphics; ! extern DATAFILE *bitmap_data; extern int gameClassInstance; --- 31,35 ---- extern DATAFILE *interface_graphics; ! extern Module *module; extern int gameClassInstance; |