diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 215616bf6..ac4dd8c07 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -1785,10 +1785,10 @@ void SCR_DrawFPS (void) lastupdatetime = t; break; case 5: - R_FrameTimeGraph((int)(1000.0*2*frametime)); + R_FrameTimeGraph(1000.0*2*frametime); break; case 7: - R_FrameTimeGraph((int)(1000.0*1*frametime)); + R_FrameTimeGraph(1000.0*1*frametime); break; case 6: { @@ -1964,6 +1964,7 @@ void SCR_SetLoadingFile(char *str) if (scr_loadingrefresh.ival) { + r_refdef.warndraw = false; SCR_UpdateScreen(); } } @@ -2213,6 +2214,7 @@ void SCR_BeginLoadingPlaque (void) if (!scr_disabled_for_loading) { Sbar_Changed (); + r_refdef.warndraw = false; scr_drawloading = true; SCR_UpdateScreen (); scr_drawloading = false; @@ -2266,8 +2268,10 @@ void SCR_ImageName (const char *mapname) scr_drawloading = true; if (qrenderer != QR_NONE) { + r_refdef.warndraw = false; Sbar_Changed (); SCR_UpdateScreen (); + r_refdef.warndraw = true; } scr_disabled_time = Sys_DoubleTime(); //realtime tends to change... Hmmm.... diff --git a/engine/client/console.c b/engine/client/console.c index bb1e77d1d..b88257b1c 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -3337,41 +3337,3 @@ char *Con_CopyConsole(console_t *con, qboolean nomarkup, qboolean onlyiflink, qb return result; } - - -/* -================== -Con_NotifyBox -================== -*/ -void Con_NotifyBox (char *text) -{ - double t1, t2; - qboolean hadconsole; - -// during startup for sound / cd warnings - Con_Printf("\n\n^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f\n"); - - Con_Printf ("%s", text); - - Con_Printf ("Press a key.\n"); - Con_Printf("^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f\n"); - - key_count = -2; // wait for a key down and up - hadconsole = !!Key_Dest_Has(kdm_console); - Key_Dest_Add(kdm_console); - - do - { - t1 = Sys_DoubleTime (); - SCR_UpdateScreen (); - Sys_SendKeyEvents (); - t2 = Sys_DoubleTime (); - realtime += t2-t1; // make the cursor blink - } while (key_count < 0); - - Con_Printf ("\n"); - - if (!hadconsole) - Key_Dest_Remove(kdm_console); -} diff --git a/engine/client/m_download.c b/engine/client/m_download.c index 29d103360..04afe4cb6 100644 --- a/engine/client/m_download.c +++ b/engine/client/m_download.c @@ -146,6 +146,7 @@ typedef struct package_s { char *description; char *license; char *author; + char *website; char *previewimage; enum { @@ -253,6 +254,7 @@ static void PM_FreePackage(package_t *p) Z_Free(p->title); Z_Free(p->description); Z_Free(p->author); + Z_Free(p->website); Z_Free(p->license); Z_Free(p->previewimage); Z_Free(p->qhash); @@ -747,6 +749,7 @@ static void PM_ParsePackageList(vfsfile_t *f, int parseflags, const char *url, c char *license = NULL; char *author = NULL; char *previewimage = NULL; + char *website = NULL; int extract = EXTRACT_COPY; int priority = PM_DEFAULTPRIORITY; unsigned int flags = parseflags; @@ -786,6 +789,8 @@ static void PM_ParsePackageList(vfsfile_t *f, int parseflags, const char *url, c author = arg+7; else if (!strncmp(arg, "preview=", 8)) previewimage = arg+8; + else if (!strncmp(arg, "website=", 8)) + website = arg+8; else if (!strncmp(arg, "file=", 5)) { if (!file) @@ -879,6 +884,7 @@ static void PM_ParsePackageList(vfsfile_t *f, int parseflags, const char *url, c p->license = license?Z_StrDup(license):NULL; p->author = author?Z_StrDup(author):NULL; p->previewimage = previewimage?Z_StrDup(previewimage):NULL; + p->website = website?Z_StrDup(website):NULL; if (url && (!strncmp(url, "http://", 7) || !strncmp(url, "https://", 8))) p->mirror[0] = Z_StrDup(url); @@ -1476,7 +1482,7 @@ static unsigned int PM_MarkUpdates (void) { if (p == o || (o->flags & DPF_HIDDEN)) continue; - if (!(p->flags & DPF_TESTING) || pm_autoupdate.ival >= UPD_TESTING) + if (!(o->flags & DPF_TESTING) || pm_autoupdate.ival >= UPD_TESTING) if (!strcmp(o->name, p->name) && !strcmp(o->arch?o->arch:"", p->arch?p->arch:"") && strcmp(o->version, p->version) > 0) { if (!b || strcmp(b->version, o->version) < 0) @@ -1841,21 +1847,26 @@ static void PM_WriteInstalledPackages(void) COM_QuotedConcat(va("arch=%s", p->arch), buf, sizeof(buf)); } - if (p->description) - { - Q_strncatz(buf, " ", sizeof(buf)); - COM_QuotedConcat(va("desc=%s", p->description), buf, sizeof(buf)); - } if (p->license) { Q_strncatz(buf, " ", sizeof(buf)); COM_QuotedConcat(va("license=%s", p->license), buf, sizeof(buf)); } + if (p->website) + { + Q_strncatz(buf, " ", sizeof(buf)); + COM_QuotedConcat(va("website=%s", p->website), buf, sizeof(buf)); + } if (p->author) { Q_strncatz(buf, " ", sizeof(buf)); COM_QuotedConcat(va("author=%s", p->author), buf, sizeof(buf)); } + if (p->description) + { + Q_strncatz(buf, " ", sizeof(buf)); + COM_QuotedConcat(va("desc=%s", p->description), buf, sizeof(buf)); + } if (p->previewimage) { Q_strncatz(buf, " ", sizeof(buf)); @@ -2740,8 +2751,10 @@ void PM_Command_f(void) Con_Printf(" license: %s\n", p->license); if (p->author) Con_Printf(" author: %s\n", p->author); + if (p->website) + Con_Printf(" website: %s\n", p->website); if (p->description) - Con_Printf(" %s\n", p->description); + Con_Printf("%s\n", p->description); if (p->flags & DPF_MARKED) { @@ -3101,12 +3114,16 @@ static void MD_Draw (int x, int y, struct menucustom_s *c, struct menu_s *m) static qboolean MD_Key (struct menucustom_s *c, struct menu_s *m, int key, unsigned int unicode) { + extern qboolean keydown[]; + qboolean ctrl = keydown[K_LCTRL] || keydown[K_RCTRL]; package_t *p, *p2; struct packagedep_s *dep, *dep2; if (c->dint != downloadablessequence) return false; //probably stale p = c->dptr; - if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) + if (key == 'c' && ctrl) + Sys_SaveClipboard(CBT_CLIPBOARD, p->website); + else if (key == K_ENTER || key == K_KP_ENTER || key == K_GP_START || key == K_MOUSE1) { if (p->alternative && (p->flags & DPF_HIDDEN)) p = p->alternative; @@ -3296,12 +3313,16 @@ static int MD_AddItemsToDownloadMenu(menu_t *m, int y, const char *pathprefix) slash = strchr(p->category+prefixlen, '/'); if (!slash) { - c = MC_AddCustom(m, 0, y, p, downloadablessequence); + char *desc; + if (p->author || p->license || p->website) + desc = va("^aauthor: ^a%s\n^alicense: ^a%s\n^awebsite: ^a%s\n%s", p->author?p->author:"^hUnknown^h", p->license?p->license:"^hUnknown^h", p->website?p->website:"^hUnknown^h", p->description); + else + desc = p->description; + c = MC_AddCustom(m, 0, y, p, downloadablessequence, desc); c->draw = MD_Draw; c->key = MD_Key; c->common.width = 320; c->common.height = 8; - c->common.tooltip = p->description; y += 8; if (!m->selecteditem) @@ -3467,7 +3488,7 @@ static void MD_Download_UpdateStatus(struct menu_s *m) b->common.tooltip = "Reset selection to only those packages that are currently installed."; y+=8; #ifdef WEBCLIENT - c = MC_AddCustom(m, 48, y, p, 0); + c = MC_AddCustom(m, 48, y, p, 0, NULL); c->draw = MD_AutoUpdate_Draw; c->key = MD_AutoUpdate_Key; c->common.width = 320; diff --git a/engine/client/m_items.c b/engine/client/m_items.c index 33e1edc1e..37ea9244c 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -333,6 +333,7 @@ static qboolean M_MouseMoved(menu_t *menu) { int ypos = menu->ypos, framescroll = 0; menuoption_t *option; + qboolean havemouseitem = false; // if (menu->prev && !menu->exclusive) // if (M_MouseMoved(menu->prev)) // return true; @@ -351,22 +352,11 @@ static qboolean M_MouseMoved(menu_t *menu) { if (menu->mouseitem != option) { -/* if (!option->common.noselectionsound && vid.activeapp) - { -#ifdef HEXEN2 - if (M_GameType() == MGT_HEXEN2) - S_LocalSound ("raven/menu1.wav"); - else -#endif - S_LocalSound ("misc/menu1.wav"); - } -*/ menu->mouseitem = option; menu->tooltiptime = realtime + 1; MenuTooltipChange(menu, menu->mouseitem->common.tooltip); } -// if (menu->cursoritem) -// menu->cursoritem->common.posy = menu->selecteditem->common.posy; + havemouseitem = true; } } } @@ -395,6 +385,11 @@ static qboolean M_MouseMoved(menu_t *menu) break; } } + if (!havemouseitem && menu->mouseitem) + { + menu->mouseitem = NULL; + MenuTooltipChange(menu, NULL); + } return true; } @@ -781,10 +776,10 @@ static void MenuDraw(menu_t *menu) // draw tooltip if (menu->mouseitem && menu->tooltip && realtime > menu->tooltiptime) { - menuoption_t *option = menu->mouseitem; +// menuoption_t *option = menu->mouseitem; - if (omousex > menu->xpos+option->common.posx && omousex < menu->xpos+option->common.posx+option->common.width) - if (omousey > menu->ypos+option->common.posy && omousey < menu->ypos+option->common.posy+option->common.height) +// if (omousex > menu->xpos+option->common.posx && omousex < menu->xpos+option->common.posx+option->common.width) +// if (omousey > menu->ypos+option->common.posy && omousey < menu->ypos+option->common.posy+option->common.height) { int x = omousex+8; int y = omousey; @@ -1159,15 +1154,16 @@ menubox_t *MC_AddBox(menu_t *menu, int x, int y, int width, int height) return n; } -menucustom_t *MC_AddCustom(menu_t *menu, int x, int y, void *dptr, int dint) +menucustom_t *MC_AddCustom(menu_t *menu, int x, int y, void *dptr, int dint, const char *tooltip) { - menucustom_t *n = Z_Malloc(sizeof(menucustom_t)); + menucustom_t *n = Z_Malloc(sizeof(menucustom_t) + (tooltip?strlen(tooltip)+1:0)); n->common.type = mt_custom; n->common.iszone = true; n->common.posx = x; n->common.posy = y; n->dptr = dptr; n->dint = dint; + n->common.tooltip = tooltip?strcpy((char*)(n+1), tooltip):NULL; n->common.next = menu->options; menu->options = (menuoption_t *)n; diff --git a/engine/client/m_master.c b/engine/client/m_master.c index 51dc1ea83..09ad795c3 100644 --- a/engine/client/m_master.c +++ b/engine/client/m_master.c @@ -1149,7 +1149,7 @@ void M_Menu_ServerList2_f(void) info = (serverlist_t*)(menu + 1); y = 16; - cust = MC_AddCustom(menu, 0, y, NULL, 0); + cust = MC_AddCustom(menu, 0, y, NULL, 0, NULL); cust->draw = SL_TitlesDraw; cust->key = SL_TitlesKey; cust->common.height = 8; @@ -1159,7 +1159,7 @@ void M_Menu_ServerList2_f(void) info->servers_top = y; info->visibleslots = (vid.height-info->servers_top - 64); - cust = MC_AddCustom(menu, vid.width-8, 16, NULL, 0); + cust = MC_AddCustom(menu, vid.width-8, 16, NULL, 0, NULL); cust->draw = SL_SliderDraw; cust->key = SL_SliderKey; cust->common.height = info->visibleslots; @@ -1168,7 +1168,7 @@ void M_Menu_ServerList2_f(void) info->visibleslots = (info->visibleslots-8)/8; for (i = 0, y = info->servers_top; i <= info->visibleslots; y +=8, i++) { - cust = MC_AddCustom(menu, 0, y, NULL, i); + cust = MC_AddCustom(menu, 0, y, NULL, i, NULL); if (i==0) menu->selecteditem = (menuoption_t*)&cust->common; cust->draw = SL_ServerDraw; @@ -1184,7 +1184,7 @@ void M_Menu_ServerList2_f(void) { for (y = vid.height-64+8; y < vid.height; y += 8, i++) { - cust = MC_AddCustom(menu, x+16, y, NULL, i); + cust = MC_AddCustom(menu, x+16, y, NULL, i, NULL); cust->draw = SL_ServerPlayer; cust->key = NULL; cust->common.height = 8; @@ -1354,7 +1354,7 @@ void M_QuickConnect_f(void) menu->key = M_QuickConnect_Key; menu->remove = M_QuickConnect_Remove; - cust = MC_AddCustom(menu, 64, 64, NULL, 0); + cust = MC_AddCustom(menu, 64, 64, NULL, 0, NULL); cust->draw = M_QuickConnect_DrawStatus; cust->common.height = 8; cust->common.width = vid.width-8; diff --git a/engine/client/m_multi.c b/engine/client/m_multi.c index c10d2db59..2a960e16b 100644 --- a/engine/client/m_multi.c +++ b/engine/client/m_multi.c @@ -461,7 +461,7 @@ void M_Menu_Setup_f (void) (info->nameedit = MC_AddEdit(menu, 64, 160, 40, "Your name", name.string)); (info->modeledit = MC_AddCvarCombo(menu, 64, 160,72, "model", &skin, (const char **)modeloptions, (const char **)modeloptions)); info->modeledit->selectedoption = !strncmp(skin.string, "female", 6); - cu = MC_AddCustom(menu, 64, 88+16, NULL, 0); + cu = MC_AddCustom(menu, 64, 88+16, NULL, 0, NULL); cu->draw = MSetupQ2_TransDraw; cu->key = MSetupQ2_ChangeSkin; @@ -505,7 +505,7 @@ void M_Menu_Setup_f (void) (info->skinedit = MC_AddEdit(menu, 64, 160, 72, "Your skin", skin.string)); } - ci = MC_AddCustom(menu, 172+32, 88, NULL, 0); + ci = MC_AddCustom(menu, 172+32, 88, NULL, 0, NULL); ci->draw = MSetup_TransDraw; ci->key = NULL; diff --git a/engine/client/m_options.c b/engine/client/m_options.c index 30513d69e..8852038d8 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -3755,7 +3755,7 @@ void M_Menu_ModelViewer_f(void) menu = M_CreateMenu(sizeof(*mv)); mv = menu->data; - c = MC_AddCustom(menu, 64, 32, mv, 0); + c = MC_AddCustom(menu, 64, 32, mv, 0, NULL); menu->cursoritem = (menuoption_t*)c; c->draw = M_ModelViewerDraw; c->key = M_ModelViewerKey; @@ -3990,7 +3990,7 @@ void M_Menu_Mods_f (void) MC_AddCenterPicture(menu, 0, 24, "gfx/p_option.lmp"); } - c = MC_AddCustom(menu, 64, 32, menu->data, 0); + c = MC_AddCustom(menu, 64, 32, menu->data, 0, NULL); menu->cursoritem = (menuoption_t*)c; c->draw = Mods_Draw; c->key = Mods_Key; diff --git a/engine/client/m_single.c b/engine/client/m_single.c index fabdbee9f..6b86be0f6 100644 --- a/engine/client/m_single.c +++ b/engine/client/m_single.c @@ -267,7 +267,7 @@ void M_Menu_Save_f (void) menu->selecteditem = op; } - MC_AddCustom(menu, 192, 60-16, NULL, 0)->draw = M_Menu_LoadSave_Preview_Draw; + MC_AddCustom(menu, 192, 60-16, NULL, 0, NULL)->draw = M_Menu_LoadSave_Preview_Draw; } void M_Menu_Load_f (void) { @@ -314,7 +314,7 @@ void M_Menu_Load_f (void) if (menu->selecteditem) menu->cursoritem = (menuoption_t *)MC_AddRedText(menu, 8, 0, menu->selecteditem->common.posy, NULL, false); - MC_AddCustom(menu, 192, 60-16, NULL, 0)->draw = M_Menu_LoadSave_Preview_Draw; + MC_AddCustom(menu, 192, 60-16, NULL, 0, NULL)->draw = M_Menu_LoadSave_Preview_Draw; } @@ -1108,7 +1108,7 @@ void M_Menu_Demos_f (void) MC_AddWhiteText(menu, 24, 170, 8, "Choose a Demo", false); MC_AddWhiteText(menu, 16, 170, 24, "^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f", false); - info->list = MC_AddCustom(menu, 0, 32, NULL, 0); + info->list = MC_AddCustom(menu, 0, 32, NULL, 0, NULL); info->list->draw = M_DemoDraw; info->list->key = M_DemoKey; @@ -1172,7 +1172,7 @@ void M_Menu_MediaFiles_f (void) MC_AddWhiteText(menu, 24, 170, 8, "Media List", false); MC_AddWhiteText(menu, 16, 170, 24, "^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f", false); - info->list = MC_AddCustom(menu, 0, 32, NULL, 0); + info->list = MC_AddCustom(menu, 0, 32, NULL, 0, NULL); info->list->draw = M_DemoDraw; info->list->key = M_DemoKey; diff --git a/engine/client/menu.c b/engine/client/menu.c index 4558b3a97..7d8b8aabf 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -1498,7 +1498,7 @@ void M_Keydown (int key, int unicode) { if (key == K_MOUSE1) //mouse clicks are deferred until the release event. this is for touch screens and aiming. { - if (topmenu->mouseitem->common.type == mt_frameend) + if (topmenu->mouseitem && topmenu->mouseitem->common.type == mt_frameend) topmenu->mouseitem->frame.mousedown = true; else menu_mousedown = true; diff --git a/engine/client/menu.h b/engine/client/menu.h index 2907be0fe..f7af2a421 100644 --- a/engine/client/menu.h +++ b/engine/client/menu.h @@ -334,7 +334,7 @@ menucombo_t *MC_AddCombo(menu_t *menu, int tx, int cx, int y, const char *captio menucombo_t *MC_AddCvarCombo(menu_t *menu, int tx, int cx, int y, const char *caption, cvar_t *cvar, const char **ops, const char **values); menuedit_t *MC_AddEdit(menu_t *menu, int cx, int ex, int y, char *text, char *def); menuedit_t *MC_AddEditCvar(menu_t *menu, int cx, int ex, int y, char *text, char *name, qboolean slim); -menucustom_t *MC_AddCustom(menu_t *menu, int x, int y, void *dptr, int dint); +menucustom_t *MC_AddCustom(menu_t *menu, int x, int y, void *dptr, int dint, const char *tooltip); menuframe_t *MC_AddFrameStart(menu_t *menu, int y); //call before items are added menuframe_t *MC_AddFrameEnd(menu_t *menu, int y); //and call AFTER that stuff with the same y. diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 522d68dcb..ccece8895 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -3865,7 +3865,7 @@ static const char *PF_cs_getplayerkey_internal (unsigned int pnum, const char *k else if (csqc_isdarkplaces && !strcmp(keyname, "colors")) //checks to see if a player has locally been set to ignored (for text chat) { ret = buffer; - sprintf(ret, "%i", cl.players[pnum].ttopcolor + cl.players[pnum].tbottomcolor*16); + sprintf(ret, "%i", cl.players[pnum].dtopcolor + cl.players[pnum].dbottomcolor*16); } #endif else if (!strcmp(keyname, "ignored")) //checks to see if a player has locally been set to ignored (for text chat) @@ -4163,7 +4163,7 @@ static void QCBUILTIN PF_cs_sound(pubprogfuncs_t *prinst, struct globalvars_s *p if (sfx) S_StartSound(-entity->entnum, channel, sfx, org, entity->v->velocity, volume, attenuation, startoffset, pitchpct, flags); -}; +} static void QCBUILTIN PF_cs_pointsound(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { diff --git a/engine/client/r_partset.h b/engine/client/r_partset.h index 614a030ad..fc4e468cd 100644 --- a/engine/client/r_partset.h +++ b/engine/client/r_partset.h @@ -29,4 +29,6 @@ extern char *particle_set_q2part; extern char *particle_set_tsshaft; #define R_PARTSET_BUILTINS_tsshaft {"tsshaft", &particle_set_tsshaft}, #define R_PARTSET_BUILTINS R_PARTSET_BUILTINS_spikeset R_PARTSET_BUILTINS_faithful R_PARTSET_BUILTINS_highfps R_PARTSET_BUILTINS_high R_PARTSET_BUILTINS_minimal R_PARTSET_BUILTINS_h2part R_PARTSET_BUILTINS_q2part R_PARTSET_BUILTINS_tsshaft +#else +#define R_PARTSET_BUILTINS #endif diff --git a/engine/client/screen.h b/engine/client/screen.h index 8e3a39b23..0d91e8097 100644 --- a/engine/client/screen.h +++ b/engine/client/screen.h @@ -323,4 +323,4 @@ fte_inline float M_LinearToSRGB(float x, float mag) void R_NetgraphInit(void); void R_NetGraph (void); -void R_FrameTimeGraph (int frametime); +void R_FrameTimeGraph (float frametime); diff --git a/engine/gl/gl_ngraph.c b/engine/gl/gl_ngraph.c index d91b36e98..874aeb062 100644 --- a/engine/gl/gl_ngraph.c +++ b/engine/gl/gl_ngraph.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "shader.h" void Draw_ExpandedString(struct font_s *font, float x, float y, conchar_t *str); -static int timehistory[NET_TIMINGS]; +static float timehistory[NET_TIMINGS]; static int findex; #define NET_GRAPHHEIGHT 32 @@ -201,7 +201,7 @@ void R_NetGraph (void) #endif } -void R_FrameTimeGraph (int frametime) +void R_FrameTimeGraph (float frametime) { int a, x, i, y; diff --git a/engine/qclib/decomp.c b/engine/qclib/decomp.c index 122161a30..866b878dc 100644 --- a/engine/qclib/decomp.c +++ b/engine/qclib/decomp.c @@ -143,7 +143,7 @@ const char *temp_type (int temp, dstatement_t *start, dfunction_t *df) } -boolean IsConstant(QCC_ddef_t *def) +pbool IsConstant(QCC_ddef_t *def) { int i; @@ -964,7 +964,7 @@ char *DecompileReturnType(dfunction_t *df) { dstatement_t *ds; unsigned short dom; - boolean foundret = false; + pbool foundret = false; static int recursion; char *ret = NULL; //return null if we don't know. int couldbeastring = true; @@ -2297,7 +2297,7 @@ void DecompileDecompileStatement(dfunction_t * df, dstatement_t * s, int *indent return; } -boolean DecompileDecompileFunction(dfunction_t * df, dstatement_t *altdone) +pbool DecompileDecompileFunction(dfunction_t * df, dstatement_t *altdone) { dstatement_t *ds; int indent; @@ -3034,11 +3034,11 @@ void DecompileFunction(const char *name, int *lastglobal) QCC_CatVFile(Decompileofile, "};\n"); } -extern boolean safedecomp; +extern pbool safedecomp; int fake_name; char synth_name[1024]; // fake name part2 -boolean TrySynthName(const char *first) +pbool TrySynthName(const char *first) { int i; @@ -3060,7 +3060,7 @@ void DecompileDecompileFunctions(const char *origcopyright) int i; unsigned int o; dfunction_t *d; - boolean bogusname; + pbool bogusname; vfile_t *f; char fname[512]; int lastglob = 1; diff --git a/engine/qclib/packager.c b/engine/qclib/packager.c index e0499c7a9..5e9c61592 100644 --- a/engine/qclib/packager.c +++ b/engine/qclib/packager.c @@ -1,6 +1,9 @@ #include "qcc.h" #if !defined(MINIMAL) && !defined(OMIT_QCC) #include +#ifndef _WIN32 +#include +#endif void QCC_Canonicalize(char *fullname, size_t fullnamesize, const char *newfile, const char *base); //package formats: @@ -66,8 +69,8 @@ struct pkgctx_s pbool test; pbool readoldpacks; - char gamepath[MAX_PATH]; - char sourcepath[MAX_PATH]; + char gamepath[MAX_OSPATH]; + char sourcepath[MAX_OSPATH]; time_t buildtime; //skips the file if its listed in one of these packages, unless the modification time on disk is newer. @@ -341,7 +344,7 @@ static void PKG_ReplaceString(char *str, char *find, char *newpart) } static void PKG_CreateOutput(struct pkgctx_s *ctx, struct dataset_s *s, const char *code, const char *filename, pbool diff) { - char path[MAX_PATH]; + char path[MAX_OSPATH]; char date[64]; struct output_s *o; for (o = s->outputs; o; o = o->next) @@ -437,8 +440,8 @@ static void PKG_AddOldPack(struct pkgctx_s *ctx, const char *fname) } static void PKG_ParseOldPack(struct pkgctx_s *ctx) { - char token[MAX_PATH]; - char oldpack[MAX_PATH]; + char token[MAX_OSPATH]; + char oldpack[MAX_OSPATH]; if (!PKG_GetStringToken(ctx, token, sizeof(token))) return; @@ -958,11 +961,11 @@ static void *PKG_OpenSourceFile(struct pkgctx_s *ctx, struct file_s *file, size_ while(fgets(commandline, sizeof(commandline), p)) ctx->messagecallback(ctx->userctx, "%s", commandline); if (feof(p)) - ctx->messagecallback(ctx->userctx, "Process returned %d\n", _pclose( p )); + ctx->messagecallback(ctx->userctx, "Process returned %d\n", pclose( p )); else { - printf( "Error: Failed to read the pipe to the end.\n"); - _pclose(p); + fprintf(stderr, "Error: Failed to read the pipe to the end.\n"); + pclose(p); } } #endif @@ -982,7 +985,11 @@ static void *PKG_OpenSourceFile(struct pkgctx_s *ctx, struct file_s *file, size_ fclose(f); *fsize = size; +#ifdef _WIN32 _unlink(tempname); +#else + unlink(tempname); +#endif return data; } } @@ -1042,7 +1049,7 @@ static void PKG_WritePackageData(struct pkgctx_s *ctx, struct output_s *out, uns if (out->usediffs && !directoryonly) { - char newname[MAX_PATH]; + char newname[MAX_OSPATH]; memcpy(newname, out->filename, sizeof(newname)); if (ext) { @@ -1583,7 +1590,7 @@ void Packager_ParseText(struct pkgctx_s *ctx, char *scripttext) PKG_ParseOutput(ctx, true); else if (!strcmp(cmd, "inputdir")) { - char old[MAX_PATH]; + char old[MAX_OSPATH]; memcpy(old, ctx->sourcepath, sizeof(old)); if (PKG_GetStringToken(ctx, cmd, sizeof(cmd))) { diff --git a/engine/qclib/qcc.h b/engine/qclib/qcc.h index 7cbdc2530..5b11ed596 100644 --- a/engine/qclib/qcc.h +++ b/engine/qclib/qcc.h @@ -17,6 +17,13 @@ //this is for testing #define WRITEASM +#ifndef MAX_QPATH +#define MAX_QPATH 128 +#endif +#ifndef MAX_OSPATH +#define MAX_OSPATH 1024 +#endif + #ifdef __MINGW32_VERSION #define MINGW #endif diff --git a/engine/qclib/qccguistuff.c b/engine/qclib/qccguistuff.c index 93835814f..c8f99e275 100644 --- a/engine/qclib/qccguistuff.c +++ b/engine/qclib/qccguistuff.c @@ -1,6 +1,12 @@ #include "qcc.h" #include "gui.h" +#ifdef _WIN32 +#define alloca _alloca +#else +#include +#endif + //common gui things pbool fl_nondfltopts; @@ -15,8 +21,8 @@ int fl_tabsize; char parameters[16384]; char progssrcname[256]; char progssrcdir[256]; -char enginebinary[MAX_PATH]; -char enginebasedir[MAX_PATH]; +char enginebinary[MAX_OSPATH]; +char enginebasedir[MAX_OSPATH]; char enginecommandline[8192]; int qccpersisthunk = 1; @@ -462,7 +468,7 @@ int GUI_ParseCommandLine(char *args, pbool keepsrcanddir) fseek(f, 0, SEEK_END); len = ftell(f); fseek(f, 0, SEEK_SET); - args = _alloca(len+1); + args = alloca(len+1); fread(args, 1, len, f); args[len] = '\0'; fclose(f); @@ -515,7 +521,11 @@ int GUI_ParseCommandLine(char *args, pbool keepsrcanddir) args++; memmove(progssrcname, args, strlen(args)+1); +#ifdef _WIN32 SetCurrentDirectoryA(progssrcdir); +#else + chdir(progssrcdir); +#endif *progssrcdir = 0; } } diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index f4f7dd6b9..9524444ab 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -919,9 +919,13 @@ void PR_LoadGlabalStruct(qboolean muted) globalint (true, trace_ent); globalfloat (false, trace_inopen); globalfloat (false, trace_inwater); +#ifndef NOLEGACY globalfloat (false, trace_endcontentsf); +#endif globalint (false, trace_endcontentsi); +#ifndef NOLEGACY globalfloat (false, trace_surfaceflagsf); +#endif globalint (false, trace_surfaceflagsi); globalstring (false, trace_surfacename); globalint (false, trace_brush_id); @@ -972,6 +976,12 @@ void PR_LoadGlabalStruct(qboolean muted) #define ensureglobal(name,var) if (!(pr_globals)->name) (pr_globals)->name = &var; +#ifdef NOLEGACY + if (!(pr_globals)->trace_surfaceflagsi) + (pr_globals)->trace_surfaceflagsi = (int*)PR_FindGlobal(svprogfuncs, "trace_surfaceflags", 0, NULL); + if (!(pr_globals)->trace_surfaceflagsi) + (pr_globals)->trace_endcontentsi = (int*)PR_FindGlobal(svprogfuncs, "trace_endcontents", 0, NULL); +#else if (!(pr_globals)->trace_surfaceflagsf && !(pr_globals)->trace_surfaceflagsi) { etype_t etype; @@ -990,13 +1000,14 @@ void PR_LoadGlabalStruct(qboolean muted) else if (etype == ev_integer) (pr_globals)->trace_endcontentsi = (int*)v; } + ensureglobal(trace_endcontentsf, endcontentsf); + ensureglobal(trace_surfaceflagsf, surfaceflagsf); +#endif // make sure these entries are always valid pointers ensureglobal(dimension_send, dimension_send_default); ensureglobal(dimension_default, dimension_default); - ensureglobal(trace_endcontentsf, endcontentsf); ensureglobal(trace_endcontentsi, endcontentsi); - ensureglobal(trace_surfaceflagsf, surfaceflagsf); ensureglobal(trace_surfaceflagsi, surfaceflagsi); ensureglobal(trace_brush_id, writeonly_int); ensureglobal(trace_brush_faceid, writeonly_int); @@ -3655,11 +3666,9 @@ static void set_trace_globals(pubprogfuncs_t *prinst, /*struct globalvars_s *pr_ pr_global_struct->trace_fraction = trace->fraction; pr_global_struct->trace_inwater = trace->inwater; pr_global_struct->trace_inopen = trace->inopen; - pr_global_struct->trace_surfaceflagsf = trace->surface?trace->surface->flags:0; pr_global_struct->trace_surfaceflagsi = trace->surface?trace->surface->flags:0; if (pr_global_ptrs->trace_surfacename) prinst->SetStringField(prinst, NULL, &pr_global_struct->trace_surfacename, trace->surface?trace->surface->name:NULL, true); - pr_global_struct->trace_endcontentsf = trace->contents; pr_global_struct->trace_endcontentsi = trace->contents; pr_global_struct->trace_brush_id = trace->brush_id; pr_global_struct->trace_brush_faceid = trace->brush_face; @@ -3668,6 +3677,9 @@ static void set_trace_globals(pubprogfuncs_t *prinst, /*struct globalvars_s *pr_ pr_global_struct->trace_triangle_id = trace->triangle_id; #ifndef NOLEGACY + pr_global_struct->trace_surfaceflagsf = trace->surface?trace->surface->flags:0; + pr_global_struct->trace_endcontentsf = trace->contents; + if (pr_global_ptrs->trace_dphittexturename) prinst->SetStringField(prinst, NULL, &pr_global_struct->trace_dphittexturename, trace->surface?trace->surface->name:NULL, true); if (pr_global_ptrs->trace_dpstartcontents) diff --git a/engine/server/progdefs.h b/engine/server/progdefs.h index ebec1e082..4e8325936 100644 --- a/engine/server/progdefs.h +++ b/engine/server/progdefs.h @@ -60,10 +60,14 @@ typedef struct nqglobalvars_s float *trace_allsolid; float *trace_startsolid; float *trace_fraction; +#ifndef NOLEGACY float *trace_surfaceflagsf; +#endif int *trace_surfaceflagsi; string_t*trace_surfacename; +#ifndef NOLEGACY float *trace_endcontentsf; +#endif int *trace_endcontentsi; int *trace_brush_id; int *trace_brush_faceid;