adjusted position of strings in hud and cockpit; made fadings work in OGL; made radar scale in cockpit mode; mede normal reticle default again and scaled it to current resolution for OGL; reformatted code to make it A BIT MORE readable
This commit is contained in:
parent
1b11900e30
commit
aec4c6ea28
138
arch/ogl/gr.c
138
arch/ogl/gr.c
|
@ -6,8 +6,6 @@
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#include <GL/gl.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -24,16 +22,13 @@
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "u_mem.h"
|
#include "u_mem.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
#include "inferno.h"
|
#include "inferno.h"
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
|
|
||||||
#include "strutil.h"
|
#include "strutil.h"
|
||||||
#include "mono.h"
|
#include "mono.h"
|
||||||
#include "args.h"
|
#include "args.h"
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
#include "u_mem.h"
|
#include "u_mem.h"
|
||||||
|
|
||||||
#include "gamefont.h"
|
#include "gamefont.h"
|
||||||
|
|
||||||
#define DECLARE_VARS
|
#define DECLARE_VARS
|
||||||
|
@ -41,14 +36,10 @@
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
|
|
||||||
int ogl_voodoohack=0;
|
int ogl_voodoohack=0;
|
||||||
|
|
||||||
int gr_installed = 0;
|
int gr_installed = 0;
|
||||||
|
|
||||||
|
|
||||||
void gr_palette_clear(); // Function prototype for gr_init;
|
void gr_palette_clear(); // Function prototype for gr_init;
|
||||||
int gl_initialized=0;
|
int gl_initialized=0;
|
||||||
int gl_reticle=1;
|
int gl_reticle=0;
|
||||||
|
|
||||||
int ogl_fullscreen=0;
|
int ogl_fullscreen=0;
|
||||||
|
|
||||||
int gr_check_fullscreen(void){
|
int gr_check_fullscreen(void){
|
||||||
|
@ -56,10 +47,10 @@ int gr_check_fullscreen(void){
|
||||||
}
|
}
|
||||||
|
|
||||||
void gr_do_fullscreen(int f){
|
void gr_do_fullscreen(int f){
|
||||||
if (ogl_voodoohack)
|
if (ogl_voodoohack)
|
||||||
ogl_fullscreen=1;//force fullscreen mode on voodoos.
|
ogl_fullscreen=1;//force fullscreen mode on voodoos.
|
||||||
else
|
else
|
||||||
ogl_fullscreen=f;
|
ogl_fullscreen=f;
|
||||||
if (gl_initialized){
|
if (gl_initialized){
|
||||||
ogl_do_fullscreen_internal();
|
ogl_do_fullscreen_internal();
|
||||||
}
|
}
|
||||||
|
@ -67,9 +58,7 @@ void gr_do_fullscreen(int f){
|
||||||
|
|
||||||
int gr_toggle_fullscreen(void){
|
int gr_toggle_fullscreen(void){
|
||||||
gr_do_fullscreen(!ogl_fullscreen);
|
gr_do_fullscreen(!ogl_fullscreen);
|
||||||
// grd_curscreen->sc_mode=0;//hack to get it to reset screen mode
|
|
||||||
glFlush(); // ZICO - prevents black screen, screen glitches etc.
|
glFlush(); // ZICO - prevents black screen, screen glitches etc.
|
||||||
|
|
||||||
return ogl_fullscreen;
|
return ogl_fullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,12 +74,10 @@ int arch_toggle_fullscreen_menu(void){
|
||||||
gr_do_fullscreen(!ogl_fullscreen);
|
gr_do_fullscreen(!ogl_fullscreen);
|
||||||
|
|
||||||
if (ogl_readpixels_ok){
|
if (ogl_readpixels_ok){
|
||||||
// glWritePixels(0,0,grd_curscreen->sc_w,grd_curscreen->sc_h,GL_RGB,GL_UNSIGNED_BYTE,buf);
|
|
||||||
glRasterPos2f(0,0);
|
glRasterPos2f(0,0);
|
||||||
glDrawPixels(grd_curscreen->sc_w,grd_curscreen->sc_h,GL_RGB,GL_UNSIGNED_BYTE,buf);
|
glDrawPixels(grd_curscreen->sc_w,grd_curscreen->sc_h,GL_RGB,GL_UNSIGNED_BYTE,buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
// grd_curscreen->sc_mode=0;//hack to get it to reset screen mode
|
|
||||||
|
|
||||||
return ogl_fullscreen;
|
return ogl_fullscreen;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +103,6 @@ void ogl_set_screen_mode(void){
|
||||||
if (last_screen_mode==Screen_mode)
|
if (last_screen_mode==Screen_mode)
|
||||||
return;
|
return;
|
||||||
OGL_VIEWPORT(0,0,grd_curscreen->sc_w,grd_curscreen->sc_h);
|
OGL_VIEWPORT(0,0,grd_curscreen->sc_w,grd_curscreen->sc_h);
|
||||||
// OGL_VIEWPORT(grd_curcanv->cv_bitmap.bm_x,grd_curcanv->cv_bitmap.bm_y,grd_curcanv->cv_bitmap.bm_w,grd_curcanv->cv_bitmap.bm_h);
|
|
||||||
if (Screen_mode==SCREEN_GAME){
|
if (Screen_mode==SCREEN_GAME){
|
||||||
glDrawBuffer(GL_BACK);
|
glDrawBuffer(GL_BACK);
|
||||||
}else{
|
}else{
|
||||||
|
@ -218,19 +204,14 @@ int gr_set_mode(u_int32_t mode)
|
||||||
int i, argnum = INT_MAX;
|
int i, argnum = INT_MAX;
|
||||||
|
|
||||||
#ifdef NOGRAPH
|
#ifdef NOGRAPH
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
// mode=0;
|
|
||||||
if (mode<=0)
|
if (mode<=0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
w=SM_W(mode);
|
w=SM_W(mode);
|
||||||
h=SM_H(mode);
|
h=SM_H(mode);
|
||||||
|
|
||||||
//if (screen != NULL) gr_palette_clear();
|
|
||||||
|
|
||||||
// ogl_init_state();
|
|
||||||
|
|
||||||
if ((i=FindResArg("aspect", &ah, &aw)) && (i < argnum)) { argnum = i; awidth=aw; aheight=ah; }
|
if ((i=FindResArg("aspect", &ah, &aw)) && (i < argnum)) { argnum = i; awidth=aw; aheight=ah; }
|
||||||
|
|
||||||
gr_bm_data=grd_curscreen->sc_canvas.cv_bitmap.bm_data;//since we use realloc, we want to keep this pointer around.
|
gr_bm_data=grd_curscreen->sc_canvas.cv_bitmap.bm_data;//since we use realloc, we want to keep this pointer around.
|
||||||
|
@ -243,23 +224,14 @@ return 0;
|
||||||
grd_curscreen->sc_canvas.cv_bitmap.bm_y = 0;
|
grd_curscreen->sc_canvas.cv_bitmap.bm_y = 0;
|
||||||
grd_curscreen->sc_canvas.cv_bitmap.bm_w = w;
|
grd_curscreen->sc_canvas.cv_bitmap.bm_w = w;
|
||||||
grd_curscreen->sc_canvas.cv_bitmap.bm_h = h;
|
grd_curscreen->sc_canvas.cv_bitmap.bm_h = h;
|
||||||
//grd_curscreen->sc_canvas.cv_bitmap.bm_rowsize = screen->pitch;
|
|
||||||
grd_curscreen->sc_canvas.cv_bitmap.bm_rowsize = w;
|
grd_curscreen->sc_canvas.cv_bitmap.bm_rowsize = w;
|
||||||
grd_curscreen->sc_canvas.cv_bitmap.bm_type = BM_OGL;
|
grd_curscreen->sc_canvas.cv_bitmap.bm_type = BM_OGL;
|
||||||
//grd_curscreen->sc_canvas.cv_bitmap.bm_data = (unsigned char *)screen->pixels;
|
|
||||||
// mprintf((0,"ogl/gr.c: reallocing %p to %i\n",grd_curscreen->sc_canvas.cv_bitmap.bm_data,w*h));
|
|
||||||
grd_curscreen->sc_canvas.cv_bitmap.bm_data = realloc(gr_bm_data,w*h);
|
grd_curscreen->sc_canvas.cv_bitmap.bm_data = realloc(gr_bm_data,w*h);
|
||||||
gr_set_current_canvas(NULL);
|
gr_set_current_canvas(NULL);
|
||||||
//gr_enable_default_palette_loading();
|
|
||||||
|
|
||||||
ogl_init_window(w,h);//platform specific code
|
ogl_init_window(w,h);//platform specific code
|
||||||
|
|
||||||
ogl_get_verinfo();
|
ogl_get_verinfo();
|
||||||
|
|
||||||
OGL_VIEWPORT(0,0,w,h);
|
OGL_VIEWPORT(0,0,w,h);
|
||||||
|
|
||||||
ogl_set_screen_mode();
|
ogl_set_screen_mode();
|
||||||
|
|
||||||
gamefont_choose_game_font(w,h);
|
gamefont_choose_game_font(w,h);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -276,8 +248,8 @@ int ogl_atotexfilti(char *a,int min){
|
||||||
GLstrcmptestr(a,LINEAR_MIPMAP_LINEAR);
|
GLstrcmptestr(a,LINEAR_MIPMAP_LINEAR);
|
||||||
}
|
}
|
||||||
Error("unknown/invalid texture filter %s\n",a);
|
Error("unknown/invalid texture filter %s\n",a);
|
||||||
// return GL_NEAREST;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogl_testneedmipmaps(int i){
|
int ogl_testneedmipmaps(int i){
|
||||||
switch (i){
|
switch (i){
|
||||||
case GL_NEAREST:
|
case GL_NEAREST:
|
||||||
|
@ -290,7 +262,7 @@ int ogl_testneedmipmaps(int i){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Error("unknown texture filter %x\n",i);
|
Error("unknown texture filter %x\n",i);
|
||||||
// return -1;
|
|
||||||
}
|
}
|
||||||
#ifdef OGL_RUNTIME_LOAD
|
#ifdef OGL_RUNTIME_LOAD
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
@ -345,8 +317,7 @@ int gr_init(int mode)
|
||||||
ogl_voodoohack=1;
|
ogl_voodoohack=1;
|
||||||
gr_toggle_fullscreen();
|
gr_toggle_fullscreen();
|
||||||
}
|
}
|
||||||
// if (FindArg("-fullscreen"))
|
if (!(FindArg("-window")))
|
||||||
if (!(FindArg("-window"))) // ZICO - from window to fullscreen
|
|
||||||
gr_toggle_fullscreen();
|
gr_toggle_fullscreen();
|
||||||
#endif
|
#endif
|
||||||
if ((glt=FindArg("-gl_alttexmerge")))
|
if ((glt=FindArg("-gl_alttexmerge")))
|
||||||
|
@ -362,7 +333,7 @@ int gr_init(int mode)
|
||||||
GL_texmagfilt=GL_LINEAR;
|
GL_texmagfilt=GL_LINEAR;
|
||||||
GL_texminfilt=GL_LINEAR_MIPMAP_NEAREST;
|
GL_texminfilt=GL_LINEAR_MIPMAP_NEAREST;
|
||||||
}
|
}
|
||||||
if ((glt=FindArg("-gl_trilinear")))
|
if ((glt=FindArg("-gl_trilinear")))
|
||||||
{
|
{
|
||||||
GL_texmagfilt = GL_LINEAR;
|
GL_texmagfilt = GL_LINEAR;
|
||||||
GL_texminfilt = GL_LINEAR_MIPMAP_LINEAR;
|
GL_texminfilt = GL_LINEAR_MIPMAP_LINEAR;
|
||||||
|
@ -391,7 +362,6 @@ int gr_init(int mode)
|
||||||
if ((t=FindArg("-gl_reticle"))){
|
if ((t=FindArg("-gl_reticle"))){
|
||||||
gl_reticle=atoi(Args[t+1]);
|
gl_reticle=atoi(Args[t+1]);
|
||||||
}
|
}
|
||||||
//printf("ogl_mem_target=%i\n",ogl_mem_target);
|
|
||||||
|
|
||||||
ogl_init();//platform specific initialization
|
ogl_init();//platform specific initialization
|
||||||
|
|
||||||
|
@ -422,8 +392,6 @@ int gr_init(int mode)
|
||||||
|
|
||||||
void gr_close()
|
void gr_close()
|
||||||
{
|
{
|
||||||
// mprintf((0,"ogl init: %s %s %s - %s\n",glGetString(GL_VENDOR),glGetString(GL_RENDERER),glGetString(GL_VERSION),glGetString,(GL_EXTENSIONS)));
|
|
||||||
|
|
||||||
ogl_close();//platform specific code
|
ogl_close();//platform specific code
|
||||||
if (grd_curscreen){
|
if (grd_curscreen){
|
||||||
if (grd_curscreen->sc_canvas.cv_bitmap.bm_data)
|
if (grd_curscreen->sc_canvas.cv_bitmap.bm_data)
|
||||||
|
@ -438,33 +406,28 @@ void gr_close()
|
||||||
extern int r_upixelc;
|
extern int r_upixelc;
|
||||||
void ogl_upixelc(int x, int y, int c){
|
void ogl_upixelc(int x, int y, int c){
|
||||||
r_upixelc++;
|
r_upixelc++;
|
||||||
// printf("gr_upixelc(%i,%i,%i)%i\n",x,y,c,Function_mode==FMODE_GAME);
|
|
||||||
// if(Function_mode != FMODE_GAME){
|
OGL_DISABLE(TEXTURE_2D);
|
||||||
// grd_curcanv->cv_bitmap.bm_data[y*grd_curscreen->sc_canvas.cv_bitmap.bm_w+x]=c;
|
glPointSize(1.0);
|
||||||
// }else{
|
glBegin(GL_POINTS);
|
||||||
OGL_DISABLE(TEXTURE_2D);
|
glColor3f(CPAL2Tr(c),CPAL2Tg(c),CPAL2Tb(c));
|
||||||
glPointSize(1.0);
|
glVertex2f((x+grd_curcanv->cv_bitmap.bm_x)/(float)last_width,1.0-(y+grd_curcanv->cv_bitmap.bm_y)/(float)last_height);
|
||||||
glBegin(GL_POINTS);
|
glEnd();
|
||||||
// glBegin(GL_LINES);
|
|
||||||
// ogl_pal=gr_current_pal;
|
|
||||||
glColor3f(CPAL2Tr(c),CPAL2Tg(c),CPAL2Tb(c));
|
|
||||||
// ogl_pal=gr_palette;
|
|
||||||
glVertex2f((x+grd_curcanv->cv_bitmap.bm_x)/(float)last_width,1.0-(y+grd_curcanv->cv_bitmap.bm_y)/(float)last_height);
|
|
||||||
// glVertex2f(x/((float)last_width+1),1.0-y/((float)last_height+1));
|
|
||||||
glEnd();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ogl_urect(int left,int top,int right,int bot){
|
void ogl_urect(int left,int top,int right,int bot){
|
||||||
GLfloat xo,yo,xf,yf;
|
GLfloat xo,yo,xf,yf;
|
||||||
int c=COLOR;
|
int c=COLOR;
|
||||||
|
|
||||||
xo=(left+grd_curcanv->cv_bitmap.bm_x)/(float)last_width;
|
xo=(left+grd_curcanv->cv_bitmap.bm_x)/(float)last_width;
|
||||||
xf=(right+grd_curcanv->cv_bitmap.bm_x)/(float)last_width;
|
xf = (right + 1 + grd_curcanv->cv_bitmap.bm_x) / (float)last_width;
|
||||||
yo=1.0-(top+grd_curcanv->cv_bitmap.bm_y)/(float)last_height;
|
yo=1.0-(top+grd_curcanv->cv_bitmap.bm_y)/(float)last_height;
|
||||||
yf=1.0-(bot+grd_curcanv->cv_bitmap.bm_y)/(float)last_height;
|
yf = 1.0 - (bot + 1 + grd_curcanv->cv_bitmap.bm_y) / (float)last_height;
|
||||||
|
|
||||||
OGL_DISABLE(TEXTURE_2D);
|
OGL_DISABLE(TEXTURE_2D);
|
||||||
glColor3f(CPAL2Tr(c),CPAL2Tg(c),CPAL2Tb(c));
|
if (Gr_scanline_darkening_level >= GR_FADE_LEVELS)
|
||||||
|
glColor3f(CPAL2Tr(c), CPAL2Tg(c), CPAL2Tb(c));
|
||||||
|
else
|
||||||
|
glColor4f(CPAL2Tr(c), CPAL2Tg(c), CPAL2Tb(c), 1.0 - (float)Gr_scanline_darkening_level / ((float)GR_FADE_LEVELS - 1.0));
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glVertex2f(xo,yo);
|
glVertex2f(xo,yo);
|
||||||
glVertex2f(xo,yf);
|
glVertex2f(xo,yf);
|
||||||
|
@ -472,6 +435,7 @@ void ogl_urect(int left,int top,int right,int bot){
|
||||||
glVertex2f(xf,yo);
|
glVertex2f(xf,yo);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ogl_ulinec(int left,int top,int right,int bot,int c){
|
void ogl_ulinec(int left,int top,int right,int bot,int c){
|
||||||
GLfloat xo,yo,xf,yf;
|
GLfloat xo,yo,xf,yf;
|
||||||
|
|
||||||
|
@ -491,21 +455,16 @@ void ogl_ulinec(int left,int top,int right,int bot,int c){
|
||||||
|
|
||||||
GLfloat last_r=0, last_g=0, last_b=0;
|
GLfloat last_r=0, last_g=0, last_b=0;
|
||||||
int do_pal_step=0;
|
int do_pal_step=0;
|
||||||
|
|
||||||
void ogl_do_palfx(void){
|
void ogl_do_palfx(void){
|
||||||
// GLfloat r,g,b,a;
|
|
||||||
OGL_DISABLE(TEXTURE_2D);
|
OGL_DISABLE(TEXTURE_2D);
|
||||||
if (gr_palette_faded_out){
|
if (gr_palette_faded_out){
|
||||||
/* glEnable(GL_BLEND);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
|
|
||||||
glColor3f(0,0,0);
|
glColor3f(0,0,0);
|
||||||
// r=g=b=0.0;a=1.0;
|
|
||||||
}else{
|
}else{
|
||||||
if (do_pal_step){
|
if (do_pal_step){
|
||||||
//glBlendFunc(GL_SRC_COLOR, GL_DST_COLOR);
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_ONE,GL_ONE);
|
glBlendFunc(GL_ONE,GL_ONE);
|
||||||
glColor3f(last_r,last_g,last_b);
|
glColor3f(last_r,last_g,last_b);
|
||||||
// r=f2fl(last_r);g=f2fl(last_g);b=f2fl(last_b);a=0.5;
|
|
||||||
}else
|
}else
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -517,7 +476,6 @@ void ogl_do_palfx(void){
|
||||||
glVertex2f(1,1);
|
glVertex2f(1,1);
|
||||||
glVertex2f(1,0);
|
glVertex2f(1,0);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
}
|
}
|
||||||
|
@ -532,13 +490,6 @@ void gr_palette_step_up( int r, int g, int b )
|
||||||
{
|
{
|
||||||
if (gr_palette_faded_out) return;
|
if (gr_palette_faded_out) return;
|
||||||
|
|
||||||
// if ( (r==last_r) && (g==last_g) && (b==last_b) ) return;
|
|
||||||
|
|
||||||
/* last_r = r/63.0;
|
|
||||||
last_g = g/63.0;
|
|
||||||
last_b = b/63.0;
|
|
||||||
do_pal_step=(r || g || b);*/
|
|
||||||
|
|
||||||
last_r = (r+gr_palette_gamma)/63.0;
|
last_r = (r+gr_palette_gamma)/63.0;
|
||||||
last_g = (g+gr_palette_gamma)/63.0;
|
last_g = (g+gr_palette_gamma)/63.0;
|
||||||
last_b = (b+gr_palette_gamma)/63.0;
|
last_b = (b+gr_palette_gamma)/63.0;
|
||||||
|
@ -547,45 +498,34 @@ void gr_palette_step_up( int r, int g, int b )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//added on 980913 by adb to fix palette problems
|
|
||||||
// need a min without side effects...
|
|
||||||
#undef min
|
#undef min
|
||||||
static inline int min(int x, int y) { return x < y ? x : y; }
|
static inline int min(int x, int y) { return x < y ? x : y; }
|
||||||
//end changes by adb
|
|
||||||
|
|
||||||
void gr_palette_load( ubyte *pal )
|
void gr_palette_load( ubyte *pal )
|
||||||
{
|
{
|
||||||
int i;//, j;
|
int i;//, j;
|
||||||
|
|
||||||
|
for (i=0; i<768; i++ ) {
|
||||||
|
gr_current_pal[i] = pal[i];
|
||||||
|
if (gr_current_pal[i] > 63) gr_current_pal[i] = 63;
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0; i<768; i++ ) {
|
gr_palette_faded_out=0;
|
||||||
gr_current_pal[i] = pal[i];
|
init_computed_colors();
|
||||||
if (gr_current_pal[i] > 63) gr_current_pal[i] = 63;
|
|
||||||
}
|
|
||||||
//palette = screen->format->palette;
|
|
||||||
|
|
||||||
gr_palette_faded_out=0;
|
|
||||||
|
|
||||||
init_computed_colors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int gr_palette_fade_out(ubyte *pal, int nsteps, int allow_keys)
|
int gr_palette_fade_out(ubyte *pal, int nsteps, int allow_keys)
|
||||||
{
|
{
|
||||||
gr_palette_faded_out=1;
|
gr_palette_faded_out=1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int gr_palette_fade_in(ubyte *pal, int nsteps, int allow_keys)
|
int gr_palette_fade_in(ubyte *pal, int nsteps, int allow_keys)
|
||||||
{
|
{
|
||||||
gr_palette_faded_out=0;
|
gr_palette_faded_out=0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gr_palette_read(ubyte * pal)
|
void gr_palette_read(ubyte * pal)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -646,7 +586,6 @@ void write_bmp(char *savename,int w,int h,unsigned char *buf){ // ZICO - modifie
|
||||||
|
|
||||||
void save_screen_shot(int automap_flag)
|
void save_screen_shot(int automap_flag)
|
||||||
{
|
{
|
||||||
// fix t1;
|
|
||||||
char message[100];
|
char message[100];
|
||||||
static int savenum=0;
|
static int savenum=0;
|
||||||
char savename[13];
|
char savename[13];
|
||||||
|
@ -660,7 +599,6 @@ void save_screen_shot(int automap_flag)
|
||||||
|
|
||||||
stop_time();
|
stop_time();
|
||||||
|
|
||||||
//added/changed on 10/31/98 by Victor Rachels to fix overwrite each new game
|
|
||||||
if ( savenum == 9999 ) savenum = 0;
|
if ( savenum == 9999 ) savenum = 0;
|
||||||
sprintf(savename,"scrn%04d.tga",savenum++);
|
sprintf(savename,"scrn%04d.tga",savenum++);
|
||||||
|
|
||||||
|
@ -670,19 +608,15 @@ void save_screen_shot(int automap_flag)
|
||||||
sprintf(savename,"scrn%04d.tga",savenum++);
|
sprintf(savename,"scrn%04d.tga",savenum++);
|
||||||
}
|
}
|
||||||
sprintf( message, "%s '%s'", TXT_DUMPING_SCREEN, savename );
|
sprintf( message, "%s '%s'", TXT_DUMPING_SCREEN, savename );
|
||||||
//end this section addition/change - Victor Rachels
|
|
||||||
|
|
||||||
if (automap_flag) {
|
if (!automap_flag) {
|
||||||
} else {
|
|
||||||
hud_message(MSGC_GAME_FEEDBACK,message);
|
hud_message(MSGC_GAME_FEEDBACK,message);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = malloc(grd_curscreen->sc_w*grd_curscreen->sc_h*3);
|
buf = malloc(grd_curscreen->sc_w*grd_curscreen->sc_h*3);
|
||||||
glReadBuffer(GL_FRONT);
|
glReadBuffer(GL_FRONT);
|
||||||
//glReadPixels(0,0,grd_curscreen->sc_w,grd_curscreen->sc_h,GL_RGB,GL_UNSIGNED_BYTE,buf);
|
|
||||||
write_bmp(savename,grd_curscreen->sc_w,grd_curscreen->sc_h,buf);
|
write_bmp(savename,grd_curscreen->sc_w,grd_curscreen->sc_h,buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
key_flush();
|
key_flush();
|
||||||
start_time();
|
start_time();
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ int ogl_texture_stats(void){
|
||||||
// grabbed++;
|
// grabbed++;
|
||||||
}
|
}
|
||||||
if (gr_renderstats){
|
if (gr_renderstats){
|
||||||
gr_printf(5,GAME_FONT->ft_h*14+3*14,"%i(%i,%i) %iK(%iK wasted)",used,usedrgba,usedl4a4,truebytes/1024,(truebytes-databytes)/1024);
|
gr_printf(5,FONTSCALE_Y(GAME_FONT->ft_h*14+3*14),"%i(%i,%i) %iK(%iK wasted)",used,usedrgba,usedl4a4,truebytes/1024,(truebytes-databytes)/1024);
|
||||||
}
|
}
|
||||||
// glmprintf((0,"ogl tex stats: %i(%i,%i|%i,%i,%i,%i,%i) %i(%i)b (%i(%i)wasted)\n",used,usedrgba,usedl4a4,prio0,prio1,prio2,prio3,prioh,truebytes,truetexel,truebytes-databytes,truetexel-datatexel));
|
// glmprintf((0,"ogl tex stats: %i(%i,%i|%i,%i,%i,%i,%i) %i(%i)b (%i(%i)wasted)\n",used,usedrgba,usedl4a4,prio0,prio1,prio2,prio3,prioh,truebytes,truetexel,truebytes-databytes,truetexel-datatexel));
|
||||||
return truebytes;
|
return truebytes;
|
||||||
|
@ -1179,7 +1179,7 @@ void ogl_end_frame(void){
|
||||||
void ogl_swap_buffers(void){
|
void ogl_swap_buffers(void){
|
||||||
ogl_clean_texture_cache();
|
ogl_clean_texture_cache();
|
||||||
if (gr_renderstats){
|
if (gr_renderstats){
|
||||||
gr_printf(5,GAME_FONT->ft_h*13+3*13,"%i flat %i tex %i sprites %i bitmaps",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc);
|
gr_printf(5,FONTSCALE_Y(GAME_FONT->ft_h*13+3*13),"%i flat %i tex %i sprites %i bitmaps",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc);
|
||||||
// glmprintf((0,"ogl_end_frame: %i polys, %i tmaps, %i sprites, %i bitmaps, %i bitblts, %i pixels\n",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc,r_ubitbltc,r_upixelc));//we need to do it here because some things get drawn after end_frame
|
// glmprintf((0,"ogl_end_frame: %i polys, %i tmaps, %i sprites, %i bitmaps, %i bitblts, %i pixels\n",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc,r_ubitbltc,r_upixelc));//we need to do it here because some things get drawn after end_frame
|
||||||
}
|
}
|
||||||
ogl_do_palfx();
|
ogl_do_palfx();
|
||||||
|
|
|
@ -69,7 +69,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "newmenu.h"
|
#include "newmenu.h"
|
||||||
#include "cntrlcen.h"
|
#include "cntrlcen.h"
|
||||||
|
|
||||||
#include "d_delay.h"
|
#include "d_delay.h"
|
||||||
#include "automap.h"
|
#include "automap.h"
|
||||||
|
|
||||||
|
@ -130,7 +129,6 @@ void init_automap_colors(void)
|
||||||
Hostage_color = K_HOSTAGE_COLOR;
|
Hostage_color = K_HOSTAGE_COLOR;
|
||||||
Font_color_20 = K_FONT_COLOR_20;
|
Font_color_20 = K_FONT_COLOR_20;
|
||||||
Green_31 = K_GREEN_31;
|
Green_31 = K_GREEN_31;
|
||||||
|
|
||||||
White_63 = gr_find_closest_color_current(63,63,63);
|
White_63 = gr_find_closest_color_current(63,63,63);
|
||||||
Blue_48 = gr_find_closest_color_current(0,0,48);
|
Blue_48 = gr_find_closest_color_current(0,0,48);
|
||||||
Red_48 = gr_find_closest_color_current(48,0,0);
|
Red_48 = gr_find_closest_color_current(48,0,0);
|
||||||
|
@ -141,20 +139,20 @@ ubyte Automap_visited[MAX_SEGMENTS];
|
||||||
|
|
||||||
// Edge list variables
|
// Edge list variables
|
||||||
static int Num_edges=0;
|
static int Num_edges=0;
|
||||||
static int Max_edges; //set each frame
|
static int Max_edges; //set each frame
|
||||||
static int Highest_edge_index = -1;
|
static int Highest_edge_index = -1;
|
||||||
static Edge_info Edges[MAX_EDGES];
|
static Edge_info Edges[MAX_EDGES];
|
||||||
static short DrawingListBright[MAX_EDGES];
|
static short DrawingListBright[MAX_EDGES];
|
||||||
|
|
||||||
// Map movement defines
|
// Map movement defines
|
||||||
#define PITCH_DEFAULT 9000
|
#define PITCH_DEFAULT 9000
|
||||||
#define ZOOM_DEFAULT i2f(20*10)
|
#define ZOOM_DEFAULT i2f(20*10)
|
||||||
#define ZOOM_MIN_VALUE i2f(20*5)
|
#define ZOOM_MIN_VALUE i2f(20*5)
|
||||||
#define ZOOM_MAX_VALUE i2f(20*100)
|
#define ZOOM_MAX_VALUE i2f(20*100)
|
||||||
|
|
||||||
#define SLIDE_SPEED (350)
|
#define SLIDE_SPEED (350)
|
||||||
#define ZOOM_SPEED_FACTOR (500) //(1500)
|
#define ZOOM_SPEED_FACTOR (500)
|
||||||
#define ROT_SPEED_DIVISOR (115000)
|
#define ROT_SPEED_DIVISOR (115000)
|
||||||
|
|
||||||
// Screen anvas variables
|
// Screen anvas variables
|
||||||
#ifndef AUTOMAP_DIRECT_RENDER
|
#ifndef AUTOMAP_DIRECT_RENDER
|
||||||
|
@ -195,8 +193,8 @@ void automap_clear_visited()
|
||||||
Automap_visited[i] = 0;
|
Automap_visited[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
grs_canvas *name_canv;
|
grs_canvas *name_canv;
|
||||||
char name_level[128];
|
char name_level[128];
|
||||||
|
|
||||||
//print to canvas & double height
|
//print to canvas & double height
|
||||||
grs_canvas *print_to_canvas(char *s,grs_font *font, int fc, int bc)
|
grs_canvas *print_to_canvas(char *s,grs_font *font, int fc, int bc)
|
||||||
|
@ -266,7 +264,6 @@ void create_name_canv()
|
||||||
strcat(name_level, Current_level_name);
|
strcat(name_level, Current_level_name);
|
||||||
|
|
||||||
gr_set_fontcolor(BM_XRGB(0,31,0),-1);
|
gr_set_fontcolor(BM_XRGB(0,31,0),-1);
|
||||||
// name_canv = print_to_canvas(name_level,Gamefonts[GFONT_SMALL], BM_XRGB(0,31,0), -1);
|
|
||||||
gr_set_curfont((Gamefonts[GFONT_SMALL]));
|
gr_set_curfont((Gamefonts[GFONT_SMALL]));
|
||||||
gr_printf(5,5,"%s", name_level);
|
gr_printf(5,5,"%s", name_level);
|
||||||
}
|
}
|
||||||
|
@ -332,7 +329,7 @@ void draw_automap()
|
||||||
color = get_team(Player_num);
|
color = get_team(Player_num);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
color = Player_num; // Note link to above if!
|
color = Player_num; // Note link to above if!
|
||||||
|
|
||||||
gr_setcolor(gr_getcolor(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b));
|
gr_setcolor(gr_getcolor(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b));
|
||||||
draw_player(&Objects[Players[Player_num].objnum]);
|
draw_player(&Objects[Players[Player_num].objnum]);
|
||||||
|
@ -383,7 +380,6 @@ void draw_automap()
|
||||||
|
|
||||||
g3_end_frame();
|
g3_end_frame();
|
||||||
|
|
||||||
// gr_bitmapm(5, 5, &name_canv->cv_bitmap);
|
|
||||||
create_name_canv();
|
create_name_canv();
|
||||||
|
|
||||||
#ifdef OGL
|
#ifdef OGL
|
||||||
|
@ -401,12 +397,11 @@ void draw_automap()
|
||||||
|
|
||||||
extern void GameLoop(int, int );
|
extern void GameLoop(int, int );
|
||||||
extern int set_segment_depths(int start_seg, ubyte *segbuf);
|
extern int set_segment_depths(int start_seg, ubyte *segbuf);
|
||||||
extern int Current_display_mode;
|
|
||||||
u_int32_t automap_mode = SM(640,480);
|
u_int32_t automap_mode = SM(640,480);
|
||||||
int automap_width = 640;
|
int automap_width = 640;
|
||||||
int automap_height = 480;
|
int automap_height = 480;
|
||||||
int automap_use_game_res=1; // ZICO - should be better
|
int automap_use_game_res=1;
|
||||||
int nice_automap = 1; // ZICO - should be better (command-line switches deactivated)
|
int nice_automap = 1;
|
||||||
int Automap_active = 0;
|
int Automap_active = 0;
|
||||||
|
|
||||||
#define MAP_BACKGROUND_FILENAME "MAP.PCX"
|
#define MAP_BACKGROUND_FILENAME "MAP.PCX"
|
||||||
|
@ -463,8 +458,6 @@ void do_automap( int key_code ) {
|
||||||
automap_width=grd_curscreen->sc_canvas.cv_bitmap.bm_w;
|
automap_width=grd_curscreen->sc_canvas.cv_bitmap.bm_w;
|
||||||
automap_height=grd_curscreen->sc_canvas.cv_bitmap.bm_h;
|
automap_height=grd_curscreen->sc_canvas.cv_bitmap.bm_h;
|
||||||
|
|
||||||
// create_name_canv();
|
|
||||||
|
|
||||||
gr_palette_clear();
|
gr_palette_clear();
|
||||||
|
|
||||||
#ifndef AUTOMAP_DIRECT_RENDER
|
#ifndef AUTOMAP_DIRECT_RENDER
|
||||||
|
@ -613,8 +606,6 @@ void do_automap( int key_code ) {
|
||||||
case KEY_ALTED+KEY_PADENTER:
|
case KEY_ALTED+KEY_PADENTER:
|
||||||
gr_toggle_fullscreen_game();
|
gr_toggle_fullscreen_game();
|
||||||
break;
|
break;
|
||||||
//end addition -MM
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -673,8 +664,6 @@ void do_automap( int key_code ) {
|
||||||
t1 = t2;
|
t1 = t2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gr_free_canvas(name_canv); name_canv=NULL;
|
|
||||||
|
|
||||||
#ifndef AUTOMAP_DIRECT_RENDER
|
#ifndef AUTOMAP_DIRECT_RENDER
|
||||||
if (must_free_canvas)
|
if (must_free_canvas)
|
||||||
free(Page.cv_bitmap.bm_data);
|
free(Page.cv_bitmap.bm_data);
|
||||||
|
@ -709,7 +698,6 @@ void adjust_segment_limit(int SegmentLimit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_all_edges()
|
void draw_all_edges()
|
||||||
|
@ -733,7 +721,7 @@ void draw_all_edges()
|
||||||
|
|
||||||
if ( e->flags & EF_TOO_FAR) continue;
|
if ( e->flags & EF_TOO_FAR) continue;
|
||||||
|
|
||||||
if (e->flags&EF_FRONTIER) { // A line that is between what we have seen and what we haven't
|
if (e->flags&EF_FRONTIER) { // A line that is between what we have seen and what we haven't
|
||||||
if ( (!(e->flags&EF_SECRET))&&(e->color==Wall_normal_color))
|
if ( (!(e->flags&EF_SECRET))&&(e->color==Wall_normal_color))
|
||||||
continue; // If a line isn't secret and is normal color, then don't draw it
|
continue; // If a line isn't secret and is normal color, then don't draw it
|
||||||
}
|
}
|
||||||
|
@ -1074,7 +1062,6 @@ void add_unknown_segment_edges(segment *seg)
|
||||||
// Only add edges that have no children
|
// Only add edges that have no children
|
||||||
if (seg->children[sn] == -1) {
|
if (seg->children[sn] == -1) {
|
||||||
get_side_verts(vertex_list,segnum,sn);
|
get_side_verts(vertex_list,segnum,sn);
|
||||||
|
|
||||||
add_one_unknown_edge( vertex_list[0], vertex_list[1] );
|
add_one_unknown_edge( vertex_list[0], vertex_list[1] );
|
||||||
add_one_unknown_edge( vertex_list[1], vertex_list[2] );
|
add_one_unknown_edge( vertex_list[1], vertex_list[2] );
|
||||||
add_one_unknown_edge( vertex_list[2], vertex_list[3] );
|
add_one_unknown_edge( vertex_list[2], vertex_list[3] );
|
||||||
|
@ -1154,7 +1141,5 @@ void automap_build_edge_list()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mprintf( (0, "Automap used %d / %d edges\n", Num_edges, Max_edges ));
|
mprintf( (0, "Automap used %d / %d edges\n", Num_edges, Max_edges ));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
1677
main/game.c
1677
main/game.c
File diff suppressed because it is too large
Load diff
1595
main/gauges.c
1595
main/gauges.c
File diff suppressed because it is too large
Load diff
|
@ -142,21 +142,21 @@ void nm_draw_background(int x1, int y1, int x2, int y2 )
|
||||||
|
|
||||||
//scale the bevels to the res too. All the gwidth/height stuff is needed so that the corners have the correct angles at odd resolutions like 320x400 where the ratios are different for x and y
|
//scale the bevels to the res too. All the gwidth/height stuff is needed so that the corners have the correct angles at odd resolutions like 320x400 where the ratios are different for x and y
|
||||||
|
|
||||||
#ifdef OGL
|
// #ifdef OGL
|
||||||
gr_setcolor( BM_XRGB(1,1,1) );
|
// gr_setcolor( BM_XRGB(1,1,1) );
|
||||||
|
//
|
||||||
for (w=5*(GWIDTH/320.0);w>=0;w--)
|
// for (w=5*(GWIDTH/320.0);w>=0;w--)
|
||||||
gr_urect( x2-w+1, y1+w*((GHEIGHT/200.0)/(GWIDTH/320.0)), x2+1, y2-(GHEIGHT/200.0) );//right edge
|
// gr_urect( x2-w+1, y1+w*((GHEIGHT/200.0)/(GWIDTH/320.0)), x2+1, y2-(GHEIGHT/200.0) );//right edge
|
||||||
for (h=5*(GHEIGHT/200.0);h>=0;h--)
|
// for (h=5*(GHEIGHT/200.0);h>=0;h--)
|
||||||
gr_urect( x1+h*((GWIDTH/320.0)/(GHEIGHT/200.0)), y2+1, x2+1, y2-h+1 );//bottom edge
|
// gr_urect( x1+h*((GWIDTH/320.0)/(GHEIGHT/200.0)), y2+1, x2+1, y2-h+1 );//bottom edge
|
||||||
#else
|
// #else
|
||||||
gr_setcolor( BM_XRGB(0,0,0) );
|
gr_setcolor( BM_XRGB(0,0,0) );
|
||||||
|
|
||||||
for (w=5*(GWIDTH/320.0);w>=0;w--)
|
for (w=5*(GWIDTH/320.0);w>=0;w--)
|
||||||
gr_urect( x2-w, y1+w*((GHEIGHT/200.0)/(GWIDTH/320.0)), x2-w, y2-(GHEIGHT/200.0) );//right edge
|
gr_urect( x2-w, y1+w*((GHEIGHT/200.0)/(GWIDTH/320.0)), x2-w, y2-(GHEIGHT/200.0) );//right edge
|
||||||
for (h=5*(GHEIGHT/200.0);h>=0;h--)
|
for (h=5*(GHEIGHT/200.0);h>=0;h--)
|
||||||
gr_urect( x1+h*((GWIDTH/320.0)/(GHEIGHT/200.0)), y2-h, x2, y2-h );//bottom edge
|
gr_urect( x1+h*((GWIDTH/320.0)/(GHEIGHT/200.0)), y2-h, x2, y2-h );//bottom edge
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
Gr_scanline_darkening_level = GR_FADE_LEVELS;
|
Gr_scanline_darkening_level = GR_FADE_LEVELS;
|
||||||
|
|
161
main/radar.c
161
main/radar.c
|
@ -11,67 +11,12 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
||||||
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* $Source: /cvsroot/dxx-rebirth/d1x-rebirth/main/radar.c,v $
|
*
|
||||||
* $Revision: 1.1.1.1 $
|
|
||||||
* $Author: zicodxx $
|
|
||||||
* $Date: 2006/03/17 19:41:45 $
|
|
||||||
*
|
|
||||||
* Routines for drawing the radar.
|
* Routines for drawing the radar.
|
||||||
* .
|
|
||||||
*
|
|
||||||
* $Log: radar.c,v $
|
|
||||||
* Revision 1.1.1.1 2006/03/17 19:41:45 zicodxx
|
|
||||||
* initial import
|
|
||||||
*
|
*
|
||||||
* Revision 1.2 1999/07/10 02:59:07 donut
|
|
||||||
* more from orulz
|
|
||||||
*
|
|
||||||
* Revision 1.1.1.1 1999/06/14 22:11:14 donut
|
|
||||||
* Import of d1x 1.37 source.
|
|
||||||
*
|
|
||||||
* Revision 1.10 1995/02/27 12:31:15 john
|
|
||||||
* Version 2.0.
|
|
||||||
*
|
|
||||||
* Revision 1.9 1995/02/01 21:03:36 john
|
|
||||||
* Lintified.
|
|
||||||
*
|
|
||||||
* Revision 1.8 1994/08/12 22:41:28 john
|
|
||||||
* Took away Player_stats; add Players array.
|
|
||||||
*
|
|
||||||
* Revision 1.7 1994/07/15 09:38:00 john
|
|
||||||
* Moved in radar_farthest_dist.
|
|
||||||
*
|
|
||||||
* Revision 1.6 1994/07/14 22:05:57 john
|
|
||||||
* Made radar display not conflict with hostage
|
|
||||||
* vclip talking.
|
|
||||||
*
|
|
||||||
* Revision 1.5 1994/07/12 18:41:51 yuan
|
|
||||||
* Tweaked location of radar and hostage screen...
|
|
||||||
* Still needs work.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Revision 1.4 1994/07/07 14:59:00 john
|
|
||||||
* Made radar powerups.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Revision 1.3 1994/07/07 10:05:36 john
|
|
||||||
* Pegged objects in radar to edges.
|
|
||||||
*
|
|
||||||
* Revision 1.2 1994/07/06 19:36:33 john
|
|
||||||
* Initial version of radar.
|
|
||||||
*
|
|
||||||
* Revision 1.1 1994/07/06 17:22:07 john
|
|
||||||
* Initial revision
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef RCS
|
|
||||||
static char rcsid[] = "$Id: radar.c,v 1.1.1.1 2006/03/17 19:41:45 zicodxx Exp $";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
@ -90,16 +35,9 @@ static char rcsid[] = "$Id: radar.c,v 1.1.1.1 2006/03/17 19:41:45 zicodxx Exp $"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "gauges.h"
|
#include "gauges.h"
|
||||||
|
|
||||||
//added/moved on 9/17/98 by Victor Rachels - radar toggle
|
|
||||||
int show_radar=0;
|
int show_radar=0;
|
||||||
//end this section
|
|
||||||
//added on 11/12/98 by Victor Rachels for Network radar
|
|
||||||
int Network_allow_radar=0;
|
int Network_allow_radar=0;
|
||||||
//end this section
|
|
||||||
|
|
||||||
//changed 7/5/99 - Owen Evans - radar resizes with screen size
|
|
||||||
short Hostage_monitor_size, Hostage_monitor_x, Hostage_monitor_y;
|
short Hostage_monitor_size, Hostage_monitor_x, Hostage_monitor_y;
|
||||||
//end changed - OE
|
|
||||||
|
|
||||||
static fix radx, rady, rox, roy, cenx, ceny;
|
static fix radx, rady, rox, roy, cenx, ceny;
|
||||||
|
|
||||||
|
@ -112,10 +50,7 @@ typedef struct blip {
|
||||||
|
|
||||||
blip Blips[MAX_BLIPS];
|
blip Blips[MAX_BLIPS];
|
||||||
int N_blips = 0;
|
int N_blips = 0;
|
||||||
|
|
||||||
fix Radar_farthest_dist = (F1_0 * 20 * 15); // 15 segments away
|
fix Radar_farthest_dist = (F1_0 * 20 * 15); // 15 segments away
|
||||||
//fix Radar_farthest_dist = (F1_0 * 20 * 8); // 8 segments away
|
|
||||||
|
|
||||||
|
|
||||||
void radar_plot_object( object * objp, int hue )
|
void radar_plot_object( object * objp, int hue )
|
||||||
{
|
{
|
||||||
|
@ -156,29 +91,27 @@ void radar_render_frame()
|
||||||
int i,color;
|
int i,color;
|
||||||
object * objp;
|
object * objp;
|
||||||
|
|
||||||
// added 7/5/99 - Owen Evans - radar resizes with screen size
|
switch (Cockpit_mode)
|
||||||
switch (Cockpit_mode)
|
{
|
||||||
{
|
case CM_FULL_SCREEN:
|
||||||
case CM_FULL_SCREEN:
|
Hostage_monitor_size = Game_window_w / 6;
|
||||||
Hostage_monitor_size = Game_window_w / 6;
|
Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2;
|
||||||
Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2;
|
Hostage_monitor_y = (grd_curscreen->sc_h - Game_window_h) / 2;
|
||||||
Hostage_monitor_y = (grd_curscreen->sc_h - Game_window_h) / 2;
|
break;
|
||||||
break;
|
case CM_FULL_COCKPIT:
|
||||||
case CM_FULL_COCKPIT:
|
Hostage_monitor_size = 40*(SHEIGHT/200);
|
||||||
Hostage_monitor_size = 40;
|
Hostage_monitor_x = 0;
|
||||||
Hostage_monitor_x = 0;
|
Hostage_monitor_y = 80*(SHEIGHT/200);
|
||||||
Hostage_monitor_y = 80;
|
break;
|
||||||
break;
|
case CM_STATUS_BAR:
|
||||||
case CM_STATUS_BAR:
|
Hostage_monitor_size = Game_window_w / 6;
|
||||||
Hostage_monitor_size = Game_window_w / 6;
|
Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2;
|
||||||
Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2;
|
Hostage_monitor_y = (max_window_h - Game_window_h) / 2;
|
||||||
Hostage_monitor_y = (max_window_h - Game_window_h) / 2;
|
break;
|
||||||
break;
|
case CM_REAR_VIEW: //no radar in rear view or letterbox!
|
||||||
case CM_REAR_VIEW: //no radar in rear view or letterbox!
|
case CM_LETTERBOX:
|
||||||
case CM_LETTERBOX:
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
//end added - OE
|
|
||||||
|
|
||||||
if (hostage_is_vclip_playing())
|
if (hostage_is_vclip_playing())
|
||||||
return;
|
return;
|
||||||
|
@ -189,25 +122,15 @@ void radar_render_frame()
|
||||||
|
|
||||||
gr_ucircle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2), i2f(Hostage_monitor_size)/2);
|
gr_ucircle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2), i2f(Hostage_monitor_size)/2);
|
||||||
|
|
||||||
//other stuff added 9/14/98 by Victor Rachels for fun.
|
//other stuff added 9/14/98 by Victor Rachels for fun.
|
||||||
gr_circle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2), i2f(Hostage_monitor_size) / 8 );
|
gr_circle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2), i2f(Hostage_monitor_size) / 8 );
|
||||||
gr_upixel((Hostage_monitor_x+Hostage_monitor_size/2), (Hostage_monitor_y+Hostage_monitor_size/2) );
|
gr_upixel((Hostage_monitor_x+Hostage_monitor_size/2), (Hostage_monitor_y+Hostage_monitor_size/2) );
|
||||||
gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2));
|
gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2));
|
||||||
gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2));
|
gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2));
|
||||||
|
|
||||||
|
|
||||||
//killed 7/5/99 - Owen Evans - make radar much more useable
|
|
||||||
// // Erase old blips
|
|
||||||
// for (i=0; i<N_blips; i++ ) {
|
|
||||||
// gr_setcolor(gr_gpixel( &GameBitmaps[cockpit_bitmap[0].index], Blips[i].x, Blips[i].y ));
|
|
||||||
// gr_upixel( Blips[i].x, Blips[i].y );
|
|
||||||
// }
|
|
||||||
//end killed - OE
|
|
||||||
|
|
||||||
N_blips = 0;
|
N_blips = 0;
|
||||||
|
|
||||||
// if ( !(Players[Player_num].flags & (PLAYER_FLAGS_RADAR_ENEMIES | PLAYER_FLAGS_RADAR_POWERUPS )) ) return;
|
|
||||||
|
|
||||||
radx = i2f(Hostage_monitor_size*4)/2;
|
radx = i2f(Hostage_monitor_size*4)/2;
|
||||||
rady = i2f(Hostage_monitor_size*4)/2;
|
rady = i2f(Hostage_monitor_size*4)/2;
|
||||||
cenx = i2f(Hostage_monitor_x)+i2f(Hostage_monitor_size)/2;
|
cenx = i2f(Hostage_monitor_x)+i2f(Hostage_monitor_size)/2;
|
||||||
|
@ -230,23 +153,19 @@ void radar_render_frame()
|
||||||
radar_plot_object( objp, gr_getcolor(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b) );
|
radar_plot_object( objp, gr_getcolor(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OBJ_HOSTAGE:
|
case OBJ_HOSTAGE:
|
||||||
radar_plot_object( objp, BM_XRGB(0,31,0) );
|
radar_plot_object( objp, BM_XRGB(0,31,0) );
|
||||||
break;
|
break;
|
||||||
case OBJ_POWERUP:
|
case OBJ_POWERUP:
|
||||||
//if ( Players[Player_num].flags & PLAYER_FLAGS_RADAR_POWERUPS )
|
if(!(Game_mode & GM_MULTI))
|
||||||
if(!(Game_mode & GM_MULTI))
|
radar_plot_object( objp, BM_XRGB(0,0,31) );
|
||||||
radar_plot_object( objp, BM_XRGB(0,0,31) );
|
break;
|
||||||
break;
|
case OBJ_ROBOT:
|
||||||
case OBJ_ROBOT:
|
radar_plot_object( objp, BM_XRGB(31,0,0) );
|
||||||
// //if ( Players[Player_num].flags & PLAYER_FLAGS_RADAR_ENEMIES )
|
break;
|
||||||
radar_plot_object( objp, BM_XRGB(31,0,0) );
|
case OBJ_CNTRLCEN:
|
||||||
break;
|
radar_plot_object( objp, BM_XRGB(31,31,31) );
|
||||||
// added 7/5/99 - Owen Evans - reactor is now shown on radar
|
break;
|
||||||
case OBJ_CNTRLCEN:
|
|
||||||
radar_plot_object( objp, BM_XRGB(31,31,31) );
|
|
||||||
break;
|
|
||||||
// end added - OE
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
577
main/weapon.c
577
main/weapon.c
|
@ -11,199 +11,12 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
||||||
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* $Source: /cvsroot/dxx-rebirth/d1x-rebirth/main/weapon.c,v $
|
*
|
||||||
* $Revision: 1.1.1.1 $
|
|
||||||
* $Author: zicodxx $
|
|
||||||
* $Date: 2006/03/17 19:44:46 $
|
|
||||||
*
|
|
||||||
* Functions for weapons...
|
* Functions for weapons...
|
||||||
*
|
|
||||||
* $Log: weapon.c,v $
|
|
||||||
* Revision 1.1.1.1 2006/03/17 19:44:46 zicodxx
|
|
||||||
* initial import
|
|
||||||
*
|
*
|
||||||
* Revision 1.1.1.1 1999/06/14 22:12:04 donut
|
|
||||||
* Import of d1x 1.37 source.
|
|
||||||
*
|
|
||||||
* Revision 2.1 1995/03/21 14:38:43 john
|
|
||||||
* Ifdef'd out the NETWORK code.
|
|
||||||
*
|
|
||||||
* Revision 2.0 1995/02/27 11:27:25 john
|
|
||||||
* New version 2.0, which has no anonymous unions, builds with
|
|
||||||
* Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
|
|
||||||
*
|
|
||||||
* Revision 1.54 1995/02/15 15:21:48 mike
|
|
||||||
* make smart missile select if mega missiles used up.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Revision 1.53 1995/02/12 02:12:30 john
|
|
||||||
* Fixed bug with state restore making weapon beeps.
|
|
||||||
*
|
|
||||||
* Revision 1.52 1995/02/09 20:42:15 mike
|
|
||||||
* change weapon autoselect, always autoselect smart, mega.
|
|
||||||
*
|
|
||||||
* Revision 1.51 1995/02/07 20:44:26 mike
|
|
||||||
* autoselect mega, smart when you pick them up.
|
|
||||||
*
|
|
||||||
* Revision 1.50 1995/02/07 13:32:25 rob
|
|
||||||
* Added include of multi.h
|
|
||||||
*
|
|
||||||
* Revision 1.49 1995/02/07 13:21:33 yuan
|
|
||||||
* Fixed 2nd typo
|
|
||||||
*
|
|
||||||
* Revision 1.48 1995/02/07 13:16:39 yuan
|
|
||||||
* Fixed typo.
|
|
||||||
*
|
|
||||||
* Revision 1.47 1995/02/07 12:53:12 rob
|
|
||||||
* Added network sound prop. to weapon switch.
|
|
||||||
*
|
|
||||||
* Revision 1.46 1995/02/06 15:53:17 mike
|
|
||||||
* don't autoselect smart or mega missile when you pick it up.
|
|
||||||
*
|
|
||||||
* Revision 1.45 1995/02/02 21:43:34 mike
|
|
||||||
* make autoselection better.
|
|
||||||
*
|
|
||||||
* Revision 1.44 1995/02/02 16:27:21 mike
|
|
||||||
* make concussion missiles trade up.
|
|
||||||
*
|
|
||||||
* Revision 1.43 1995/02/01 23:34:57 adam
|
|
||||||
* messed with weapon change sounds
|
|
||||||
*
|
|
||||||
* Revision 1.42 1995/02/01 17:12:47 mike
|
|
||||||
* Make smart missile, mega missile not auto-select.
|
|
||||||
*
|
|
||||||
* Revision 1.41 1995/02/01 15:50:54 mike
|
|
||||||
* fix bogus weapon selection sound code.
|
|
||||||
*
|
|
||||||
* Revision 1.40 1995/01/31 16:16:31 mike
|
|
||||||
* Separate smart blobs for robot and player.
|
|
||||||
*
|
|
||||||
* Revision 1.39 1995/01/30 21:12:11 mike
|
|
||||||
* Use new weapon selection sounds, different for primary and secondary.
|
|
||||||
*
|
|
||||||
* Revision 1.38 1995/01/29 13:46:52 mike
|
|
||||||
* Don't auto-select fusion cannon when you run out of energy.
|
|
||||||
*
|
|
||||||
* Revision 1.37 1995/01/20 11:11:13 allender
|
|
||||||
* record weapon changes again. (John somehow lost my 1.35 changes).
|
|
||||||
*
|
|
||||||
* Revision 1.36 1995/01/19 17:00:46 john
|
|
||||||
* Made save game work between levels.
|
|
||||||
*
|
|
||||||
* Revision 1.34 1995/01/09 17:03:48 mike
|
|
||||||
* fix autoselection of weapons.
|
|
||||||
*
|
|
||||||
* Revision 1.33 1995/01/05 15:46:31 john
|
|
||||||
* Made weapons not rearm when starting a saved game.
|
|
||||||
*
|
|
||||||
* Revision 1.32 1995/01/03 12:34:23 mike
|
|
||||||
* autoselect next lower weapon if run out of smart or mega missile.
|
|
||||||
*
|
|
||||||
* Revision 1.31 1994/12/12 21:39:37 matt
|
|
||||||
* Changed vulcan ammo: 10K max, 5K w/weapon, 1250 per powerup
|
|
||||||
*
|
|
||||||
* Revision 1.30 1994/12/09 19:55:04 matt
|
|
||||||
* Added weapon name in "not available in shareware" message
|
|
||||||
*
|
|
||||||
* Revision 1.29 1994/12/06 13:50:24 adam
|
|
||||||
* added shareware msg. when choosing 4 top weapons
|
|
||||||
*
|
|
||||||
* Revision 1.28 1994/12/02 22:07:13 mike
|
|
||||||
* if you gots 19 concussion missiles and you runs over 4, say you picks up 1, not 4, we do the math, see?
|
|
||||||
*
|
|
||||||
* Revision 1.27 1994/12/02 20:06:24 matt
|
|
||||||
* Made vulcan ammo print at approx 25 times actual
|
|
||||||
*
|
|
||||||
* Revision 1.26 1994/12/02 15:05:03 matt
|
|
||||||
* Fixed bogus weapon constants and arrays
|
|
||||||
*
|
|
||||||
* Revision 1.25 1994/12/02 10:50:34 yuan
|
|
||||||
* Localization
|
|
||||||
*
|
|
||||||
* Revision 1.24 1994/11/29 15:48:28 matt
|
|
||||||
* selecting weapon now makes sound
|
|
||||||
*
|
|
||||||
* Revision 1.23 1994/11/28 11:26:58 matt
|
|
||||||
* Cleaned up hud message printing for picking up weapons
|
|
||||||
*
|
|
||||||
* Revision 1.22 1994/11/27 23:13:39 matt
|
|
||||||
* Made changes for new mprintf calling convention
|
|
||||||
*
|
|
||||||
* Revision 1.21 1994/11/12 16:38:34 mike
|
|
||||||
* clean up default ammo stuff.
|
|
||||||
*
|
|
||||||
* Revision 1.20 1994/11/07 17:41:18 mike
|
|
||||||
* messages for when you try to fire a weapon you don't have or don't have ammo for.
|
|
||||||
*
|
|
||||||
* Revision 1.19 1994/10/21 20:40:05 mike
|
|
||||||
* fix double vulcan ammo.
|
|
||||||
*
|
|
||||||
* Revision 1.18 1994/10/20 09:49:05 mike
|
|
||||||
* kill messages no one liked...*sniff* *sniff*
|
|
||||||
*
|
|
||||||
* Revision 1.17 1994/10/19 11:17:07 mike
|
|
||||||
* Limit amount of player ammo.
|
|
||||||
*
|
|
||||||
* Revision 1.16 1994/10/12 08:04:18 mike
|
|
||||||
* Fix proximity/homing confusion.
|
|
||||||
*
|
|
||||||
* Revision 1.15 1994/10/11 18:27:58 matt
|
|
||||||
* Changed auto selection of secondary weapons
|
|
||||||
*
|
|
||||||
* Revision 1.14 1994/10/08 23:37:54 matt
|
|
||||||
* Don't pick up weapons you already have; also fixed auto_select bug
|
|
||||||
* for seconary weapons
|
|
||||||
*
|
|
||||||
* Revision 1.13 1994/10/08 14:55:47 matt
|
|
||||||
* Fixed bug that selected vulcan cannon when picked up ammo, even though
|
|
||||||
* you didn't have the weapon.
|
|
||||||
*
|
|
||||||
* Revision 1.12 1994/10/08 12:50:32 matt
|
|
||||||
* Fixed bug that let you select weapons you don't have
|
|
||||||
*
|
|
||||||
* Revision 1.11 1994/10/07 23:37:56 matt
|
|
||||||
* Made weapons select when pick up better one
|
|
||||||
*
|
|
||||||
* Revision 1.10 1994/10/07 16:02:08 matt
|
|
||||||
* Fixed problem with weapon auto-select
|
|
||||||
*
|
|
||||||
* Revision 1.9 1994/10/05 17:00:20 matt
|
|
||||||
* Made player_has_weapon() public and moved constants to header file
|
|
||||||
*
|
|
||||||
* Revision 1.8 1994/09/26 11:27:13 mike
|
|
||||||
* Fix auto selection of weapon when you run out of ammo.
|
|
||||||
*
|
|
||||||
* Revision 1.7 1994/09/13 16:40:45 mike
|
|
||||||
* Add rearm delay and missile firing delay.
|
|
||||||
*
|
|
||||||
* Revision 1.6 1994/09/13 14:43:12 matt
|
|
||||||
* Added cockpit weapon displays
|
|
||||||
*
|
|
||||||
* Revision 1.5 1994/09/03 15:23:06 mike
|
|
||||||
* Auto select next weaker weapon when one runs out, clean up code.
|
|
||||||
*
|
|
||||||
* Revision 1.4 1994/09/02 16:38:19 mike
|
|
||||||
* Eliminate a pile of arrays, associate weapon data with Weapon_info.
|
|
||||||
*
|
|
||||||
* Revision 1.3 1994/09/02 11:57:10 mike
|
|
||||||
* Add a bunch of stuff, I forget what.
|
|
||||||
*
|
|
||||||
* Revision 1.2 1994/06/03 16:26:32 john
|
|
||||||
* Initial version.
|
|
||||||
*
|
|
||||||
* Revision 1.1 1994/06/03 14:40:43 john
|
|
||||||
* Initial revision
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef RCS
|
|
||||||
#pragma off (unreferenced)
|
|
||||||
static char rcsid[] = "$Id: weapon.c,v 1.1.1.1 2006/03/17 19:44:46 zicodxx Exp $";
|
|
||||||
#pragma on (unreferenced)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "weapon.h"
|
#include "weapon.h"
|
||||||
#include "mono.h"
|
#include "mono.h"
|
||||||
|
@ -217,54 +30,22 @@ static char rcsid[] = "$Id: weapon.c,v 1.1.1.1 2006/03/17 19:44:46 zicodxx Exp $
|
||||||
#include "multi.h"
|
#include "multi.h"
|
||||||
#include "reorder.h"
|
#include "reorder.h"
|
||||||
|
|
||||||
//#define FUSION_KEEPS_CHARGE
|
// Convert primary weapons to indices in Weapon_info array.
|
||||||
|
|
||||||
// Note, only Vulcan cannon requires ammo.
|
|
||||||
//ubyte Default_primary_ammo_level[MAX_PRIMARY_WEAPONS] = {255, 0, 255, 255, 255};
|
|
||||||
//ubyte Default_secondary_ammo_level[MAX_SECONDARY_WEAPONS] = {3, 0, 0, 0, 0};
|
|
||||||
|
|
||||||
// Convert primary weapons to indices in Weapon_info array.
|
|
||||||
ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS] = {0, 11, 12, 13, 14};
|
ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS] = {0, 11, 12, 13, 14};
|
||||||
ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS] = {8, 15, 16, 17, 18};
|
ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS] = {8, 15, 16, 17, 18};
|
||||||
|
|
||||||
int Primary_ammo_max[MAX_PRIMARY_WEAPONS] = {0, VULCAN_AMMO_MAX, 0, 0, 0};
|
int Primary_ammo_max[MAX_PRIMARY_WEAPONS] = {0, VULCAN_AMMO_MAX, 0, 0, 0};
|
||||||
ubyte Secondary_ammo_max[MAX_SECONDARY_WEAPONS] = {20, 10, 10, 5, 5};
|
ubyte Secondary_ammo_max[MAX_SECONDARY_WEAPONS] = {20, 10, 10, 5, 5};
|
||||||
|
|
||||||
weapon_info Weapon_info[MAX_WEAPON_TYPES];
|
weapon_info Weapon_info[MAX_WEAPON_TYPES];
|
||||||
int N_weapon_types=0;
|
int N_weapon_types=0;
|
||||||
byte Primary_weapon, Secondary_weapon;
|
byte Primary_weapon, Secondary_weapon;
|
||||||
|
|
||||||
//char *Primary_weapon_names[MAX_PRIMARY_WEAPONS] = {
|
char *Primary_weapon_names_short[MAX_PRIMARY_WEAPONS] = {
|
||||||
// "Laser Cannon",
|
"Laser",
|
||||||
// "Vulcan Cannon",
|
"Vulcan",
|
||||||
// "Spreadfire Cannon",
|
"Spread",
|
||||||
// "Plasma Cannon",
|
"Plasma",
|
||||||
// "Fusion Cannon"
|
"Fusion"
|
||||||
//};
|
};
|
||||||
|
|
||||||
//char *Secondary_weapon_names[MAX_SECONDARY_WEAPONS] = {
|
|
||||||
// "Concussion Missile",
|
|
||||||
// "Homing Missile",
|
|
||||||
// "Proximity Bomb",
|
|
||||||
// "Smart Missile",
|
|
||||||
// "Mega Missile"
|
|
||||||
//};
|
|
||||||
|
|
||||||
//char *Primary_weapon_names_short[MAX_PRIMARY_WEAPONS] = {
|
|
||||||
// "Laser",
|
|
||||||
// "Vulcan",
|
|
||||||
// "Spread",
|
|
||||||
// "Plasma",
|
|
||||||
// "Fusion"
|
|
||||||
//};
|
|
||||||
|
|
||||||
//char *Secondary_weapon_names_short[MAX_SECONDARY_WEAPONS] = {
|
|
||||||
// "Concsn\nMissile",
|
|
||||||
// "Homing\nMissile",
|
|
||||||
// "Proxim.\nBomb",
|
|
||||||
// "Smart\nMissile",
|
|
||||||
// "Mega\nMissile"
|
|
||||||
//};
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------
|
||||||
// Return:
|
// Return:
|
||||||
|
@ -284,37 +65,37 @@ int player_has_weapon(int weapon_num, int secondary_flag)
|
||||||
Players[Player_num].energy = 0;
|
Players[Player_num].energy = 0;
|
||||||
|
|
||||||
if (!secondary_flag) {
|
if (!secondary_flag) {
|
||||||
if(weapon_num >= MAX_PRIMARY_WEAPONS)
|
if(weapon_num >= MAX_PRIMARY_WEAPONS)
|
||||||
{
|
{
|
||||||
switch(weapon_num-MAX_PRIMARY_WEAPONS)
|
switch(weapon_num-MAX_PRIMARY_WEAPONS)
|
||||||
{
|
{
|
||||||
case 0 : if((Players[Player_num].laser_level != 0)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
case 0 : if((Players[Player_num].laser_level != 0)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 1 : if((Players[Player_num].laser_level != 1)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
case 1 : if((Players[Player_num].laser_level != 1)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 2 : if((Players[Player_num].laser_level != 2)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
case 2 : if((Players[Player_num].laser_level != 2)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 3 : if((Players[Player_num].laser_level != 3)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
case 3 : if((Players[Player_num].laser_level != 3)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 4 : if((Players[Player_num].laser_level != 0)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
case 4 : if((Players[Player_num].laser_level != 0)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 5 : if((Players[Player_num].laser_level != 1)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
case 5 : if((Players[Player_num].laser_level != 1)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 6 : if((Players[Player_num].laser_level != 2)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
case 6 : if((Players[Player_num].laser_level != 2)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 7 : if((Players[Player_num].laser_level != 3)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
case 7 : if((Players[Player_num].laser_level != 3)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS))
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
weapon_num = 0;
|
weapon_num = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
weapon_index = Primary_weapon_to_weapon_info[weapon_num];
|
weapon_index = Primary_weapon_to_weapon_info[weapon_num];
|
||||||
|
|
||||||
|
@ -324,18 +105,17 @@ int player_has_weapon(int weapon_num, int secondary_flag)
|
||||||
if (Weapon_info[weapon_index].ammo_usage <= Players[Player_num].primary_ammo[weapon_num])
|
if (Weapon_info[weapon_index].ammo_usage <= Players[Player_num].primary_ammo[weapon_num])
|
||||||
return_value |= HAS_AMMO_FLAG;
|
return_value |= HAS_AMMO_FLAG;
|
||||||
|
|
||||||
//added on 1/21/99 by Victor Rachels... yet another hack
|
//added on 1/21/99 by Victor Rachels... yet another hack
|
||||||
//fusion has 0 energy usage, HAS_ENERGY_FLAG was always true
|
//fusion has 0 energy usage, HAS_ENERGY_FLAG was always true
|
||||||
if(weapon_num==FUSION_INDEX)
|
if(weapon_num==FUSION_INDEX)
|
||||||
{
|
{
|
||||||
if(Players[Player_num].energy >= F1_0*2)
|
if(Players[Player_num].energy >= F1_0*2)
|
||||||
return_value |= HAS_ENERGY_FLAG;
|
return_value |= HAS_ENERGY_FLAG;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
//end this section addition - VR
|
//end this section addition - VR
|
||||||
if (Weapon_info[weapon_index].energy_usage <= Players[Player_num].energy)
|
if (Weapon_info[weapon_index].energy_usage <= Players[Player_num].energy)
|
||||||
return_value |= HAS_ENERGY_FLAG;
|
return_value |= HAS_ENERGY_FLAG;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
weapon_index = Secondary_weapon_to_weapon_info[weapon_num];
|
weapon_index = Secondary_weapon_to_weapon_info[weapon_num];
|
||||||
|
|
||||||
|
@ -348,13 +128,11 @@ int player_has_weapon(int weapon_num, int secondary_flag)
|
||||||
if (Weapon_info[weapon_index].energy_usage <= Players[Player_num].energy)
|
if (Weapon_info[weapon_index].energy_usage <= Players[Player_num].energy)
|
||||||
return_value |= HAS_ENERGY_FLAG;
|
return_value |= HAS_ENERGY_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------
|
||||||
//if message flag set, print message saying selected
|
// if message flag set, print message saying selected
|
||||||
void select_weapon(int weapon_num, int secondary_flag, int print_message, int wait_for_rearm)
|
void select_weapon(int weapon_num, int secondary_flag, int print_message, int wait_for_rearm)
|
||||||
{
|
{
|
||||||
char *weapon_name;
|
char *weapon_name;
|
||||||
|
@ -365,31 +143,31 @@ void select_weapon(int weapon_num, int secondary_flag, int print_message, int wa
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!secondary_flag) {
|
if (!secondary_flag) {
|
||||||
|
|
||||||
//added on 10/9/98 by Victor Rachels to add laser cycle
|
//added on 10/9/98 by Victor Rachels to add laser cycle
|
||||||
if (weapon_num >= MAX_PRIMARY_WEAPONS)
|
if (weapon_num >= MAX_PRIMARY_WEAPONS)
|
||||||
{
|
{
|
||||||
LaserPowSelected=weapon_num;
|
LaserPowSelected=weapon_num;
|
||||||
weapon_num = 0;
|
weapon_num = 0;
|
||||||
if(Primary_weapon==0)
|
if(Primary_weapon==0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (weapon_num == 0)
|
else if (weapon_num == 0)
|
||||||
LaserPowSelected=0;
|
LaserPowSelected=0;
|
||||||
//end this section addition
|
//end this section addition
|
||||||
|
|
||||||
if (Primary_weapon != weapon_num) {
|
if (Primary_weapon != weapon_num) {
|
||||||
#ifndef FUSION_KEEPS_CHARGE
|
#ifndef FUSION_KEEPS_CHARGE
|
||||||
//added 8/6/98 by Victor Rachels to fix fusion charge bug
|
//added 8/6/98 by Victor Rachels to fix fusion charge bug
|
||||||
Fusion_charge=0;
|
Fusion_charge=0;
|
||||||
//end edit - Victor Rachels
|
//end edit - Victor Rachels
|
||||||
#endif
|
#endif
|
||||||
if (wait_for_rearm) digi_play_sample_once( SOUND_GOOD_SELECTION_PRIMARY, F1_0 );
|
if (wait_for_rearm) digi_play_sample_once( SOUND_GOOD_SELECTION_PRIMARY, F1_0 );
|
||||||
#ifdef NETWORK
|
#ifdef NETWORK
|
||||||
if (Game_mode & GM_MULTI) {
|
if (Game_mode & GM_MULTI) {
|
||||||
if (wait_for_rearm) multi_send_play_sound(SOUND_GOOD_SELECTION_PRIMARY, F1_0);
|
if (wait_for_rearm) multi_send_play_sound(SOUND_GOOD_SELECTION_PRIMARY, F1_0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (wait_for_rearm)
|
if (wait_for_rearm)
|
||||||
Next_laser_fire_time = GameTime + REARM_TIME;
|
Next_laser_fire_time = GameTime + REARM_TIME;
|
||||||
else
|
else
|
||||||
|
@ -404,11 +182,11 @@ void select_weapon(int weapon_num, int secondary_flag, int print_message, int wa
|
||||||
|
|
||||||
if (Secondary_weapon != weapon_num) {
|
if (Secondary_weapon != weapon_num) {
|
||||||
if (wait_for_rearm) digi_play_sample_once( SOUND_GOOD_SELECTION_SECONDARY, F1_0 );
|
if (wait_for_rearm) digi_play_sample_once( SOUND_GOOD_SELECTION_SECONDARY, F1_0 );
|
||||||
#ifdef NETWORK
|
#ifdef NETWORK
|
||||||
if (Game_mode & GM_MULTI) {
|
if (Game_mode & GM_MULTI) {
|
||||||
if (wait_for_rearm) multi_send_play_sound(SOUND_GOOD_SELECTION_PRIMARY, F1_0);
|
if (wait_for_rearm) multi_send_play_sound(SOUND_GOOD_SELECTION_PRIMARY, F1_0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (wait_for_rearm)
|
if (wait_for_rearm)
|
||||||
Next_missile_fire_time = GameTime + REARM_TIME;
|
Next_missile_fire_time = GameTime + REARM_TIME;
|
||||||
else
|
else
|
||||||
|
@ -424,9 +202,7 @@ void select_weapon(int weapon_num, int secondary_flag, int print_message, int wa
|
||||||
if (print_message)
|
if (print_message)
|
||||||
hud_message(MSGC_WEAPON_SELECT, "%s %s", weapon_name, TXT_SELECTED);
|
hud_message(MSGC_WEAPON_SELECT, "%s %s", weapon_name, TXT_SELECTED);
|
||||||
|
|
||||||
//added on 2/8/99 by Victor Rachels to add allweapon hud info
|
gauge_update_hud_mode=1;
|
||||||
gauge_update_hud_mode=1;
|
|
||||||
//end this section additon - VR
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------
|
||||||
|
@ -434,32 +210,25 @@ void select_weapon(int weapon_num, int secondary_flag, int print_message, int wa
|
||||||
void do_weapon_select(int weapon_num, int secondary_flag)
|
void do_weapon_select(int weapon_num, int secondary_flag)
|
||||||
{
|
{
|
||||||
//added on 10/9/98 by Victor Rachels to add laser cycle
|
//added on 10/9/98 by Victor Rachels to add laser cycle
|
||||||
int oweapon = weapon_num;
|
int oweapon = weapon_num;
|
||||||
//end this section addition - Victor Rachels
|
//end this section addition - Victor Rachels
|
||||||
int weapon_status = player_has_weapon(weapon_num, secondary_flag);
|
int weapon_status = player_has_weapon(weapon_num, secondary_flag);
|
||||||
char *weapon_name;
|
char *weapon_name;
|
||||||
|
|
||||||
|
|
||||||
#ifdef SHAREWARE // do special hud msg. for picking registered weapon in shareware version.
|
#ifdef SHAREWARE // do special hud msg. for picking registered weapon in shareware version.
|
||||||
if (weapon_num >= NUM_SHAREWARE_WEAPONS) {
|
if (weapon_num >= NUM_SHAREWARE_WEAPONS) {
|
||||||
weapon_name = secondary_flag?SECONDARY_WEAPON_NAMES(weapon_num):PRIMARY_WEAPON_NAMES(weapon_num);
|
weapon_name = secondary_flag?SECONDARY_WEAPON_NAMES(weapon_num):PRIMARY_WEAPON_NAMES(weapon_num);
|
||||||
hud_message(MSGC_GAME_FEEDBACK, "%s %s!", weapon_name,TXT_NOT_IN_SHAREWARE);
|
hud_message(MSGC_GAME_FEEDBACK, "%s %s!", weapon_name,TXT_NOT_IN_SHAREWARE);
|
||||||
digi_play_sample( SOUND_BAD_SELECTION, F1_0 );
|
digi_play_sample( SOUND_BAD_SELECTION, F1_0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!secondary_flag) {
|
if (!secondary_flag) {
|
||||||
|
|
||||||
//added on 10/9/98 by Victor Rachels to add laser cycle
|
if (weapon_num >= MAX_PRIMARY_WEAPONS)
|
||||||
if (weapon_num >= MAX_PRIMARY_WEAPONS)
|
weapon_num = 0;
|
||||||
// switch(weapon_num-MAX_PRIMARY_WEAPONS)
|
|
||||||
// {
|
|
||||||
// case 0 :
|
|
||||||
weapon_num = 0;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//end this section addition - Victor Rachels
|
|
||||||
|
|
||||||
weapon_name = PRIMARY_WEAPON_NAMES(weapon_num);
|
weapon_name = PRIMARY_WEAPON_NAMES(weapon_num);
|
||||||
if ((weapon_status & HAS_WEAPON_FLAG) == 0) {
|
if ((weapon_status & HAS_WEAPON_FLAG) == 0) {
|
||||||
|
@ -482,76 +251,13 @@ void do_weapon_select(int weapon_num, int secondary_flag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//added on 10/9/98 by Victor Rachels to add laser cycle
|
weapon_num=oweapon;
|
||||||
weapon_num=oweapon;
|
|
||||||
//end this section addition - Victor Rachels
|
|
||||||
|
|
||||||
select_weapon(weapon_num, secondary_flag, 1, 1);
|
select_weapon(weapon_num, secondary_flag, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//added/killed on 10/8/98 by Victor Rachels to remove #if 0
|
|
||||||
//-killed- // original non-customizable version
|
|
||||||
//-killed- // ----------------------------------------------------------------------------------------
|
|
||||||
//-killed- // Automatically select next best weapon if unable to fire current weapon.
|
|
||||||
//-killed- // Weapon type: 0==primary, 1==secondary
|
|
||||||
//-killed- void auto_select_weapon(int weapon_type)
|
|
||||||
//-killed- {
|
|
||||||
//-killed- int r;
|
|
||||||
//-killed-
|
|
||||||
//-killed- if (weapon_type==0) {
|
|
||||||
//-killed- r = player_has_weapon(Primary_weapon, 0);
|
|
||||||
//-killed- if (r != HAS_ALL) {
|
|
||||||
//-killed- int cur_weapon;
|
|
||||||
//-killed- int try_again = 1;
|
|
||||||
//-killed-
|
|
||||||
//-killed- cur_weapon = Primary_weapon;
|
|
||||||
//-killed-
|
|
||||||
//-killed- while (try_again) {
|
|
||||||
//-killed- cur_weapon--;
|
|
||||||
//-killed- if (cur_weapon < 0)
|
|
||||||
//-killed- cur_weapon = MAX_PRIMARY_WEAPONS-1;
|
|
||||||
//-killed-
|
|
||||||
//-killed- // Hack alert! Because the fusion uses 0 energy at the end (it's got the weird chargeup)
|
|
||||||
//-killed- // it looks like it takes 0 to fire, but it doesn't, so never auto-select.
|
|
||||||
//-killed- if (cur_weapon == FUSION_INDEX)
|
|
||||||
//-killed- continue;
|
|
||||||
//-killed-
|
|
||||||
//-killed- if (cur_weapon == Primary_weapon) {
|
|
||||||
//-killed- hud_message(MSGC_WEAPON_EMPTY, TXT_NO_PRIMARY);
|
|
||||||
//-killed- try_again = 0; // Tried all weapons!
|
|
||||||
//-killed- select_weapon(0, 0, 0, 1);
|
|
||||||
//-killed- } else if (player_has_weapon(cur_weapon, 0) == HAS_ALL) {
|
|
||||||
//-killed- select_weapon(cur_weapon, 0, 1, 1 );
|
|
||||||
//-killed- try_again = 0;
|
|
||||||
//-killed- }
|
|
||||||
//-killed- }
|
|
||||||
//-killed- }
|
|
||||||
//-killed-
|
|
||||||
//-killed- } else {
|
|
||||||
//-killed-
|
|
||||||
//-killed- Assert(weapon_type==1);
|
|
||||||
//-killed-
|
|
||||||
//-killed- if (Secondary_weapon != PROXIMITY_INDEX) {
|
|
||||||
//-killed- if (!(player_has_weapon(Secondary_weapon, 1) == HAS_ALL)) {
|
|
||||||
//-killed- if (Secondary_weapon > SMART_INDEX)
|
|
||||||
//-killed- if (player_has_weapon(SMART_INDEX, 1) == HAS_ALL) {
|
|
||||||
//-killed- select_weapon(SMART_INDEX, 1, 1, 1);
|
|
||||||
//-killed- goto weapon_selected;
|
|
||||||
//-killed- }
|
|
||||||
//-killed- if (player_has_weapon(HOMING_INDEX, 1) == HAS_ALL)
|
|
||||||
//-killed- select_weapon(HOMING_INDEX, 1, 1, 1);
|
|
||||||
//-killed- else if (player_has_weapon(CONCUSSION_INDEX, 1) == HAS_ALL)
|
|
||||||
//-killed- select_weapon(CONCUSSION_INDEX, 1, 1, 1);
|
|
||||||
//-killed- weapon_selected: ;
|
|
||||||
//-killed- }
|
|
||||||
//-killed- }
|
|
||||||
//-killed- }
|
|
||||||
//-killed-
|
|
||||||
//-killed- }
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
// Automatically select best available weapon if unable to fire current weapon.
|
// Automatically select best available weapon if unable to fire current weapon.
|
||||||
// Weapon type: 0==primary, 1==secondary
|
// Weapon type: 0==primary, 1==secondary
|
||||||
void auto_select_weapon(int weapon_type) {
|
void auto_select_weapon(int weapon_type) {
|
||||||
int i;
|
int i;
|
||||||
int *order = weapon_type ? secondary_order : primary_order;
|
int *order = weapon_type ? secondary_order : primary_order;
|
||||||
|
@ -562,24 +268,22 @@ void auto_select_weapon(int weapon_type) {
|
||||||
if (player_has_weapon(
|
if (player_has_weapon(
|
||||||
weapon_type ? Secondary_weapon : Primary_weapon,
|
weapon_type ? Secondary_weapon : Primary_weapon,
|
||||||
weapon_type) != HAS_ALL)
|
weapon_type) != HAS_ALL)
|
||||||
{
|
{
|
||||||
//added on 1/21/99 by Victor Rachels for noenergy vulcan select
|
if ((weapon_type==0) &&
|
||||||
if ((weapon_type==0) &&
|
(order[VULCAN_INDEX] > 0) &&
|
||||||
(order[VULCAN_INDEX] > 0) &&
|
(player_has_weapon(VULCAN_INDEX,0)==HAS_ALL))
|
||||||
(player_has_weapon(VULCAN_INDEX,0)==HAS_ALL))
|
{
|
||||||
{
|
select_weapon(VULCAN_INDEX,0,0,1);
|
||||||
select_weapon(VULCAN_INDEX,0,0,1);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
//end this section addition - VR
|
|
||||||
|
|
||||||
for (i = 0; i < weapon_count; i++)
|
for (i = 0; i < weapon_count; i++)
|
||||||
if ((order[i] > best_order) &&
|
if ((order[i] > best_order) &&
|
||||||
(player_has_weapon(i, weapon_type) == HAS_ALL))
|
(player_has_weapon(i, weapon_type) == HAS_ALL))
|
||||||
{
|
{
|
||||||
best_weapon = i;
|
best_weapon = i;
|
||||||
best_order = order[i];
|
best_order = order[i];
|
||||||
}
|
}
|
||||||
if (best_weapon >= 0)
|
if (best_weapon >= 0)
|
||||||
select_weapon(best_weapon, weapon_type, 1, 1);
|
select_weapon(best_weapon, weapon_type, 1, 1);
|
||||||
else if (weapon_type == 0) {
|
else if (weapon_type == 0) {
|
||||||
|
@ -620,45 +324,43 @@ void show_weapon_status(void)
|
||||||
|
|
||||||
mprintf((0, "\n"));
|
mprintf((0, "\n"));
|
||||||
mprintf((0, "\n"));
|
mprintf((0, "\n"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// select primary weapon if it has a higher order than the current weapon
|
// select primary weapon if it has a higher order than the current weapon
|
||||||
void maybe_select_primary(int weapon_index)
|
void maybe_select_primary(int weapon_index)
|
||||||
{
|
{
|
||||||
if (primary_order[weapon_index] > 0)
|
if (primary_order[weapon_index] > 0)
|
||||||
{
|
{
|
||||||
if(LaserPowSelected&&Primary_weapon==0)
|
if(LaserPowSelected&&Primary_weapon==0)
|
||||||
{
|
{
|
||||||
if(primary_order[weapon_index] > primary_order[LaserPowSelected])
|
if(primary_order[weapon_index] > primary_order[LaserPowSelected])
|
||||||
select_weapon(weapon_index, 0, 0, 1);
|
select_weapon(weapon_index, 0, 0, 1);
|
||||||
}
|
}
|
||||||
else if(primary_order[weapon_index] > primary_order[Primary_weapon])
|
else if(primary_order[weapon_index] > primary_order[Primary_weapon])
|
||||||
select_weapon(weapon_index, 0, 0, 1);
|
select_weapon(weapon_index, 0, 0, 1);
|
||||||
else{
|
else{
|
||||||
// nm_messagebox(NULL,1,TXT_OK,"murp %i==1,%i=prim,%i==7,%i!=7",weapon_index,Primary_weapon,player_has_weapon(weapon_index,0),player_has_weapon(Primary_weapon,0));
|
if((weapon_index==VULCAN_INDEX) &&
|
||||||
if((weapon_index==VULCAN_INDEX) &&
|
(player_has_weapon(weapon_index,0)==HAS_ALL) &&
|
||||||
(player_has_weapon(weapon_index,0)==HAS_ALL) &&
|
(player_has_weapon(Primary_weapon,0)!=HAS_ALL))
|
||||||
(player_has_weapon(Primary_weapon,0)!=HAS_ALL))
|
select_weapon(weapon_index, 0, 0, 1);
|
||||||
select_weapon(weapon_index, 0, 0, 1);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// select secondary weapon if it has a higher order than the current weapon
|
// select secondary weapon if it has a higher order than the current weapon
|
||||||
void maybe_select_secondary(int weapon_index)
|
void maybe_select_secondary(int weapon_index)
|
||||||
{
|
{
|
||||||
if ((secondary_order[weapon_index] > 0) &&
|
if ((secondary_order[weapon_index] > 0) &&
|
||||||
(secondary_order[weapon_index] > secondary_order[Secondary_weapon]))
|
(secondary_order[weapon_index] > secondary_order[Secondary_weapon]))
|
||||||
select_weapon(weapon_index, 1, 0, 1);
|
select_weapon(weapon_index, 1, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//called when one of these weapons is picked up
|
// called when one of these weapons is picked up
|
||||||
//when you pick up a secondary, you always get the weapon & ammo for it
|
// when you pick up a secondary, you always get the weapon & ammo for it
|
||||||
// Returns true if powerup picked up, else returns false.
|
// Returns true if powerup picked up, else returns false.
|
||||||
int pick_up_secondary(int weapon_index,int count)
|
int pick_up_secondary(int weapon_index,int count)
|
||||||
{
|
{
|
||||||
|
@ -678,22 +380,14 @@ int pick_up_secondary(int weapon_index,int count)
|
||||||
Players[Player_num].secondary_ammo[weapon_index] = Secondary_ammo_max[weapon_index];
|
Players[Player_num].secondary_ammo[weapon_index] = Secondary_ammo_max[weapon_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
//added on 9/14/98 by Victor Rachels to make weapon cycle toggle
|
if(Allow_secondary_cycle)
|
||||||
if(Allow_secondary_cycle)
|
{
|
||||||
{
|
maybe_select_secondary(weapon_index);
|
||||||
//end this section addition - Victor Rachels (with '}' at below)
|
if ((Players[Player_num].secondary_ammo[Secondary_weapon] == 0) &&
|
||||||
|
(secondary_order[weapon_index] > 0))
|
||||||
|
select_weapon(weapon_index,1, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
//if you pick up a missile with a higher order than the current,
|
|
||||||
//then select it
|
|
||||||
maybe_select_secondary(weapon_index);
|
|
||||||
//if you pick up a missile and you're out of ammo, and it may be
|
|
||||||
//autoselected, then select it
|
|
||||||
if ((Players[Player_num].secondary_ammo[Secondary_weapon] == 0) &&
|
|
||||||
(secondary_order[weapon_index] > 0))
|
|
||||||
select_weapon(weapon_index,1, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//note: flash for all but concussion was 7,14,21
|
|
||||||
if (count>1) {
|
if (count>1) {
|
||||||
PALETTE_FLASH_ADD(15,15,15);
|
PALETTE_FLASH_ADD(15,15,15);
|
||||||
hud_message(MSGC_PICKUP_OK, "%d %s%s",num_picked_up,SECONDARY_WEAPON_NAMES(weapon_index), TXT_SX);
|
hud_message(MSGC_PICKUP_OK, "%d %s%s",num_picked_up,SECONDARY_WEAPON_NAMES(weapon_index), TXT_SX);
|
||||||
|
@ -703,9 +397,7 @@ int pick_up_secondary(int weapon_index,int count)
|
||||||
hud_message(MSGC_PICKUP_OK, "%s!",SECONDARY_WEAPON_NAMES(weapon_index));
|
hud_message(MSGC_PICKUP_OK, "%s!",SECONDARY_WEAPON_NAMES(weapon_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
//added on 2/8/99 by Victor Rachels to add allweapon hud info
|
gauge_update_hud_mode=1;
|
||||||
gauge_update_hud_mode=1;
|
|
||||||
//end this section additon - VR
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,27 +415,20 @@ int pick_up_primary(int weapon_index)
|
||||||
|
|
||||||
Players[Player_num].primary_weapon_flags |= flag;
|
Players[Player_num].primary_weapon_flags |= flag;
|
||||||
|
|
||||||
//added on 9/14/98 by Victor Rachels for weapon cycle toggle
|
if (Allow_primary_cycle)
|
||||||
if (Allow_primary_cycle)
|
{
|
||||||
{
|
if (!(old_flags & flag))
|
||||||
//end this section addition - Victor Rachels
|
maybe_select_primary(weapon_index);
|
||||||
if (!(old_flags & flag))
|
}
|
||||||
maybe_select_primary(weapon_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PALETTE_FLASH_ADD(7,14,21);
|
PALETTE_FLASH_ADD(7,14,21);
|
||||||
hud_message(MSGC_PICKUP_OK, "%s!",PRIMARY_WEAPON_NAMES(weapon_index));
|
hud_message(MSGC_PICKUP_OK, "%s!",PRIMARY_WEAPON_NAMES(weapon_index));
|
||||||
|
gauge_update_hud_mode=1;
|
||||||
|
|
||||||
//added on 2/8/99 by Victor Rachels to add allweapon hud info
|
|
||||||
gauge_update_hud_mode=1;
|
|
||||||
//end this section additon - VR
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//called when ammo (for the vulcan cannon) is picked up
|
//called when ammo (for the vulcan cannon) is picked up
|
||||||
// Return true if ammo picked up, else return false.
|
//Return true if ammo picked up, else return false.
|
||||||
int pick_up_ammo(int class_flag,int weapon_index,int ammo_count)
|
int pick_up_ammo(int class_flag,int weapon_index,int ammo_count)
|
||||||
{
|
{
|
||||||
int old_ammo=class_flag; //kill warning
|
int old_ammo=class_flag; //kill warning
|
||||||
|
@ -755,19 +440,15 @@ int pick_up_ammo(int class_flag,int weapon_index,int ammo_count)
|
||||||
|
|
||||||
old_ammo = Players[Player_num].primary_ammo[weapon_index];
|
old_ammo = Players[Player_num].primary_ammo[weapon_index];
|
||||||
|
|
||||||
Players[Player_num].primary_ammo[weapon_index] += ammo_count;
|
Players[Player_num].primary_ammo[weapon_index] += ammo_count;
|
||||||
|
|
||||||
if (Players[Player_num].primary_ammo[weapon_index] > Primary_ammo_max[weapon_index])
|
if (Players[Player_num].primary_ammo[weapon_index] > Primary_ammo_max[weapon_index])
|
||||||
Players[Player_num].primary_ammo[weapon_index] = Primary_ammo_max[weapon_index];
|
Players[Player_num].primary_ammo[weapon_index] = Primary_ammo_max[weapon_index];
|
||||||
|
|
||||||
if (Players[Player_num].primary_weapon_flags&(1<<weapon_index) && old_ammo==0)
|
if (Players[Player_num].primary_weapon_flags&(1<<weapon_index) && old_ammo==0)
|
||||||
//added on 11/01/98 by Victor Rachels - fix primary autoselect
|
if(Allow_primary_cycle) //since this function is vulcan only anyway
|
||||||
if(Allow_primary_cycle) //since this function is vulcan only anyway
|
maybe_select_primary(weapon_index);
|
||||||
//end this section addition
|
|
||||||
maybe_select_primary(weapon_index);
|
|
||||||
|
|
||||||
//added on 2/8/99 by Victor Rachels to add allweapon hud info
|
gauge_update_hud_mode=1;
|
||||||
gauge_update_hud_mode=1;
|
|
||||||
//end this section additon - VR
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue