Beispiel #1
0
static void page_create( Page* pPage, int width, int height )
{
    SYS_VERIFY( rendertarget_create( &pPage->bgTarget, width, height, PixelFormat_R8G8B8A8 ) );
    SYS_VERIFY( rendertarget_create( &pPage->fgTarget, width, height, PixelFormat_R8G8B8A8 ) );
    SYS_VERIFY( rendertarget_create( &pPage->burnTarget, width, height, PixelFormat_R8G8B8A8 ) );

    // render into render target:
    graphics_setRenderTarget( &pPage->bgTarget );   
    graphics_setBlendMode( BlendMode_Disabled );

    // render paper:
    graphics_setShader( &s_renderer.paperShader );    
    graphics_setFp4f( 0u, float_rand(), float_rand(), 2.0f / width, 2.0f / height );
    graphics_setVp4f( 0u, 32.0f, 18.0f, 0.4f, 0.3f );    
    graphics_setFsTexture(0,s_renderer.noiseTarget.id,SamplerState_MirrorU_MirrorV_Bilinear);
    graphics_drawFullscreenQuad();
   
    // clear fg+burn target:
    graphics_setShader( 0 );

    graphics_setRenderTarget( &pPage->fgTarget );
    graphics_clear( 0.0f, 0.0f, 0.0f, 0.0f );

    graphics_setRenderTarget( &pPage->burnTarget );
    graphics_clear( 0.0f, 0.0f, 0.0f, 0.0f );
}
Beispiel #2
0
void game_showLevelIncrement() {
	char *buffer[9]; // level xx\0
	Particle *particle = NULL;

	particle = particle_createNewParticle();
	graphics_clear();
	sprintf((void*)buffer, "LEVEL %d", game.level);
	font_print(0, 0, (void*)buffer, NULL);
	glFlush();

	if (!level_increment_texture) {
		level_increment_texture = graphics_createTextureFromViewport(0, SCREEN_HEIGHT - 128,
																															128, 128);
	} else {
		graphics_adjustTextureFromViewport(0, SCREEN_HEIGHT - 128, 128, 128,
			level_increment_texture);
	}
	
	particle->texture = level_increment_texture;
	particle->alpha = 1.0f;
	particle->alpha_decay = -0.02f;
	particle->v_speed = 1.0f;
	particle->x = GRID_BLOCK_SIZE + ((GRID_BLOCK_SIZE * GRID_WIDTH) / 2) - 32;
	particle->y = GRID_BLOCK_SIZE + ((GRID_BLOCK_SIZE * GRID_HEIGHT) / 2) - 64;
	
	particle_createNewCollection(particle);

}
Beispiel #3
0
// creates some particles to show score incrememnts
void game_showScoreIncrement(int line, int increment) {
	int i;
	char buffer[5];
	Particle *first = NULL;
	Particle *current = NULL;

	for (i = 0; i < GRID_WIDTH; i++) {
		if (first == NULL) { // if we dont have any particles yet
      first = particle_createNewParticle();
      current = first;

      graphics_clear(); // clear the back buffer

      // create the texture for the increments
      // TODO: adjust for adjustable resolution
      if (!score_increment_texture) {
				sprintf(buffer, "+%d", increment);
				font_print(0, 0, buffer, NULL); // put the text into the back buffer
		    glFlush();				
				score_increment_texture = graphics_createTextureFromViewport(0, 
																																		 SCREEN_HEIGHT - 128, 
																																		 128, 128);
			}
			else {
				if (increment != previous_increment) {
					sprintf(buffer, "+%d", increment);
					font_print(0, 0, buffer, NULL); // put the text into the back buffer
		      glFlush();	
					graphics_adjustTextureFromViewport(0, SCREEN_HEIGHT - 128, 128, 128, 
																						score_increment_texture);
				}
			}
			current->texture = score_increment_texture;
    }
    else { // if we're adding to already existing
      current->next = particle_createNewParticle();
      current = current->next;
      current->texture = first->texture;
    }

		// set some initial particle states
		current->alpha = 0.8f;
		current->alpha_decay = -((_random(2) + 1) * 0.01);
		current->v_speed = -((_random(10) + 1) * 0.1);
    current->x = 20 + (GRID_BLOCK_SIZE * i);
	    current->y = (GRID_BLOCK_SIZE/2) + (GRID_BLOCK_SIZE * line);
	}

  // add to the collection
  particle_createNewCollection(first);

	previous_increment = increment;
}
Beispiel #4
0
// Expects errorhandler at index 1
void pcall(lua_State *state, int nargs) {
  if(lua_pcall(state, nargs, 0, 1)) {
    char const *msg = lua_tostring(state, -1);
    printf("Lua error: %s\n", msg);
    graphics_Font font;
    graphics_setBackgroundColor(0.64f, 0.27f, 0.26f, 1.0f);
    graphics_clear();
    graphics_setColor(1.0f, 1.0f, 1.0f, 0.8f);
    graphics_Font_new(&font, 0, 12);
    graphics_Font_render(&font, msg, 10, 40, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); 
    graphics_swap();

    #ifdef EMSCRIPTEN
      emscripten_force_exit(1);
    #else
      exit(1);
    #endif
  }
}
Beispiel #5
0
int main(int argc, char ** argv)
{
	graphics_open(100,100);

	int x, j;
	for (j = 0; j < 10; ++j)
	{
		for (x = 0; x < 100; ++x)
		{
			graphics_clear();
			graphics_circle_fill(x, 50, 5, 255, 0, 0);
			graphics_update();
			msleep(10);
		}
	}

	graphics_close();

	return 0;
}
Beispiel #6
0
void graphics_scrollup( struct graphics *g, int32_t x, int32_t y, int32_t w, int32_t h, int32_t dy )
{
	int j;

	w = MIN(g->clip.w-x,w);
	h = MIN(g->clip.h-y,h);
	x += g->clip.x;
	y += g->clip.y;

	if(dy>h) dy=h;

	for(j=0;j<(h-dy);j++) {
		memcpy(
			&g->bitmap->data[((y+j)*g->bitmap->width+x)*3],
			&g->bitmap->data[((y+j+dy)*g->bitmap->width+x)*3],
			w*3
		);
	}

	graphics_clear(g,x,y+h-dy,w,dy);
}
Beispiel #7
0
void main_loop(void *data) {
  MainLoopData* loopData = (MainLoopData*)data;
  // TODO use registry to get love.update and love.draw?

  chdir("love");

  timer_step();
  graphics_clear();
  matrixstack_origin();
  lua_rawgeti(loopData->luaState, LUA_REGISTRYINDEX, loopData->errhand);
  lua_getglobal(loopData->luaState, "love");
  lua_pushstring(loopData->luaState, "update");

  lua_rawget(loopData->luaState, -2);
  lua_pushnumber(loopData->luaState, timer_getDelta());
  pcall(loopData->luaState, 1);

  lua_pushstring(loopData->luaState, "draw");
  lua_rawget(loopData->luaState, -2);

  pcall(loopData->luaState, 0);

  graphics_DisplayState curState = *graphics_getState();
  matrixstack_push();

  mouse_cursor_draw();

  matrixstack_pop();
  graphics_setState(&curState);

  graphics_swap();

  lua_pop(loopData->luaState, 1);

  SDL_Event event;
  while(SDL_PollEvent(&event)) {
    switch(event.type) {
    case SDL_KEYDOWN:
      keyboard_keypressed(event.key.keysym.sym);
      break;
    case SDL_KEYUP:
      keyboard_keyreleased(event.key.keysym.sym);
      break;
    case SDL_TEXTINPUT:
      keyboard_textInput(event.text.text);
      break;
    case SDL_MOUSEMOTION:
      mouse_mousemoved(event.motion.x, event.motion.y);
      break;
    case SDL_MOUSEBUTTONDOWN:
      mouse_mousepressed(event.button.x, event.button.y, event.button.button);
      break;
    case SDL_MOUSEBUTTONUP:
      mouse_mousereleased(event.button.x, event.button.y, event.button.button);
      break;
    case SDL_JOYDEVICEADDED:
      joystick_deviceAdded(event.jdevice.which);
      break;
    case SDL_JOYDEVICEREMOVED:
      joystick_deviceRemoved(event.jdevice.which);
      break;
    case SDL_JOYBUTTONUP:
      joystick_buttonReleased(event.jbutton.which, event.jbutton.button);
      break;
    case SDL_JOYBUTTONDOWN:
      joystick_buttonPressed(event.jbutton.which, event.jbutton.button);
      break;
    case SDL_JOYAXISMOTION:
      joystick_axisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value);
      break;
    case SDL_CONTROLLERBUTTONUP:
      joystick_controllerButtonReleased(event.jbutton.which, event.jbutton.button);
      break;
    case SDL_CONTROLLERBUTTONDOWN:
      joystick_controllerButtonPressed(event.jbutton.which, event.jbutton.button);
      break;
    case SDL_CONTROLLERAXISMOTION:
      joystick_controllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value);
      break;


#ifndef EMSCRIPTEN
    case SDL_QUIT:
      exit(0);
#endif
    }
  }

  audio_updateStreams();
  //lua_gc(loopData->luaState, LUA_GCCOLLECT, 0);
}
Beispiel #8
0
static void console_reset()
{
	xpos = ypos = 0;
	graphics_clear(bgcolor);
}
Beispiel #9
0
// render stuff
void display_update() {
	int gx, gy;
	char buffer[20];
	char time_buffer[8];
	Particle *current_particle = NULL;
	ParticleCollection *current_collection = NULL;
	SDL_Color grid_color;

	// TODO: make grid color settable
	grid_color.r = 255;
	grid_color.g = 255;
	grid_color.b = 255;

	graphics_clear();

  // draw texture for the grid
	if (grid) {
		graphics_drawGrid(20, 0, GRID_BLOCK_SIZE, GRID_WIDTH, GRID_HEIGHT, &grid_color);	
	}

  // draw grid
  if (grid && block_texture) {
		for (gy = 0; gy < GRID_HEIGHT; gy++) { // TODO: cater for realtime grid width/height settings
			for (gx = 0; gx < GRID_WIDTH; gx++) {
				// red
				if (*(grid->data + gx + (gy * GRID_WIDTH)) == 1) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx),
          0 + (GRID_BLOCK_SIZE * gy), GRID_BLOCK_SIZE,
          GRID_BLOCK_SIZE, red_block_texture);
				}
				// green
				if (*(grid->data + gx + (gy * GRID_WIDTH)) == 2) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx),
          0 + (GRID_BLOCK_SIZE * gy), GRID_BLOCK_SIZE,
          GRID_BLOCK_SIZE, green_block_texture);
				}
				// blue
				if (*(grid->data + gx + (gy * GRID_WIDTH)) == 3) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx),
          0 + (GRID_BLOCK_SIZE * gy), GRID_BLOCK_SIZE,
          GRID_BLOCK_SIZE, blue_block_texture);
				}
				// orange
				if (*(grid->data + gx + (gy * GRID_WIDTH)) == 4) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx),
          0 + (GRID_BLOCK_SIZE * gy), GRID_BLOCK_SIZE,
          GRID_BLOCK_SIZE, orange_block_texture);
				}
				// yellow
				if (*(grid->data + gx + (gy * GRID_WIDTH)) == 5) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx),
          0 + (GRID_BLOCK_SIZE * gy), GRID_BLOCK_SIZE,
          GRID_BLOCK_SIZE, yellow_block_texture);
				}
				// cyan
				if (*(grid->data + gx + (gy * GRID_WIDTH)) == 6) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx),
          0 + (GRID_BLOCK_SIZE * gy), GRID_BLOCK_SIZE,
          GRID_BLOCK_SIZE, cyan_block_texture);
				}
				// purple
				if (*(grid->data + gx + (gy * GRID_WIDTH)) == 7) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx),
          0 + (GRID_BLOCK_SIZE * gy), GRID_BLOCK_SIZE,
          GRID_BLOCK_SIZE, purple_block_texture);
				}
			}
		}
  }

  // draw tetromino
  if (block_texture && current_tetromino) {
    for (gy = 0; gy < 4; gy++) { // TODO: cater for realtime grid width/height settings
			for (gx = 0; gx < 4; gx++) {
			  // red
				if (*(current_tetromino->data+gx+(4*gy)) == 1) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx) +
          (GRID_BLOCK_SIZE * current_tetromino->x),
            0 + (GRID_BLOCK_SIZE * gy) + (GRID_BLOCK_SIZE *
            current_tetromino->y), GRID_BLOCK_SIZE, GRID_BLOCK_SIZE, red_block_texture);
				}
				// green
				if (*(current_tetromino->data+gx+(4*gy)) == 2) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx) +
          (GRID_BLOCK_SIZE * current_tetromino->x),
            0 + (GRID_BLOCK_SIZE * gy) + (GRID_BLOCK_SIZE *
            current_tetromino->y), GRID_BLOCK_SIZE, GRID_BLOCK_SIZE, green_block_texture);
				}
				// blue
				if (*(current_tetromino->data+gx+(4*gy)) == 3) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx) +
          (GRID_BLOCK_SIZE * current_tetromino->x),
            0 + (GRID_BLOCK_SIZE * gy) + (GRID_BLOCK_SIZE *
            current_tetromino->y), GRID_BLOCK_SIZE, GRID_BLOCK_SIZE, blue_block_texture);
				}
				// orange
				if (*(current_tetromino->data+gx+(4*gy)) == 4) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx) +
          (GRID_BLOCK_SIZE * current_tetromino->x),
            0 + (GRID_BLOCK_SIZE * gy) + (GRID_BLOCK_SIZE *
            current_tetromino->y), GRID_BLOCK_SIZE, GRID_BLOCK_SIZE, orange_block_texture);
				}
				// yellow
				if (*(current_tetromino->data+gx+(4*gy)) == 5) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx) +
          (GRID_BLOCK_SIZE * current_tetromino->x),
            0 + (GRID_BLOCK_SIZE * gy) + (GRID_BLOCK_SIZE *
            current_tetromino->y), GRID_BLOCK_SIZE, GRID_BLOCK_SIZE, yellow_block_texture);
				}
				// cyan
				if (*(current_tetromino->data+gx+(4*gy)) == 6) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx) +
          (GRID_BLOCK_SIZE * current_tetromino->x),
            0 + (GRID_BLOCK_SIZE * gy) + (GRID_BLOCK_SIZE *
            current_tetromino->y), GRID_BLOCK_SIZE, GRID_BLOCK_SIZE, cyan_block_texture);
				}
				// purple
				if (*(current_tetromino->data+gx+(4*gy)) == 7) {
					graphics_drawTextureScaled(20 + (GRID_BLOCK_SIZE * gx) +
          (GRID_BLOCK_SIZE * current_tetromino->x),
            0 + (GRID_BLOCK_SIZE * gy) + (GRID_BLOCK_SIZE *
            current_tetromino->y), GRID_BLOCK_SIZE, GRID_BLOCK_SIZE, purple_block_texture);
				}
			}
		}
  } 

  // draw text
  font_print(280, 35, "SCORE", NULL);
	sprintf(buffer, "%d", game.score);
  font_print(280, 55, buffer, NULL);
  font_print(280, 75, "TIME", NULL);
  game_getTime(time_buffer);
  font_print(280, 95, time_buffer, NULL);
  font_print(280, 115, "LEVEL", NULL);
	sprintf(buffer, "%d", game.level);
  font_print(280, 135, buffer, NULL);
  font_print(280, 155, "LINES", NULL);
	sprintf(buffer, "%d", game.lines);
  font_print(280, 175, buffer, NULL); 

  // render any particles if they're not currently being modified
	if (SDL_SemTryWait(sem) == 0) {
		current_collection = particle_getActiveCollections();
		if (current_collection) {
 	  	while (current_collection) {
      	current_particle = current_collection->first;
	
      	while (current_particle) {
      		glColor4f(1.0f, 1.0f, 1.0f, current_particle->alpha);
    	    glBlendFunc(GL_SRC_ALPHA, GL_ONE);
  	      glEnable(GL_BLEND);
	
  	      graphics_drawTexture(current_particle->x, current_particle->y, current_particle->texture);
	        glDisable(GL_BLEND);

        	current_particle = current_particle->next;
      	}

      	current_collection = current_collection->next;
    	}
  	}
		SDL_SemPost(sem);
	}

  // draw the menu if its needed
	if (ui_isMenuVisible()) {
		if (grid && current_tetromino) {
			ui_drawMainMenu(MENU_IN_GAME);
		}
		else {
			ui_drawMainMenu(MENU_MAIN);
		}
	}

	SDL_GL_SwapBuffers();
}
Beispiel #10
0
void renderer_flipPage()
{
    // 
    if( s_renderer.flipTime >= 0.0f )
    {
        //SYS_TRACE_WARNING( "starting page flip while another flip is still active!\n" ); 
    }
    
    s_renderer.lastPage = s_renderer.currentPage;
    s_renderer.currentPage = 1 - s_renderer.currentPage;

    //s_renderer.currentStroke.pDefinition = 0;
    s_renderer.currentCommand = 0u;
    clearStrokeBuffer( &s_renderer.strokeBuffer );

    setPageState( PageState_BeforeDraw );

    Page* pPage = &s_renderer.pages[ s_renderer.currentPage ];
    
    // clear current page:
    graphics_setRenderTarget( &pPage->fgTarget );
    graphics_setBlendMode( BlendMode_Disabled );
    graphics_setShader( 0 );

    // 
    graphics_clear( 0.0f, 0.0f, 0.0f, 0.0f );

    graphics_setRenderTarget( &pPage->burnTarget );
    graphics_clear( 0.0f, 0.0f, 0.0f, 0.0f );

    for( uint i = 0u; i < SYS_COUNTOF(s_renderer.burnHoles); ++i )
    {
        if( s_renderer.burnHoles[i].size>=0.0f)
        {
//            SYS_TRACE_DEBUG("bh[%i]=%f\n", i, s_renderer.burnHoles[i].size);
            drawBurnHole( &s_renderer.burnHoles[i] );
            s_renderer.burnHoles[i].size -= 0.1f;
        }
    }

    if( s_renderer.flipDuration > 0.0f )
    {
        s_renderer.flipTime = 0.0f;
    }
    else
    {
        // flip instantly:
        s_renderer.flipTime = -1.0f;
    }
    s_renderer.pageNumber++;

    float oldVariance=s_renderer.currentVariance;
    s_renderer.currentVariance=0.0f;
    renderer_setPen(Pen_PageNumber);
    // add the page number;
    float2 textPos;
    float2_set(&textPos,1.0f,1.0f);
    char numberText[16u];
    sprintf(numberText,"%i",s_renderer.pageNumber);
    font_drawText(&textPos,0.5f,0.0f,numberText);

    renderer_flush();

    s_renderer.currentVariance=oldVariance;
    //font_
}
Beispiel #11
0
void main_loop(void *data) {
  MainLoopData* loopData = (MainLoopData*)data;

  timer_step();
  lua_rawgeti(loopData->luaState, LUA_REGISTRYINDEX, loopData->errhand);
  lua_getglobal(loopData->luaState, "love");
  lua_pushstring(loopData->luaState, "update");

  lua_rawget(loopData->luaState, -2);
  lua_pushnumber(loopData->luaState, timer_getDelta());
  if (swap_At == 1){
      if(luaL_dofile(loopData->luaState, "main.lua")) {
          printf("Error: %s\n", lua_tostring(loopData->luaState, -1));
        }
    }

  if(lua_pcall(loopData->luaState, 1, 0, 0)) {
      printf("Lua error: %s\n", lua_tostring(loopData->luaState, -1));
#ifdef EMSCRIPTEN
      quit_function(loopData->luaState);
      emscripten_force_exit(1);
#else
      exit(1);
#endif
    }

  graphics_clear();

  lua_pushstring(loopData->luaState, "draw");
  lua_rawget(loopData->luaState, -2);

  if(lua_pcall(loopData->luaState, 0, 0, 0)) {
      printf("Lua error: %s\n", lua_tostring(loopData->luaState, -1));
#ifdef EMSCRIPTEN
      quit_function(loopData->luaState);
      emscripten_force_exit(1);
      l_running = 0;
#else
      l_running = 0;
#endif
    }

  graphics_swap();

  // silly hack for love.event.quit()
#ifdef WINDOWS
  event_force_quit = graphics_stop_windows();
  if(!event_force_quit)
    l_running = 0;
#endif //This will affect only Windows users
  //

  lua_pop(loopData->luaState, 1);
#ifdef UNIX
  SDL_Event event;
  while(SDL_PollEvent(&event)) {
      if (event.type == SDL_WINDOWEVENT) {
          switch (event.window.event) {
            case SDL_WINDOWEVENT_ENTER:
              graphics_setMouseFocus(1);
              break;
            case SDL_WINDOWEVENT_LEAVE:
              graphics_setMouseFocus(0);
              break;
            case SDL_WINDOWEVENT_FOCUS_LOST:
              graphics_setFocus(0);
              break;
            case SDL_WINDOWEVENT_FOCUS_GAINED:
              graphics_setFocus(1);
              break;
            default:
              break;
            }
        }
      switch(event.wheel.type)
        {
        case SDL_MOUSEWHEEL:
          mouse_mousewheel(event.wheel.y);
          int _what = event.wheel.y == 1 ? SDL_BUTTON_WHEEL_UP : SDL_BUTTON_WHEEL_DOWN;
          mouse_mousepressed(event.button.x, event.button.y,
                             _what);
          break;
        default:
          break;
        }
      switch(event.type) {
        case SDL_KEYDOWN:
          keyboard_keypressed(event.key.keysym.sym);
          break;
        case SDL_KEYUP:
          keyboard_keyreleased(event.key.keysym.sym);
          break;
        case SDL_TEXTINPUT:
          keyboard_textInput(event.text.text);
          break;
        case SDL_MOUSEMOTION:
          mouse_mousemoved(event.motion.x, event.motion.y);
          break;
        case SDL_MOUSEBUTTONDOWN:
          mouse_mousepressed(event.button.x, event.button.y,
                             event.button.button);
          break;
        case SDL_MOUSEBUTTONUP:
          mouse_mousereleased(event.button.x, event.button.y,
                              event.button.button);
          break;
#ifndef EMSCRIPTEN
        case SDL_QUIT:
          quit_function(loopData->luaState);
          l_running = 0;
#endif
        }
    }
#endif
}
Beispiel #12
0
void game_render(SDL_Surface* sf)
{
	graphics_clear(sf);

	raycast_render(sf, &player, &m);
}
Beispiel #13
0
gboolean start_new_game (gchar *game_filename, gchar *graphics_filename,
			 gchar *splash_filename, gchar *music_filename,
			 gchar *hints_filename)
{
    const gchar *filters[] =
	{
	    "Magnetic Scrolls data file (*.mag)", "*.mag",
	    NULL
	};

    if (!game_filename)
	game_filename = file_selector (FALSE, NULL, filters, "Open game file");

    if (!game_filename)
	return TRUE;

    stop_main_loop ();

    if (ms_is_running ())
    {
	ms_stop ();
	ms_freemem ();
    }

    stop_recording (TRUE);
    stop_scripting (TRUE);
    stop_replaying (TRUE);

    if (!graphics_filename)
	graphics_filename = change_file_extension (game_filename, "gfx");

    if (!splash_filename)
	splash_filename = change_file_extension (game_filename, "png");
    
    if (!music_filename)
	music_filename = change_file_extension (game_filename, "mp3");

    if (!hints_filename)
	hints_filename = change_file_extension (game_filename, "hnt");

    display_splash_screen (splash_filename, music_filename);

    text_clear ();
    graphics_clear ();
    hints_clear ();

    if (applicationExiting)
	return FALSE;

    if (!ms_init ((type8s *) game_filename, (type8s *) graphics_filename, (type8s *) hints_filename), NULL)
    {
	GtkWidget *error;
	gchar *basename;
	
	basename = g_path_get_basename (game_filename);
	error = gtk_message_dialog_new (
	    GTK_WINDOW (Gui.main_window),
	    GTK_DIALOG_DESTROY_WITH_PARENT,
	    GTK_MESSAGE_ERROR,
	    GTK_BUTTONS_OK,
	    "Could not start the game! The most likely cause is\n"
	    "that '%s' is not a valid game file.",
	    basename);
	gtk_dialog_run (GTK_DIALOG (error));
	g_free (basename);
	gtk_widget_destroy (error);
    } else
	start_main_loop ();
    
    g_free (game_filename);
    g_free (graphics_filename);
    g_free (splash_filename);
    g_free (music_filename);
    g_free (hints_filename);
    
    gtk_widget_grab_focus (Gui.text_view);
    return TRUE;
}