Menu-FN: Various improvements to the menu for when no menu assets are available at all.

This commit is contained in:
Marco Cawthorne 2023-02-16 17:24:09 -08:00
parent 95db9c7924
commit 1ff0b3f9ac
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
36 changed files with 288 additions and 1922 deletions

View File

@ -1,30 +0,0 @@
#!/bin/sh
. ./build.cfg
set -e
SCRPATH="$( cd "$( dirname $(readlink -nf $0) )" && pwd )"
grab_mod()
{
if [ -f "$SCRPATH/$1"/LICENSE ]; then
cd "$SCRPATH/$1"
if [ "$BUILD_UPDATE" -eq 1 ]; then
git pull
fi
else
cd "$SCRPATH"
git clone "$2" "$1"
fi
cd "$SCRPATH"
}
grab_mod gearbox https://vcs.vera-visions.com/nuclide-ports/gearbox
grab_mod rewolf https://vcs.vera-visions.com/nuclide-ports/rewolf
grab_mod poke646 https://vcs.vera-visions.com/nuclide-ports/poke646
grab_mod tfc https://vcs.vera-visions.com/nuclide-ports/tfc
grab_mod scihunt https://vcs.vera-visions.com/nuclide-ports/scihunt
grab_mod hunger https://vcs.vera-visions.com/nuclide-ports/hunger
grab_mod valve https://vcs.vera-visions.com/nuclide-ports/valve
grab_mod cstrike https://vcs.vera-visions.com/nuclide-ports/cstrike
grab_mod ts https://vcs.vera-visions.com/nuclide-ports/ts

View File

@ -1,110 +0,0 @@
#!/bin/sh
if ! [ -x "$(command -v zip)" ]; then
printf "'zip' is not installed.\n"
exit
fi
if ! [ -x "$(command -v tree)" ]; then
printf "'tree' is not installed.\n"
exit
fi
if [ $# -lt 0 ]; then
printf "At least supply the name of the mod/game dir you want to pack.\n"
exit
fi
GAME_DIR="$1"
BUILD_DIR=$1-$(date +%m-%d-%Y)
OLD_DIR=$(pwd)
if [ -f "$GAME_DIR"/src/Makefile ]; then
mkdir -p "$BUILD_DIR/$GAME_DIR"
mkdir -p "$BUILD_DIR/platform"
cd $GAME_DIR/src
make
else
printf "Not a valid game to bundle.\n"
exit
fi
cd "$OLD_DIR"
# build the pk3s
find ./$GAME_DIR -name *.pk3dir | xargs -I @ sh -c 'echo `basename "@"`' | while read PK3DIR; do
# strip the .pk3dir from the folder name to get the final .pk3 basename
PK3NAME=$(echo $PK3DIR | cut -f 1 -d '.')
# go into the pk3dir and compile your zip
cd "./$GAME_DIR/$PK3DIR"
tree -fi > ./build_contents.txt
sed -i '/build_contents/d' ./build_contents.txt
sed -i '/directories,/d' ./build_contents.txt
zip -0 "$PK3NAME".pk3 -@ < ./build_contents.txt
rm ./build_contents.txt
# Go back and move it over into the build directory
cd "$OLD_DIR"
mv "./$GAME_DIR/$PK3DIR/$PK3NAME.pk3" "./$BUILD_DIR/$GAME_DIR/$PK3NAME.pk3"
done;
# copy plain text files included within the game-dir
find ./$GAME_DIR -name '*.txt' | xargs -I @ sh -c 'echo `basename "@"`' | while read TEXTNAME; do
cp "./$GAME_DIR/$TEXTNAME" "./$BUILD_DIR/$GAME_DIR/$TEXTNAME"
done;
# copy over the shell scripts inside the game-dir
find ./$GAME_DIR -name 'install_*.sh' | xargs -I @ sh -c 'echo `basename "@"`' | while read SCRIPTNAME; do
cp "./$GAME_DIR/$SCRIPTNAME" "./$BUILD_DIR/$GAME_DIR/$SCRIPTNAME"
done;
cp "./$GAME_DIR/progs.dat" "./$BUILD_DIR/$GAME_DIR/progs.dat"
cp "./$GAME_DIR/csprogs.dat" "./$BUILD_DIR/$GAME_DIR/csprogs.dat"
cp "./$GAME_DIR/menu.dat" "./$BUILD_DIR/$GAME_DIR/menu.dat"
if [ "$EXCLUDE_PLATFORM" ]; then
cp ./$GAME_DIR.fmf ./$BUILD_DIR/$GAME_DIR.fmf
else
find 'platform' -name '*.pk3dir' | xargs -I @ sh -c 'echo `basename "@"`' | while read PK3DIR; do
# strip the .pk3dir from the folder name to get the final .pk3 basename
PK3NAME=$(echo $PK3DIR | cut -f 1 -d '.')
# go into the pk3dir and compile your zip
cd "./platform/$PK3DIR"
tree -fi > ./build_contents.txt
sed -i '/build_contents/d' ./build_contents.txt
sed -i '/directories,/d' ./build_contents.txt
zip -0 "$PK3NAME".pk3 -@ < ./build_contents.txt
rm ./build_contents.txt
# Go back and move it over into the build directory
cd "$OLD_DIR"
mv "./platform/$PK3DIR/$PK3NAME.pk3" "./$BUILD_DIR/platform/$PK3NAME.pk3"
done;
cp "./platform/platform_default.cfg" "./$BUILD_DIR/platform/platform_default.cfg"
cp "./platform/readme.txt" "./$BUILD_DIR/platform/readme.txt"
cp "./platform/menu.dat" "./$BUILD_DIR/platform/menu.dat"
rm "./$BUILD_DIR/platform/test_maps.pk3"
# copy manifest over
if [ -f "./$GAME_DIR/manifest.fmf" ]; then
cp "./$GAME_DIR/manifest.fmf" ./$BUILD_DIR/default.fmf
else
cp ./default.fmf ./$BUILD_DIR/default.fmf
fi
sed -i "s|base|$GAME_DIR|g" ./$BUILD_DIR/default.fmf
cp ./Documentation/release-readme.txt ./$BUILD_DIR/README.txt
fi
tree ./$BUILD_DIR
printf "DONE, press ENTER to create .zip with gpg signature (or CTRL+C to cancel)\n"
read cont
zip -9 -r "$BUILD_DIR".zip "./$BUILD_DIR"
if ! [ -x "$(command -v gpg)" ]; then
printf "'gpg' is not installed.\n"
exit
fi
gpg --output "./$BUILD_DIR.sig" --detach-sig "./$BUILD_DIR.zip"

View File

@ -1,10 +0,0 @@
// Default values for the FN-Menu
HELP_COLOR 127 127 127
PROMPT_BG_COLOR 56 56 56
PROMPT_TEXT_COLOR 240 180 24
PROMPT_TITLE_COLOR 255 255 255
INPUT_TEXT_COLOR 240 180 24
INPUT_BG_COLOR 56 56 56
REFRESH_TITLE_COLOR 240 180 24
REFRESH_TEXT_COLOR 255 255 255
REFRESH_BG_COLOR 56 56 56

View File

@ -1,51 +0,0 @@
"blank" "=========================="
"blank" "Movement"
"blank" "=========================="
"+forward" "Move forward"
"+back" "Move back"
"+left" "Turn left"
"+right" "Turn right"
"+moveleft" "Move left (strafe)"
"+moveright" "Move right (strafe)"
"+jump" "Jump"
"+duck" "Duck"
"+moveup" "Swim up"
"+movedown" "Swim down"
"+lookup" "Look up"
"+lookdown" "Look down"
"centerview" "Look straight ahead"
"+strafe" "Strafe modifier"
"+mlook" "Mouse look modifier"
"+klook" "Keyboard look modifier"
"+use" "Use item"
"blank" "=========================="
"blank" "Combat"
"blank" "=========================="
"+attack" "Primary attack"
"+attack2" "Secondary attack"
"+reload" "Reload weapon"
"+speed" "Walk"
"slot1" "Weapon category 1"
"slot2" "Weapon category 2"
"slot3" "Weapon category 3"
"slot4" "Weapon category 4"
"slot5" "Weapon category 5"
"invprev" "Previous weapon"
"invnext" "Next weapon"
"lastinv" "Last used weapon"
"impulse 100" "Toggle flashlight"
"impulse 201" "Spray graffiti"
"blank" "=========================="
"blank" "Communication"
"blank" "=========================="
"+voip" "Use voice communication"
"messagemode" "Global chat message"
"messagemode2" "Team chat message"
"blank" "=========================="
"blank" "Miscellaneous"
"blank" "=========================="
"+showscores" "Display multiplayer scores"
"screenshot" "Take screen shot"
"save quick" "Quick save"
"load quick" "Quick load"
"pause" "Pause game"

View File

@ -1 +0,0 @@
// TODO...

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,6 @@ Font_Load(string strFile, font_s &fntNew)
print(sprintf("loaded font definition for %s\n", strFile));
if (strRenderSize != "") {
print(sprintf("rendersize: %S\n", strRenderSize));
fntNew.iID = (int)loadfont("", strFontPath, strRenderSize, -1, 0, 0);
} else
fntNew.iID = (int)loadfont("", strFontPath, ftos((float)fntNew.iScaleY), -1, 0, 0);

View File

@ -20,11 +20,26 @@ drawpic_flip(vector pos, string mat, vector size, vector color, float alpha)
drawsubpic(pos, size, mat, [1,0], [-1,1], color, alpha, 0);
}
static int g_bg_check;
void
Background_WON(void)
{
drawpic([g_menuofs[0],g_menuofs[1]], g_bmp[SPLASH],
[640,480], [1,1,1], 1.0f);
/* handle missing backgrounds gracefully */
if (!g_bg_check) {
if (whichpack(strcat(g_bmp[SPLASH], ".bmp"))) {
g_bg_check = 1;
} else {
g_bg_check = 2; /* missing */
}
}
if (g_bg_check == 1) {
drawpic([g_menuofs[0],g_menuofs[1]], g_bmp[SPLASH],
[640,480], [1,1,1], 1.0f);
} else {
drawfill([g_menuofs[0],g_menuofs[1]], [640, 480], [0.1,0.1,0.1], 1.0f);
}
/* just some silly widescreen extension hack that could apply to some games */
#if 0

View File

@ -62,7 +62,7 @@ Colors_Init(void)
}
if (fs_colors < 0) {
print("^1WARNING: ^7Could NOT load gfx/shell/colors.lst");
warning("Cannot parse gfx/shell/colors.lst!");
return;
}

View File

@ -176,4 +176,35 @@ enum
PAGE_UPDATES
};
typedef enum
{
RESOURCE_UNCHECKED,
RESOURCE_AVAILABLE,
RESOURCE_MISSING
} resource_t;
resource_t
Resource_Check(string fname)
{
if not (whichpack(fname))
return RESOURCE_MISSING;
return RESOURCE_AVAILABLE;
}
bool
Resource_Available(resource_t res)
{
if (res == RESOURCE_MISSING)
return false;
else if (res == RESOURCE_AVAILABLE)
return true;
}
void m_hide(void);
void
warning(string msg)
{
print(sprintf("^1WARNING: ^7%s\n", msg));
}

View File

@ -87,7 +87,7 @@ Layout_FromFile_Create(CPageTab target, string cvar, string descr, string type,
//new = spawn(CTextBox);
//break;
default:
print(sprintf("Unknown layout element type %S\n", type));
warning(sprintf("Unknown widget type %S for cvar %S, ignoring", type, cvar));
}
if (!new)
@ -197,7 +197,7 @@ Layout_FromFile(string filename, CWidget target)
fh = fopen(filename, FILE_READ);
if (fh < 0) {
error(sprintf("Cannot read layout file %S\n", filename));
warning(sprintf("Cannot read layout file %S", filename));
return;
}

View File

@ -107,7 +107,7 @@ ctrl_btndefaults(void)
}
fclose(fs_def);
} else {
error("Cannot parse gfx/shell/kb_def.lst!");
warning("Cannot parse gfx/shell/kb_def.lst!");
}
}
@ -258,7 +258,7 @@ menu_controls_init(void)
}
fclose(fs_actlst);
} else {
error("Cannot parse gfx/shell/kb_act.lst!");
warning("Cannot parse gfx/shell/kb_act.lst!");
}
menu_controls_update();

View File

