Skip to content

Commit

Permalink
See desc
Browse files Browse the repository at this point in the history
* write server name to window title
* color bullets black (and not blue, did affect shotgun)
  • Loading branch information
xtreme8000 committed Jun 16, 2019
1 parent 950a54c commit 66b5788
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
19 changes: 11 additions & 8 deletions src/hud.c
Expand Up @@ -1775,6 +1775,7 @@ static int serverlist_news_exists = 0;
static void hud_serverlist_init() {
ping_stop();
network_disconnect();
window_title(NULL);

window_mousemode(WINDOW_CURSOR_ENABLED);

Expand Down Expand Up @@ -2203,17 +2204,19 @@ static void hud_serverlist_scroll(double yoffset) {
}
}

static void server_c(char* s) {
if(file_exists(s)) {
map_vxl_load(file_load(s),map_colors);
static void server_c(char* address, char* name) {
if(file_exists(address)) {
map_vxl_load(file_load(address),map_colors);
chunk_rebuild_all();
camera_mode = CAMERAMODE_FPS;
players[local_player_id].pos.x = map_size_x/2.0F;
players[local_player_id].pos.y = map_size_y-1.0F;
players[local_player_id].pos.z = map_size_z/2.0F;
window_title(address);
hud_change(&hud_ingame);
} else {
hud_change(network_connect_string(s)?&hud_ingame:&hud_serverlist);
window_title(name);
hud_change(network_connect_string(address)?&hud_ingame:&hud_serverlist);
}
}

Expand All @@ -2228,7 +2231,7 @@ static void hud_serverlist_mouseclick(double x, double y, int button, int action
}
if(serverlist_hover>=0) {
pthread_mutex_lock(&serverlist_lock);
server_c(serverlist[serverlist_hover].identifier);
server_c(serverlist[serverlist_hover].identifier,serverlist[serverlist_hover].name);
pthread_mutex_unlock(&serverlist_lock);
}

Expand Down Expand Up @@ -2257,7 +2260,7 @@ static void hud_serverlist_mouseclick(double x, double y, int button, int action
//texture_draw(&texture_ui_join,settings.window_width/2.0F+90*scaley,485*scaley,32*scaley,32*scaley);
if(is_inside(x,settings.window_height-y,settings.window_width/2.0F+90*scaley,(485-32)*scaley,32*scaley,32*scaley)
&& strlen(chat[0][0])>0)
server_c(chat[0][0]);
server_c(chat[0][0],NULL);

if(is_inside(x,settings.window_height-y,settings.window_width/2.0F+130*scaley,(485-32)*scaley,32*scaley,32*scaley))
hud_change(&hud_serverlist);
Expand Down Expand Up @@ -2288,7 +2291,7 @@ static void hud_serverlist_mouseclick(double x, double y, int button, int action

if(serverlist_news_hover) {
if(!strncmp("aos://",serverlist_news_hover->url,6))
server_c(serverlist_news_hover->url);
server_c(serverlist_news_hover->url,serverlist_news_hover->caption);
else
file_url(serverlist_news_hover->url);
}
Expand Down Expand Up @@ -2336,7 +2339,7 @@ static void hud_serverlist_keyboard(int key, int action, int mods, int internal)
chat[0][0][text_len-1] = 0;
}
if(key==WINDOW_KEY_ENTER && strlen(chat[0][0])>0)
server_c(chat[0][0]);
server_c(chat[0][0],NULL);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/model.c
Expand Up @@ -236,6 +236,8 @@ static int kv6_program = -1;
void kv6_render(struct kv6_t* kv6, unsigned char team) {
if(!kv6)
return;
if(team==TEAM_SPECTATOR)
team = 2;
if(!settings.voxlap_models) {
if(!kv6->has_display_list) {
int size = kv6->voxel_count*6;
Expand Down
2 changes: 1 addition & 1 deletion src/particle.c
Expand Up @@ -198,7 +198,7 @@ static void particle_render_single(int k, int* vertex_index, int* color_index) {
matrix_pointAt(particles[k].ox,particles[k].oy*max(1.0F-(window_time()-particles[k].fade)/0.5F,0.0F),particles[k].oz);
matrix_rotate(90.0F,0.0F,1.0F,0.0F);
matrix_upload();
kv6_render(casing,TEAM_1);
kv6_render(casing,TEAM_SPECTATOR);
matrix_pop();
}
}
Expand Down
22 changes: 22 additions & 0 deletions src/window.c
Expand Up @@ -120,6 +120,16 @@ void window_swapping(int value) {
glfwSwapInterval(value);
}

void window_title(char* suffix) {
if(suffix) {
char title[128];
snprintf(title,sizeof(title)-1,"BetterSpades %s - %s",BETTERSPADES_VERSION,suffix);
glfwSetWindowTitle(hud_window->impl,title);
} else {
glfwSetWindowTitle(hud_window->impl,"BetterSpades "BETTERSPADES_VERSION);
}
}

void window_init() {
static struct window_instance i;
hud_window = &i;
Expand Down Expand Up @@ -280,7 +290,9 @@ void window_init() {
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
#ifdef OPENGL_ES
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,SDL_GL_CONTEXT_PROFILE_ES);
#endif
SDL_GLContext* ctx = SDL_GL_CreateContext(hud_window->impl);

memset(fingers,0,sizeof(fingers));
Expand Down Expand Up @@ -439,6 +451,16 @@ int window_closed() {
return quit;
}

void window_title(char* suffix) {
if(suffix) {
char title[128];
snprintf(title,sizeof(title)-1,"BetterSpades %s - %s",BETTERSPADES_VERSION,suffix);
SDL_SetWindowTitle(hud_window->impl,title);
} else {
SDL_SetWindowTitle(hud_window->impl,"BetterSpades "BETTERSPADES_VERSION);
}
}

#endif

int window_cpucores() {
Expand Down
1 change: 1 addition & 0 deletions src/window.h
Expand Up @@ -122,3 +122,4 @@ void window_deinit(void);
void window_update(void);
int window_closed(void);
int window_cpucores();
void window_title(char* suffix);

0 comments on commit 66b5788

Please sign in to comment.