Skip to content

Commit

Permalink
Remove some commented out code, reorder initial loading steps
Browse files Browse the repository at this point in the history
  • Loading branch information
rollerozxa committed Dec 3, 2023
1 parent 759a5ce commit 9368569
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 95 deletions.
92 changes: 20 additions & 72 deletions src/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1127,10 +1127,6 @@ tproject_step(void)
}
break;

case ACTION_PING:
tms_infof("unused ping action");
break;

case ACTION_RELOAD_GRAPHICS:
{
tms_debugf("Reloading graphics...");
Expand Down Expand Up @@ -1461,8 +1457,6 @@ tproject_soft_resume(void)
void
tproject_soft_pause(void)
{
//sm::stop_all();

sm::pause_all();

if (_tms.screen == &G->super && G->state.sandbox && W->is_paused() && !G->state.test_playing && G->state.modified) {
Expand Down Expand Up @@ -1616,16 +1610,6 @@ tproject_init(void)
P.new_version_available = false;
P.curl = 0;

#if defined(TMS_BACKEND_ANDROID_X86_64)
tms_debugf("ARCH: x86_64");
#elif defined(TMS_BACKEND_ANDROID_X86)
tms_debugf("ARCH: x86");
#elif defined(TMS_BACKEND_ANDROID_ARM64_V8A)
tms_debugf("ARCH: arm64-v8a");
#elif defined(TMS_BACKEND_ANDROID_ARMEABI_V7A)
tms_debugf("ARCH: armeabi-v7");
#endif

tms_infof("tproject_init called");
srand((unsigned)time(0));

Expand Down Expand Up @@ -3581,19 +3565,15 @@ static const char *load_step_name[] = {
/* 5 */ "Load materials",
/* 6 */ "Allocating models",
/* 7 */ "Loading models",
/* 8 */ "Unused",
/* 9 */ "Uploading models",
/* 10 */ "Loading tilemaps",
/* 11 */ "Initializing buffers",
/* 12 */ "Init world",
/* 13 */ "Init game",
/* 14 */ "Init game GUI",
/* 15 */ "Unused",
/* 16 */ "Unused",
/* 17 */ "Load shared menus assets",
/* 18 */ "Init menus",
/* 19 */ "Load progress",
/* 20 */ "Save settings",
/* 8 */ "Uploading models",
/* 9 */ "Loading tilemaps",
/* 10 */ "Initializing buffers",
/* 11 */ "Init world",
/* 12 */ "Init game",
/* 13 */ "Init game GUI",
/* 14 */ "Init menus",
/* 15 */ "Load progress",
/* 16 */ "Save settings",
};

bool
Expand Down Expand Up @@ -3626,14 +3606,6 @@ _create_dir(const char *path, mode_t mode)
return true;
}

static int
_init_more_fonts(void *unused)
{
gui_spritesheet::init_fonts();

return 0;
}

static void
generate_paths()
{
Expand All @@ -3650,12 +3622,6 @@ initial_loader(int step)
Uint32 ss = SDL_GetTicks();
int retval = LOAD_CONT;

/* this is necessary for multithreaded fontloading
if (gui_spritesheet::text_atlas_modified) {
gui_spritesheet::upload_text_atlas();
}
*/

switch (step) {
case 0:
{
Expand Down Expand Up @@ -3683,9 +3649,6 @@ initial_loader(int step)
generate_paths();

gui_spritesheet::init_atlas();

//create_thread(_init_more_fonts, "_init_more_fonts", (void*)0);

}
break;

Expand All @@ -3696,7 +3659,6 @@ initial_loader(int step)

case 2:
gui_spritesheet::init_fonts();

P.s_loading_screen->set_text("Loading GUI...");
break;

Expand Down Expand Up @@ -3768,24 +3730,21 @@ initial_loader(int step)
break;
}
}
break;

case 8:
P.s_loading_screen->set_text("Uploading models...");
break;

case 9:
case 8:
mesh_factory::upload_models();

P.s_loading_screen->set_text("Loading tilemaps...");
break;

case 10:
case 9:
tile_factory::init();
P.s_loading_screen->set_text("Loading buffers...");
break;

case 11:
case 10:
cable::_init();
display::_init();
ledbuffer::_init();
Expand All @@ -3800,13 +3759,13 @@ initial_loader(int step)
P.s_loading_screen->set_text("Loading world...");
break;

case 12:
case 11:
W = new world();

P.s_loading_screen->set_text("Loading game...");
break;

case 13:
case 12:
/* All fonts must be loaded before we can continue here */
if (!gui_spritesheet::all_fonts_loaded) {
tms_infof("Waiting for fonts to load...");
Expand All @@ -3820,22 +3779,11 @@ initial_loader(int step)
P.s_loading_screen->set_text("Loading game GUI...");
break;

case 14:
case 13:
G->init_gui();
break;

case 15:
break;

case 16:

P.s_loading_screen->set_text("Loading menus...");
break;

case 17:
break;

case 18:
case 14:
P.s_menu_pkg = new menu_pkg();
P.s_menu_main = new menu_main();
P.s_menu_create = new menu_create();
Expand All @@ -3849,11 +3797,11 @@ initial_loader(int step)
P.s_loading_screen->set_text("Loading progress...");
break;

case 19:
case 15:
progress::init();
break;

case 20:
case 16:
{
P.s_loading_screen->set_text(0);

Expand Down Expand Up @@ -3886,7 +3834,7 @@ initial_loader(int step)
}
break;

case 21:
case 17:
{
uint32_t total = 0;
for (int x=0; x<step; x++) {
Expand All @@ -3901,7 +3849,7 @@ initial_loader(int step)

return LOAD_DONE;

case LOAD_RETURN_NUM_STEPS: return 21;
case LOAD_RETURN_NUM_STEPS: return 17;
default: return LOAD_ERROR;
}

Expand Down
1 change: 0 additions & 1 deletion src/src/menu_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ menu_main::widget_clicked(principia_wdg *w, uint8_t button_id, int pid)
case BTN_BROWSE_COMMUNITY:
{
ui::emit_signal(SIGNAL_CLICK_DISCOVER);
//ui::open_url(0);
char tmp[128];
snprintf(tmp, 127, "https://%s/", P.community_host);
ui::open_url(tmp);
Expand Down
4 changes: 0 additions & 4 deletions src/src/no_tms.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
#define tms_raise()
#define tms_assertf(expr, f, ...) {if (expr);else tms_fatalf(f, ##__VA_ARGS__);}

#ifdef PROGRESSTEST
static const char *tbackend_get_storage_path(){return ".";};
#else
static const char *tbackend_get_storage_path(){return STATIC_STORAGE_PATH;};
#endif

static inline int
_fatal_exit() {
Expand Down
18 changes: 0 additions & 18 deletions src/src/pkgman.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ lvlinfo::create(int type, uint64_t seed/*=0*/, uint32_t version/*=0*/)
this->sandbox_cam_y = 0.f;
this->sandbox_cam_zoom = 12.f;

#if defined(DEBUG) && defined(PAJLADA)
//this->sandbox_cam_zoom = 45.f;
#endif

this->velocity_iterations = 10;
this->position_iterations = 10;

Expand Down Expand Up @@ -146,20 +142,6 @@ lvlinfo::create(int type, uint64_t seed/*=0*/, uint32_t version/*=0*/)
this->flags |= LVL_ALLOW_QUICKSAVING;
this->show_score = false;
this->seed = seed;
#if defined(DEBUG) && defined(SDAC)
//this->seed = 123;
this->flags |= LVL_DISABLE_ADVENTURE_MAX_ZOOM;
//this->seed = 0x17892b45db4fc34b;
#endif

#if defined(DEBUG) && defined(PAJLADA)
//this->seed = 18306172674175215282ULL;
//this->seed = 18104845929524870329ULL;
#endif

#if defined(DEBUG) && defined(SDAC)
//this->seed = 6047696179591826901ull;
#endif
this->size_y[0] = 500;
this->bg = 5;
}
Expand Down

0 comments on commit 9368569

Please sign in to comment.