Add zbuffer and screenblocks options in .residualrc.

Also, make ZBUFFER_GLOBAL and SCREENBLOCKS_GLOBAL into bool variables.
This commit is contained in:
Daniel Schepler 2004-03-24 12:20:46 +00:00
parent edb7c81ce8
commit 4b06c2226d
6 changed files with 41 additions and 14 deletions

View file

@ -204,7 +204,7 @@ void Bitmap::draw() const {
glEnable(GL_DEPTH_TEST);
} else if (format_ == 5) { // ZBuffer image
// Only draw the manual zbuffer when we are not using screenblocks, and when enabled
if ((ZBUFFER_GLOBAL == 0) || (SCREENBLOCKS_GLOBAL == 1))
if ((! ZBUFFER_GLOBAL) || SCREENBLOCKS_GLOBAL)
return;
g_driver->drawDepthBitmap(x_, y_, width_, height_, data_[curr_image_ - 1]);

View file

@ -20,7 +20,7 @@
#ifndef DEBUG_H
#define DEBUG_H
// Hacky toggles for experimental / debug code (defined/set in main.cpp)
extern int ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
extern bool ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
void warning(const char *fmt, ...);
void error(const char *fmt, ...);

View file

@ -96,7 +96,7 @@ void Engine::mainLoop() {
}
g_driver->flipBuffer();
} else if (_mode == ENGINE_MODE_NORMAL) {
if (SCREENBLOCKS_GLOBAL == 1)
if (SCREENBLOCKS_GLOBAL)
screenBlocksReset();
// Update actor costumes
@ -109,7 +109,7 @@ void Engine::mainLoop() {
g_driver->clearScreen();
if (SCREENBLOCKS_GLOBAL == 1)
if (SCREENBLOCKS_GLOBAL)
screenBlocksBlitDirtyBlocks();
if (currScene_ != NULL) {

View file

@ -35,7 +35,7 @@
#endif
// Hacky global toggles for experimental/debug code
int ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
bool ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
static void saveRegistry() {
Registry::instance()->save();
@ -50,23 +50,50 @@ int PASCAL WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/, LPSTR /*lpCmdL
extern SoundMixer *g_mixer;
extern Timer *g_timer;
static bool parseBoolStr(const char *val) {
if (val == NULL || val[0] == 0)
return false;
switch (val[0]) {
case 'y': case 'Y': // yes
case 't': case 'T': // true
case '1':
return true;
case 'n': case 'N': // no
case 'f': case 'F': // false
case '0':
return false;
case 'o':
switch (val[1]) {
case 'n': case 'N': // on
return true;
case 'f': case 'F': // off
return false;
}
}
error("Unrecognized boolean value %s\n", val);
}
int main(int argc, char *argv[]) {
int i;
// Parse command line
ZBUFFER_GLOBAL = 0;
SCREENBLOCKS_GLOBAL = 0;
ZBUFFER_GLOBAL = parseBoolStr(Registry::instance()->get("zbuffer"));
SCREENBLOCKS_GLOBAL = parseBoolStr(Registry::instance()->get("screenblocks"));
for (i=1;i<argc;i++) {
if (strcmp(argv[i], "-zbuffer") == 0)
ZBUFFER_GLOBAL = 1;
else if (strcmp(argv[i], "-screenblocks") ==0)
SCREENBLOCKS_GLOBAL = 1;
ZBUFFER_GLOBAL = true;
else if (strcmp(argv[i], "-nozbuffer") == 0)
ZBUFFER_GLOBAL = false;
else if (strcmp(argv[i], "-screenblocks") == 0)
SCREENBLOCKS_GLOBAL = true;
else if (strcmp(argv[i], "-noscreenblocks") == 0)
SCREENBLOCKS_GLOBAL = false;
else {
printf("Residual CVS Version\n");
printf("--------------------\n");
printf("Recognised options:\n");
printf("\t-zbuffer\t\tEnable ZBuffers (Very slow on older cards)\n");
printf("\t-screenblocks\t\tEnable Screenblocks (Experimental zbuffer speedup on older cards - BROKEN!!\n");
printf("\t-[no]zbuffer\t\tEnable/disable ZBuffers (Very slow on older cards)\n");
printf("\t-[no]screenblocks\t\tEnable/disable Screenblocks (Experimental zbuffer speedup on older cards - BROKEN!!\n");
exit(-1);
}
}

View file

@ -690,7 +690,7 @@ void Model::Mesh::draw() const {
bestDepth = winZ;
}
if (SCREENBLOCKS_GLOBAL == 1)
if (SCREENBLOCKS_GLOBAL)
screenBlocksAddRectangle( (int)top, (int)right, (int)left, (int)bottom, (int)bestDepth );
}
/*

View file

@ -155,7 +155,7 @@ void Scene::Setup::setupCamera() const {
void Scene::setSetup(int num) {
currSetup_ = setups_ + num;
if (SCREENBLOCKS_GLOBAL == 0)
if (! SCREENBLOCKS_GLOBAL)
return;
if(currSetup_->bkgnd_zbm_)
screenBlocksInit( currSetup_->bkgnd_zbm_->getData() );