@ -324,7 +324,7 @@ games_find_in_gamedir(string filename, string gamedirname)
sh = search_begin(filename, SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, strcat(gamedirname, "/", full));
fh = search_fopen(sh, 0);
print(sprintf("looking for %s in %s\n", filename, strcat(gamedirname, "/", full)));
//print(sprintf("looking for %s in %s\n", filename, strcat(gamedirname, "/", full)));
/* we found one */
if (fh >= 0) {
@ -344,14 +344,14 @@ games_find_in_gamedir(string filename, string gamedirname)
/* loop through each pk3 in reverse (newest to old) */
for (int i = search_getsize(psh); i >= 0; i--) {
string full = search_getfilename(psh, i);
print(sprintf("%s\n", full));
//print(sprintf("%s\n", full));
if (!full)
continue;
sh = search_begin(filename, SB_FULLPACKAGEPATH | SB_FORCESEARCH, FALSE, strcat(gamedirname, "/", full));
fh = search_fopen(sh, 0);
print(sprintf("looking for %s in %s\n", filename, strcat(gamedirname, "/", full)));
//print(sprintf("looking for %s in %s\n", filename, strcat(gamedirname, "/", full)));
/* we found one */
if (fh >= 0) {
@ -730,8 +730,8 @@ void
games_setdefaultpkgs(int id)
{
if (games[id].gamedir == "valve") {
games[id].pkgname = "valve_dayone;valve_uplink;valve_realmedia;valve_opfordemo;valve_hlds;valve_patch1110;addon_furtherdata;addon_holidaymodels";
games[id].pkgfile = "maps/crossfire.bsp";
games[id].pkgname = "valve_patch;addon_furtherdata;addon_holidaymodels";
games[id].pkgfile = "maps/crossfire.bsp"; /* only found in patches */
}
}

View File

@ -116,10 +116,14 @@ up_lbupdates_changed(void)
pkgid = up_lbUpdates.GetSelected();
if (!pkgid)
if (pkgid == -1)
return;
newpic = sprintf(FN_UPDATE_IMGURL, updates[pkgid].name);
if not (newpic)
return;
g_updates_previewpic = newpic;
precache_pic(g_updates_previewpic);
}

View File

@ -19,33 +19,113 @@ class CCheckBox:CWidget
int m_value;
int m_hover;
int m_click;
resource_t m_resChecked;
resource_t m_resEmpty;
resource_t m_resHover;
resource_t m_resDown;
void CCheckBox(void);
virtual void(float value) m_changed = 0;
virtual void(void) Draw;
virtual void(float, float, float, float) Input;
virtual void(void(float)) SetCallback;
virtual void(float) SetValue;
nonvirtual void DrawBoxChecked(vector);
nonvirtual void DrawBoxEmpty(vector);
nonvirtual void DrawBoxHover(vector);
nonvirtual void DrawBoxDown(vector);
};
void
CCheckBox::CCheckBox(void)
{
m_resChecked = Resource_Check(strcat(g_bmp[CB_CHECKED], ".bmp"));
m_resEmpty = Resource_Check(strcat(g_bmp[CB_EMPTY], ".bmp"));
m_resHover = Resource_Check(strcat(g_bmp[CB_OVER], ".bmp"));
m_resDown = Resource_Check(strcat(g_bmp[CB_DOWN], ".bmp"));
}
void
CCheckBox::DrawBoxChecked(vector vecPos)
{
if (Resource_Available(m_resChecked))
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[CB_CHECKED],
[19,19], [1,1,1], 1.0f);
else {
drawfill([g_menuofs[0]+m_x,g_menuofs[1]+m_y], [19,19], [0.5,0.5,0.5], 1.0f);
drawfill([g_menuofs[0]+m_x+3,g_menuofs[1]+m_y+3], [13,13], [0,0,0], 1.0f);
drawfill([g_menuofs[0]+m_x+4,g_menuofs[1]+m_y+4],
[11,11],
[1,1,1],
0.75f);
}
}
void
CCheckBox::DrawBoxEmpty(vector vecPos)
{
if (Resource_Available(m_resEmpty))
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[CB_EMPTY],
[19,19], [1,1,1], 1.0f);
else {
drawfill([g_menuofs[0]+m_x,g_menuofs[1]+m_y], [19,19], [0.5,0.5,0.5], 1.0f);
drawfill([g_menuofs[0]+m_x+3,g_menuofs[1]+m_y+3], [13,13], [0,0,0], 1.0f);
}
}
void
CCheckBox::DrawBoxHover(vector vecPos)
{
if (Resource_Available(m_resHover))
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[CB_OVER],
[19,19], [1,1,1], 1.0f, 1);
else {
drawfill([g_menuofs[0]+m_x,g_menuofs[1]+m_y], [19,19], [0.5,0.5,0.5], 1.0f);
drawfill([g_menuofs[0]+m_x+3,g_menuofs[1]+m_y+3], [13,13], [0,0,0], 1.0f);
drawfill([g_menuofs[0]+m_x+4,g_menuofs[1]+m_y+4],
[11,11],
[1,1,1],
0.5f);
}
}
void
CCheckBox::DrawBoxDown(vector vecPos)
{
if (Resource_Available(m_resDown))
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[CB_DOWN],
[19,19], [1,1,1], 1.0f, 0);
else {
drawfill([g_menuofs[0]+m_x,g_menuofs[1]+m_y], [19,19], [0.5,0.5,0.5], 1.0f);
drawfill([g_menuofs[0]+m_x+3,g_menuofs[1]+m_y+3], [13,13], [0,0,0], 1.0f);
drawfill([g_menuofs[0]+m_x+4,g_menuofs[1]+m_y+4],
[11,11],
[1,1,1],
1.0f);
}
}
void
CCheckBox::Draw(void)
{
if (m_click) {
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[CB_DOWN],
[19,19], [1,1,1], 1.0f, 0);
DrawBoxDown([g_menuofs[0]+m_x,g_menuofs[1]+m_y]);
} else {
if (m_value) {
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[CB_CHECKED],
[19,19], [1,1,1], 1.0f);
DrawBoxChecked([g_menuofs[0]+m_x,g_menuofs[1]+m_y]);
} else {
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[CB_EMPTY],
[19,19], [1,1,1], 1.0f);
DrawBoxEmpty([g_menuofs[0]+m_x,g_menuofs[1]+m_y]);
}
}
if (m_hover) {
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[CB_OVER],
[19,19], [1,1,1], 1.0f, 1);
if (m_hover) {
DrawBoxHover([g_menuofs[0]+m_x,g_menuofs[1]+m_y]);
}
}
}
void

View File

@ -7,12 +7,17 @@ class CPageTab:CWidget
int m_lbtnstate;
int m_rbtnstate;
resource_t m_resLeft;
resource_t m_resRight;
void CPageTab(void);
virtual void Draw(void);
virtual void Input(float, float, float, float);
virtual void AddWidget(CWidget);
nonvirtual void DrawArrowLeft(vector);
nonvirtual void DrawArrowRight(vector);
};
void
@ -20,29 +25,62 @@ CPageTab::CPageTab(void)
{
m_page = 1;
m_maxpage = 1;
m_resLeft = Resource_Check(strcat(g_bmp[LARROWDEFAULT], ".bmp"));
m_resRight = Resource_Check(strcat(g_bmp[RARROWDEFAULT], ".bmp"));
}
void
CPageTab::DrawArrowLeft(vector vecPos)
{
if (Resource_Available(m_resLeft)) {
if (m_lbtnstate & 2) {
drawpic(vecPos, g_bmp[LARROWPRESSED], [16,16], [1,1,1], 1.0f, 0);
} else if (m_lbtnstate & 1) {
drawpic(vecPos, g_bmp[LARROWFLYOVER], [16,16], [1,1,1], 1.0f, 0);
} else {
drawpic(vecPos, g_bmp[LARROWDEFAULT], [16,16], [1,1,1], 1.0f, 0);
}
} else {
drawfill(vecPos, [16,16], [0.25,0.25,0.25], 1.0f);
drawfill(vecPos + [3,3], [10,10], [0,0,0], 1.0f);
if (m_lbtnstate & 2) {
drawfill(vecPos, [16,16], [1,1,1], 1.0f);
} else if (m_lbtnstate & 1) {
drawfill(vecPos, [16,16], [1,1,1], 0.75f);
}
}
}
void
CPageTab::DrawArrowRight(vector vecPos)
{
if (Resource_Available(m_resRight)) {
if (m_rbtnstate & 2) {
drawpic(vecPos, g_bmp[RARROWPRESSED], [16,16], [1,1,1], 1.0f, 0);
} else if (m_rbtnstate & 1) {
drawpic(vecPos, g_bmp[RARROWFLYOVER], [16,16], [1,1,1], 1.0f, 0);
} else {
drawpic(vecPos, g_bmp[RARROWDEFAULT], [16,16], [1,1,1], 1.0f, 0);
}
} else {
drawfill(vecPos, [16,16], [0.25,0.25,0.25], 1.0f);
drawfill(vecPos + [3,3], [10,10], [0,0,0], 1.0f);
if (m_rbtnstate & 2) {
drawfill(vecPos, [16,16], [1,1,1], 1.0f);
} else if (m_rbtnstate & 1) {
drawfill(vecPos, [16,16], [1,1,1], 0.75f);
}
}
}
.string classname;
void
CPageTab::Draw(void)
{
string lbtn = g_bmp[LARROWDEFAULT];
string rbtn = g_bmp[RARROWDEFAULT];
if (m_lbtnstate & 2)
lbtn = g_bmp[LARROWPRESSED];
else if (m_lbtnstate & 1)
lbtn = g_bmp[LARROWFLYOVER];
if (m_rbtnstate & 2)
rbtn = g_bmp[RARROWPRESSED];
else if (m_rbtnstate & 1)
rbtn = g_bmp[RARROWFLYOVER];
drawpic([g_menuofs[0]+440,g_menuofs[1]+108], lbtn,
[16,16], [1,1,1], 1.0f, 0);
drawpic([g_menuofs[0]+573,g_menuofs[1]+108], rbtn,
[16,16], [1,1,1], 1.0f, 0);
DrawArrowLeft([g_menuofs[0]+440,g_menuofs[1]+108]);
DrawArrowRight([g_menuofs[0]+573,g_menuofs[1]+108]);
WLabel_Static(460, 111, sprintf("Page %i of %i", m_page, m_maxpage), 14, 14, [1,1,1],
1.0, 0, font_label);

View File

@ -27,6 +27,8 @@ class CScrollbar:CWidget
int m_totalentries;
int m_itemheight;
virtual void(int) m_changed = 0;
resource_t m_resUp;
resource_t m_resDown;
int m_up_hover;
int m_up_hold;
@ -42,6 +44,9 @@ class CScrollbar:CWidget
virtual void(int) SetHeight;
virtual void(int) SetItemheight;
virtual void(void(int)) SetCallback;
nonvirtual void DrawArrowUp(vector);
nonvirtual void DrawArrowDown(vector);
};
void
@ -51,6 +56,54 @@ CScrollbar::CScrollbar(void)
* (border, etc. ignored) */
SetItemheight(15);
SetHeight(128);
m_resUp = Resource_Check(strcat(g_bmp[UPARROWD], ".bmp"));
m_resDown = Resource_Check(strcat(g_bmp[DNARROWD], ".bmp"));
}
void
CScrollbar::DrawArrowUp(vector vecPos)
{
if (Resource_Available(m_resUp)) {
if (m_up_hold) {
drawpic(vecPos, g_bmp[UPARROWP], [16,16], [1,1,1], 1.0f, 0);
} else if (m_up_hover) {
drawpic(vecPos, g_bmp[UPARROWF], [16,16], [1,1,1], 1.0f, 0);
} else {
drawpic(vecPos, g_bmp[UPARROWD], [16,16], [1,1,1], 1.0f, 0);
}
} else {
drawfill(vecPos, [16,16], [0.25,0.25,0.25], 1.0f);
drawfill(vecPos + [3,3], [10,10], [0,0,0], 1.0f);
if (m_up_hold) {
drawfill(vecPos, [16,16], [1,1,1], 1.0f);
} else if (m_up_hover) {
drawfill(vecPos, [16,16], [1,1,1], 0.75f);
}
}
}
void
CScrollbar::DrawArrowDown(vector vecPos)
{
if (Resource_Available(m_resDown)) {
if (m_dn_hold) {
drawpic(vecPos, g_bmp[DNARROWP], [16,16], [1,1,1], 1.0f, 0);
} else if (m_dn_hover) {
drawpic(vecPos, g_bmp[DNARROWF], [16,16], [1,1,1], 1.0f, 0);
} else {
drawpic(vecPos, g_bmp[DNARROWD], [16,16], [1,1,1], 1.0f, 0);
}
} else {
drawfill(vecPos, [16,16], [0.25,0.25,0.25], 1.0f);
drawfill(vecPos + [3,3], [10,10], [0,0,0], 1.0f);
if (m_dn_hold) {
drawfill(vecPos, [16,16], [1,1,1], 1.0f);
} else if (m_dn_hover) {
drawfill(vecPos, [16,16], [1,1,1], 0.75f);
}
}
}
void
@ -59,27 +112,8 @@ CScrollbar::Draw(void)
int barheight = 0;
float barstep = 0;
if (m_up_hold) {
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[UPARROWP],
[16,16], [1,1,1], 1.0f, 0);
} else if (m_up_hover) {
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[UPARROWF],
[16,16], [1,1,1], 1.0f, 0);
} else {
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_bmp[UPARROWD],
[16,16], [1,1,1], 1.0f, 0);
}
if (m_dn_hold) {
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y+m_theight + 16], g_bmp[DNARROWP],
[16,16], [1,1,1], 1.0f, 0);
} else if (m_dn_hover) {
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y+m_theight + 16], g_bmp[DNARROWF],
[16,16], [1,1,1], 1.0f, 0);
} else {
drawpic([g_menuofs[0]+m_x,g_menuofs[1]+m_y+m_theight + 16], g_bmp[DNARROWD],
[16,16], [1,1,1], 1.0f, 0);
}
DrawArrowUp([g_menuofs[0]+m_x,g_menuofs[1]+m_y]);
DrawArrowDown([g_menuofs[0]+m_x,g_menuofs[1]+m_y+m_theight + 16]);
barheight = (float)(m_minus) / (float)(m_totalentries) * m_theight;

View File

@ -22,6 +22,7 @@ class CSlider:CWidget
int m_hold;
float m_value;
virtual void m_changed(float) = 0;
resource_t m_resSlider;
void CSlider(void);
virtual void Draw(void);
@ -40,6 +41,7 @@ CSlider::CSlider(void)
* (border, etc. ignored) */
m_length = 156;
m_tlength = m_length - 27;
m_resSlider = Resource_Check(strcat(g_bmp[SLIDER], ".bmp"));
}
void
@ -47,10 +49,13 @@ CSlider::Draw(void)
{
drawfill([g_menuofs[0]+m_x,g_menuofs[1]+m_y], [m_length,8], [0.25,0.25,0.25], 1.0f);
drawfill([g_menuofs[0]+m_x+3,g_menuofs[1]+m_y+3], [m_length-6,2], [0,0,0], 1.0f);
if (Resource_Available(m_resSlider))
drawpic([g_menuofs[0]+m_x+(m_value * m_tlength)+3,g_menuofs[1]+m_y], g_bmp[SLIDER],
[21,8], [1,1,1], 1.0f);
else {
drawfill([g_menuofs[0]+m_x+(m_value * m_tlength)+3,g_menuofs[1]+m_y], [21,8], [1,1,1], 0.75f);
}
}
void

View File

@ -108,6 +108,10 @@ private:
/* model events */
float m_flBaseTime;
#ifdef CLIENT
nonvirtual void _UpdateGeomset();
#endif
#ifdef SERVER
/* respawn */
float m_oldiRenderFX;
@ -135,6 +139,7 @@ public:
virtual void RenderDebugSkeleton(void);
virtual void ReceiveEntity(float,float);
virtual float predraw(void);
virtual void RendererRestarted();
#endif
virtual void MakeStatic(void);

View File

@ -37,6 +37,18 @@ NSRenderableEntity::NSRenderableEntity(void)
#endif
}
#ifdef CLIENT
void NSRenderableEntity::RendererRestarted( void ) {
_UpdateGeomset();
}
void NSRenderableEntity::_UpdateGeomset(void)
{
setcustomskin(this, "", sprintf("geomset 0 %i\ngeomset 1 %i\n", m_iBody, m_iBody));
}
#endif
/*
============
NSRenderableEntity::MakeStatic
@ -564,7 +576,7 @@ NSRenderableEntity::SetBody(int newBody)
m_iBody = newBody;
#ifdef CLIENT
setcustomskin(this, "", sprintf("geomset 0 %i\ngeomset 1 %i\n", m_iBody, m_iBody));
_UpdateGeomset();
#endif
}