mirror of
https://github.com/Bithack/principia.git
synced 2026-06-24 02:04:08 +00:00
Remove unused main menu contest stuff
This was never used and didn't really work all that great when I tried implementing it in the featured list creator. Just clean up all references of it.
This commit is contained in:
parent
e9d944afa8
commit
22c192b6d2
9 changed files with 1 additions and 270 deletions
|
|
@ -62,14 +62,6 @@ menu_base::widget_clicked(principia_wdg *w, uint8_t button_id, int pid)
|
|||
}
|
||||
break;
|
||||
|
||||
case BTN_CONTEST:
|
||||
{
|
||||
uint32_t id = VOID_TO_UINT32(w->data3);
|
||||
COMMUNITY_URL("contest/%u", id);
|
||||
ui::open_url(url);
|
||||
}
|
||||
break;
|
||||
|
||||
case BTN_IGNORE: break;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ enum {
|
|||
BTN_SETTINGS,
|
||||
BTN_BACK,
|
||||
BTN_ENTITY,
|
||||
BTN_CONTEST,
|
||||
|
||||
BTN_UPDATE,
|
||||
BTN_PLAY,
|
||||
|
|
|
|||
|
|
@ -196,36 +196,6 @@ menu_create::menu_create()
|
|||
this->wm->areas[AREA_MENU_RIGHT_HCENTER].set_alpha(0.f);
|
||||
}
|
||||
|
||||
{
|
||||
/* CONTEST BASE */
|
||||
this->wdg_contest_thumb = this->wm->create_widget(
|
||||
this->get_surface(), TMS_WDG_BUTTON,
|
||||
BTN_CONTEST, AREA_MENU_BOTTOM_LEFT,
|
||||
0);
|
||||
this->wdg_contest_thumb->priority = 1000;
|
||||
this->wdg_contest_thumb->alpha = 0.f;
|
||||
}
|
||||
|
||||
{
|
||||
/* CONTEST TOP */
|
||||
this->wdg_contest_title = this->wm->create_widget(
|
||||
this->get_surface(), TMS_WDG_LABEL,
|
||||
BTN_CONTEST, AREA_CREATE_CONTEST_TOP);
|
||||
this->wdg_contest_title->priority = 1000;
|
||||
}
|
||||
|
||||
{
|
||||
/* CONTEST BOTTOM */
|
||||
for (int x=0; x<MAX_FEATURED_LEVELS_FETCHED; ++x) {
|
||||
this->wdg_contest_entry[x] = this->wm->create_widget(
|
||||
this->get_surface(), TMS_WDG_BUTTON,
|
||||
BTN_ENTITY, AREA_CREATE_CONTEST_BOTTOM,
|
||||
0);
|
||||
this->wdg_contest_entry[x]->priority = 100-MAX_FEATURED_LEVELS_FETCHED-x;
|
||||
this->wdg_contest_entry[x]->alpha = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
this->refresh_widgets();
|
||||
}
|
||||
|
||||
|
|
@ -330,9 +300,6 @@ menu_create::render()
|
|||
|
||||
const int line_thickness = _tms.xppcm * .05f;
|
||||
int vert_y = menu_shared::bar_height + MARGIN_Y;
|
||||
if (menu_shared::contest_state > FL_INIT && this->wm->areas[AREA_MENU_BOTTOM_LEFT].enabled) {
|
||||
vert_y += this->wm->areas[AREA_MENU_BOTTOM_LEFT].last_height + MARGIN_Y + MARGIN_Y + line_thickness;
|
||||
}
|
||||
int vert_h = _tms.opengl_height - vert_y - menu_shared::bar_height - MARGIN_Y;
|
||||
int vert_x = _tms.opengl_width/2.f - line_thickness/2.f;
|
||||
|
||||
|
|
@ -346,13 +313,6 @@ menu_create::render()
|
|||
|
||||
const int hori_x = MARGIN_X;
|
||||
|
||||
if (menu_shared::contest_state > FL_INIT && this->wm->areas[AREA_MENU_BOTTOM_LEFT].enabled) {
|
||||
glViewport(
|
||||
hori_x, vert_y - MARGIN_Y,
|
||||
_tms.opengl_width-MARGIN_X-hori_x, line_thickness);
|
||||
menu_shared::tex_hori_line->render();
|
||||
}
|
||||
|
||||
struct widget_area *left = this->wdg_create_new_level->area;
|
||||
|
||||
glViewport(
|
||||
|
|
@ -403,53 +363,6 @@ menu_create::refresh_widgets()
|
|||
this->wdg_continue->add();
|
||||
}
|
||||
|
||||
if (this->wdg_contest_thumb->s[0]) {
|
||||
this->wdg_contest_thumb->add();
|
||||
this->wdg_contest_title->add();
|
||||
for (int x=0; x<MAX_FEATURED_LEVELS_FETCHED; ++x) {
|
||||
if (this->wdg_contest_entry[x] && this->wdg_contest_entry[x]->s[0]) {
|
||||
this->wdg_contest_entry[x]->add();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_shared::contest_state == FL_INIT) {
|
||||
if (menu_shared::contest.sprite) {
|
||||
struct tms_sprite *s = menu_shared::contest.sprite;
|
||||
|
||||
this->wdg_contest_thumb->s[0] = s;
|
||||
tms_infof("height: %.2f", s->height);
|
||||
this->wdg_contest_thumb->size.x = s->width;
|
||||
this->wdg_contest_thumb->size.y = s->height;
|
||||
this->wdg_contest_thumb->data3 = UINT_TO_VOID(menu_shared::contest.id);
|
||||
this->wdg_contest_thumb->add();
|
||||
|
||||
this->wdg_contest_title->data3 = UINT_TO_VOID(menu_shared::contest.id);
|
||||
char tmp[512];
|
||||
snprintf(tmp, 511, "Contest: %s", menu_shared::contest.name);
|
||||
this->wdg_contest_title->set_label(tmp, font::xmedium);
|
||||
this->wdg_contest_title->add();
|
||||
|
||||
for (int x=0; x<MAX_FEATURED_LEVELS_FETCHED; ++x) {
|
||||
if (menu_shared::contest_entries[x].sprite) {
|
||||
s = menu_shared::contest_entries[x].sprite;
|
||||
|
||||
this->wdg_contest_entry[x]->s[0] = s;
|
||||
this->wdg_contest_entry[x]->size.x = s->width;
|
||||
this->wdg_contest_entry[x]->size.y = s->height;
|
||||
this->wdg_contest_entry[x]->data3 = UINT_TO_VOID(menu_shared::contest_entries[x].id);
|
||||
this->wdg_contest_entry[x]->add();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
menu_shared::contest_state = FL_ALPHA_IN;
|
||||
|
||||
/* an extra rearrange to make sure the "browse more community levels"
|
||||
* text is at its proper location */
|
||||
this->wm->rearrange();
|
||||
}
|
||||
|
||||
if (menu_shared::gs_state == FL_INIT) {
|
||||
int n = 500;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,15 +25,6 @@ class menu_create : public menu_base
|
|||
principia_wdg *wdg_getting_started;
|
||||
std::vector<principia_wdg*> wdg_gs_entries;
|
||||
|
||||
/* CONTEST BASE */
|
||||
principia_wdg *wdg_contest_thumb;
|
||||
|
||||
/* CONTEST TOP */
|
||||
principia_wdg *wdg_contest_title;
|
||||
|
||||
/* CONTEST BOTTOM */
|
||||
principia_wdg *wdg_contest_entry[MAX_FEATURED_LEVELS_FETCHED];
|
||||
|
||||
bool has_autosave;
|
||||
|
||||
bool widget_clicked(principia_wdg *w, uint8_t button_id, int pid);
|
||||
|
|
|
|||
|
|
@ -16,12 +16,7 @@ tms::texture *menu_shared::tex_hori_line;
|
|||
enum fl_state menu_shared::fl_state = FL_WORKING;
|
||||
struct menu_shared::featured_level menu_shared::fl[MAX_FEATURED_LEVELS_FETCHED];
|
||||
|
||||
enum fl_state menu_shared::contest_state = FL_WORKING;
|
||||
struct menu_shared::featured_level menu_shared::contest;
|
||||
struct menu_shared::featured_level menu_shared::contest_entries[MAX_FEATURED_LEVELS_FETCHED];
|
||||
|
||||
float menu_shared::fl_alpha = 0.f;
|
||||
float menu_shared::contest_alpha = 0.f;
|
||||
float menu_shared::gs_alpha = 0.f;
|
||||
|
||||
enum fl_state menu_shared::gs_state = FL_WORKING;
|
||||
|
|
@ -111,10 +106,8 @@ menu_shared::init()
|
|||
menu_shared::tex_hori_line = tex;
|
||||
}
|
||||
|
||||
menu_shared::contest.sprite = 0;
|
||||
for (int x=0; x<MAX_FEATURED_LEVELS_FETCHED; ++x) {
|
||||
menu_shared::fl[x].sprite = 0;
|
||||
menu_shared::contest_entries[x].sprite = 0;
|
||||
}
|
||||
|
||||
menu_shared::text_version = new p_text(font::medium, ALIGN_CENTER, ALIGN_CENTER);
|
||||
|
|
@ -177,33 +170,6 @@ menu_shared::step()
|
|||
break;
|
||||
}
|
||||
|
||||
switch (menu_shared::contest_state) {
|
||||
case FL_WAITING:
|
||||
if (menu_shared::fl_state > FL_UPLOAD) {
|
||||
menu_shared::contest_state = FL_INIT;
|
||||
P.s_menu_create->get_wm()->areas[AREA_MENU_BOTTOM_LEFT].set_alpha(menu_shared::contest_alpha);
|
||||
P.s_menu_create->get_wm()->areas[AREA_CREATE_CONTEST_TOP].set_alpha(menu_shared::contest_alpha);
|
||||
P.s_menu_create->get_wm()->areas[AREA_CREATE_CONTEST_BOTTOM].set_alpha(menu_shared::contest_alpha);
|
||||
}
|
||||
break;
|
||||
|
||||
case FL_ALPHA_IN: {
|
||||
menu_shared::contest_alpha += _tms.dt*1.f;
|
||||
|
||||
if (menu_shared::contest_alpha > 1.f) {
|
||||
menu_shared::contest_alpha = 1.f;
|
||||
menu_shared::contest_state = FL_DONE;
|
||||
}
|
||||
|
||||
P.s_menu_create->get_wm()->areas[AREA_MENU_BOTTOM_LEFT].set_alpha(menu_shared::contest_alpha);
|
||||
P.s_menu_create->get_wm()->areas[AREA_CREATE_CONTEST_TOP].set_alpha(menu_shared::contest_alpha);
|
||||
P.s_menu_create->get_wm()->areas[AREA_CREATE_CONTEST_BOTTOM].set_alpha(menu_shared::contest_alpha);
|
||||
} break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (menu_shared::gs_state) {
|
||||
case FL_WAITING:
|
||||
if (menu_shared::fl_state > FL_UPLOAD) {
|
||||
|
|
|
|||
|
|
@ -45,12 +45,7 @@ class menu_shared
|
|||
static enum fl_state gs_state;
|
||||
static std::vector<struct gs_entry> gs_entries;
|
||||
|
||||
static enum fl_state contest_state;
|
||||
static struct featured_level contest;
|
||||
static struct featured_level contest_entries[MAX_FEATURED_LEVELS_FETCHED];
|
||||
|
||||
static float fl_alpha;
|
||||
static float contest_alpha;
|
||||
static float gs_alpha;
|
||||
|
||||
static p_text *text_version;
|
||||
|
|
|
|||
|
|
@ -501,83 +501,7 @@ _get_featured_levels(void *_num)
|
|||
delete tex;
|
||||
}
|
||||
|
||||
tms_infof("loading contest stuff..");
|
||||
uint32_t contest_active = lb.r_uint32();
|
||||
|
||||
if (contest_active == 1) {
|
||||
menu_shared::contest.id = lb.r_uint32();
|
||||
|
||||
uint32_t contest_name_len = lb.r_uint32();
|
||||
char *contest_name = (char*)calloc(contest_name_len+1, 1);
|
||||
lb.r_buf(contest_name, contest_name_len);
|
||||
|
||||
uint32_t contest_thumb_len = lb.r_uint32();
|
||||
if (contest_thumb_len > 0) {
|
||||
char *contest_thumb = (char*)calloc(contest_thumb_len, 1);
|
||||
lb.r_buf(contest_thumb, contest_thumb_len);
|
||||
|
||||
tms::texture *tex = new tms::texture();
|
||||
tex->load_mem2(contest_thumb, contest_thumb_len, 0);
|
||||
tex->flip_y();
|
||||
tex->add_alpha(1.f);
|
||||
|
||||
menu_shared::contest.sprite = tms_atlas_add_bitmap(
|
||||
gui_spritesheet::atlas,
|
||||
tex->width,
|
||||
tex->height,
|
||||
tex->num_channels,
|
||||
tex->data
|
||||
);
|
||||
|
||||
strcpy(menu_shared::contest.name, contest_name);
|
||||
|
||||
free(contest_name);
|
||||
free(contest_thumb);
|
||||
|
||||
tex->free_buffer();
|
||||
|
||||
delete tex;
|
||||
|
||||
uint32_t num_entries = lb.r_uint32();
|
||||
|
||||
n = std::min(num_entries, (uint32_t)MAX_FEATURED_LEVELS_FETCHED);
|
||||
for (uint32_t i=0; i<n; ++i) {
|
||||
menu_shared::contest_entries[i].id = lb.r_uint32();
|
||||
|
||||
uint32_t thumb_len = lb.r_uint32();
|
||||
|
||||
if (thumb_len == 0) {
|
||||
tms_errorf("We received a contest entry which did not have a thumbnail!");
|
||||
continue;
|
||||
}
|
||||
|
||||
char *thumb = (char*)calloc(thumb_len, 1);
|
||||
lb.r_buf(thumb, thumb_len);
|
||||
|
||||
tex = new tms::texture();
|
||||
tex->load_mem2(thumb, thumb_len, 0);
|
||||
tex->flip_y();
|
||||
tex->add_alpha(1.f);
|
||||
|
||||
menu_shared::contest_entries[i].sprite = tms_atlas_add_bitmap(
|
||||
gui_spritesheet::atlas,
|
||||
tex->width,
|
||||
tex->height,
|
||||
tex->num_channels,
|
||||
tex->data
|
||||
);
|
||||
|
||||
free(thumb);
|
||||
tex->free_buffer();
|
||||
|
||||
delete tex;
|
||||
}
|
||||
|
||||
menu_shared::contest_state = FL_WAITING;
|
||||
} else {
|
||||
tms_errorf("Contest has no thumbnail :(");
|
||||
}
|
||||
}
|
||||
uint32_t contest_active = lb.r_uint32(); // unused 32-bit int
|
||||
|
||||
uint32_t num_getting_started_links = lb.r_uint32();
|
||||
|
||||
|
|
|
|||
|
|
@ -835,22 +835,6 @@ widget_manager::init_areas()
|
|||
this->areas[AREA_MENU_BOTTOM_CENTER].tmody = 0.0f;
|
||||
this->areas[AREA_MENU_BOTTOM_CENTER].horizontal_align = ALIGN_CENTER;
|
||||
this->areas[AREA_MENU_BOTTOM_CENTER].last_width = 0.f;
|
||||
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].base_x = MARGIN_X;
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].base_y = _tms.window_height - MARGIN_Y;
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].imodx = 1.25f;
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].imody = 0.0f;
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].modx = 1.0f;
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].mody = 0.0f;
|
||||
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].base_x = MARGIN_X;
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].base_y = MARGIN_Y + menu_shared::bar_height;
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].imodx = 1.25f;
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].imody = 1.0f;
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].modx = 1.0f;
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].mody = 0.0f;
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].tmodx = -1.0f;
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].tmody = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -882,37 +866,6 @@ widget_manager::refresh_areas()
|
|||
} else if (this->get_home() == P.s_menu_create) {
|
||||
this->areas[AREA_CREATE_LEFT_SUB].base_y = this->areas[AREA_MENU_LEFT_HCENTER].bot.y;
|
||||
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].base_x =
|
||||
this->areas[AREA_MENU_BOTTOM_LEFT].base_x
|
||||
+ MARGIN_X
|
||||
+ this->areas[AREA_MENU_BOTTOM_LEFT].last_width;
|
||||
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].base_x =
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].base_x;
|
||||
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].base_y =
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].first_pos.y
|
||||
+ this->areas[AREA_CREATE_CONTEST_BOTTOM].last_height;
|
||||
|
||||
//this->areas[AREA_CREATE_CONTEST_TOP].base_y = this->areas[AREA_MENU_BOTTOM_LEFT].top.y;
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].base_y = this->areas[AREA_CREATE_CONTEST_BOTTOM].top.y;
|
||||
|
||||
|
||||
int32_t diff = this->areas[AREA_CREATE_LEFT_SUB].bot.y ;
|
||||
|
||||
int32_t min_diff = 135 + MARGIN_Y + menu_shared::bar_height;
|
||||
|
||||
tms_debugf("diff: %d < %d?", diff, min_diff);
|
||||
|
||||
if (diff < min_diff) {
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].enabled = false;
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].enabled = false;
|
||||
this->areas[AREA_MENU_BOTTOM_LEFT].enabled = false;
|
||||
} else {
|
||||
this->areas[AREA_CREATE_CONTEST_TOP].enabled = true;
|
||||
this->areas[AREA_CREATE_CONTEST_BOTTOM].enabled = true;
|
||||
this->areas[AREA_MENU_BOTTOM_LEFT].enabled = true;
|
||||
}
|
||||
} else if (this->get_home() == P.s_menu_play) {
|
||||
this->areas[AREA_MENU_LEFT_HLEFT].base_y = this->areas[AREA_MENU_TOP_CENTER].bot.y;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ enum WidgetArea {
|
|||
|
||||
AREA_MENU_BOTTOM_LEFT,
|
||||
AREA_MENU_BOTTOM_CENTER,
|
||||
AREA_CREATE_CONTEST_BOTTOM,
|
||||
AREA_CREATE_CONTEST_TOP,
|
||||
|
||||
NUM_AREAS
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue