Add zbuffer and screenblocks options in .residualrc.
Also, make ZBUFFER_GLOBAL and SCREENBLOCKS_GLOBAL into bool variables.
This commit is contained in:
parent
edb7c81ce8
commit
4b06c2226d
6 changed files with 41 additions and 14 deletions
|
@ -204,7 +204,7 @@ void Bitmap::draw() const {
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
} else if (format_ == 5) { // ZBuffer image
|
} else if (format_ == 5) { // ZBuffer image
|
||||||
// Only draw the manual zbuffer when we are not using screenblocks, and when enabled
|
// 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;
|
return;
|
||||||
|
|
||||||
g_driver->drawDepthBitmap(x_, y_, width_, height_, data_[curr_image_ - 1]);
|
g_driver->drawDepthBitmap(x_, y_, width_, height_, data_[curr_image_ - 1]);
|
||||||
|
|
2
debug.h
2
debug.h
|
@ -20,7 +20,7 @@
|
||||||
#ifndef DEBUG_H
|
#ifndef DEBUG_H
|
||||||
#define DEBUG_H
|
#define DEBUG_H
|
||||||
// Hacky toggles for experimental / debug code (defined/set in main.cpp)
|
// 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 warning(const char *fmt, ...);
|
||||||
void error(const char *fmt, ...);
|
void error(const char *fmt, ...);
|
||||||
|
|
|
@ -96,7 +96,7 @@ void Engine::mainLoop() {
|
||||||
}
|
}
|
||||||
g_driver->flipBuffer();
|
g_driver->flipBuffer();
|
||||||
} else if (_mode == ENGINE_MODE_NORMAL) {
|
} else if (_mode == ENGINE_MODE_NORMAL) {
|
||||||
if (SCREENBLOCKS_GLOBAL == 1)
|
if (SCREENBLOCKS_GLOBAL)
|
||||||
screenBlocksReset();
|
screenBlocksReset();
|
||||||
|
|
||||||
// Update actor costumes
|
// Update actor costumes
|
||||||
|
@ -109,7 +109,7 @@ void Engine::mainLoop() {
|
||||||
|
|
||||||
g_driver->clearScreen();
|
g_driver->clearScreen();
|
||||||
|
|
||||||
if (SCREENBLOCKS_GLOBAL == 1)
|
if (SCREENBLOCKS_GLOBAL)
|
||||||
screenBlocksBlitDirtyBlocks();
|
screenBlocksBlitDirtyBlocks();
|
||||||
|
|
||||||
if (currScene_ != NULL) {
|
if (currScene_ != NULL) {
|
||||||
|
|
43
main.cpp
43
main.cpp
|
@ -35,7 +35,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Hacky global toggles for experimental/debug code
|
// Hacky global toggles for experimental/debug code
|
||||||
int ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
|
bool ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
|
||||||
|
|
||||||
static void saveRegistry() {
|
static void saveRegistry() {
|
||||||
Registry::instance()->save();
|
Registry::instance()->save();
|
||||||
|
@ -50,23 +50,50 @@ int PASCAL WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/, LPSTR /*lpCmdL
|
||||||
extern SoundMixer *g_mixer;
|
extern SoundMixer *g_mixer;
|
||||||
extern Timer *g_timer;
|
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 main(int argc, char *argv[]) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Parse command line
|
// Parse command line
|
||||||
ZBUFFER_GLOBAL = 0;
|
ZBUFFER_GLOBAL = parseBoolStr(Registry::instance()->get("zbuffer"));
|
||||||
SCREENBLOCKS_GLOBAL = 0;
|
SCREENBLOCKS_GLOBAL = parseBoolStr(Registry::instance()->get("screenblocks"));
|
||||||
for (i=1;i<argc;i++) {
|
for (i=1;i<argc;i++) {
|
||||||
if (strcmp(argv[i], "-zbuffer") == 0)
|
if (strcmp(argv[i], "-zbuffer") == 0)
|
||||||
ZBUFFER_GLOBAL = 1;
|
ZBUFFER_GLOBAL = true;
|
||||||
else if (strcmp(argv[i], "-screenblocks") ==0)
|
else if (strcmp(argv[i], "-nozbuffer") == 0)
|
||||||
SCREENBLOCKS_GLOBAL = 1;
|
ZBUFFER_GLOBAL = false;
|
||||||
|
else if (strcmp(argv[i], "-screenblocks") == 0)
|
||||||
|
SCREENBLOCKS_GLOBAL = true;
|
||||||
|
else if (strcmp(argv[i], "-noscreenblocks") == 0)
|
||||||
|
SCREENBLOCKS_GLOBAL = false;
|
||||||
else {
|
else {
|
||||||
printf("Residual CVS Version\n");
|
printf("Residual CVS Version\n");
|
||||||
printf("--------------------\n");
|
printf("--------------------\n");
|
||||||
printf("Recognised options:\n");
|
printf("Recognised options:\n");
|
||||||
printf("\t-zbuffer\t\tEnable ZBuffers (Very slow on older cards)\n");
|
printf("\t-[no]zbuffer\t\tEnable/disable ZBuffers (Very slow on older cards)\n");
|
||||||
printf("\t-screenblocks\t\tEnable Screenblocks (Experimental zbuffer speedup on older cards - BROKEN!!\n");
|
printf("\t-[no]screenblocks\t\tEnable/disable Screenblocks (Experimental zbuffer speedup on older cards - BROKEN!!\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -690,7 +690,7 @@ void Model::Mesh::draw() const {
|
||||||
bestDepth = winZ;
|
bestDepth = winZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SCREENBLOCKS_GLOBAL == 1)
|
if (SCREENBLOCKS_GLOBAL)
|
||||||
screenBlocksAddRectangle( (int)top, (int)right, (int)left, (int)bottom, (int)bestDepth );
|
screenBlocksAddRectangle( (int)top, (int)right, (int)left, (int)bottom, (int)bestDepth );
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -155,7 +155,7 @@ void Scene::Setup::setupCamera() const {
|
||||||
void Scene::setSetup(int num) {
|
void Scene::setSetup(int num) {
|
||||||
currSetup_ = setups_ + num;
|
currSetup_ = setups_ + num;
|
||||||
|
|
||||||
if (SCREENBLOCKS_GLOBAL == 0)
|
if (! SCREENBLOCKS_GLOBAL)
|
||||||
return;
|
return;
|
||||||
if(currSetup_->bkgnd_zbm_)
|
if(currSetup_->bkgnd_zbm_)
|
||||||
screenBlocksInit( currSetup_->bkgnd_zbm_->getData() );
|
screenBlocksInit( currSetup_->bkgnd_zbm_->getData() );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue