'unbreak' Residual - disable Zbuffer and (broken) screenblocks code by default. Add hacky commandline options for these.
This commit is contained in:
parent
f2ddfb59cf
commit
214e9a933b
8 changed files with 51 additions and 17 deletions
14
README
14
README
|
@ -1,5 +1,5 @@
|
|||
Residual: A LucasArts 3D game interpreter Version 0.01-CVS
|
||||
(C) 2003- The ScummVM-Residual team Last Updated: 24st Aug 2003
|
||||
(C) 2003- The ScummVM-Residual team Last Updated: 21st Sept 2003
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
What is Residual?
|
||||
|
@ -26,6 +26,7 @@ UNIX:
|
|||
Create a ~/.residualrc file, containing the following lines:
|
||||
DataDir=[path to all the .lab files]
|
||||
good_times=TRUE
|
||||
|
||||
Win32:
|
||||
Copy 'residual.exe' into the directory containing your .lab files, and
|
||||
create a file in this directory called 'residual.ini'. This file should contain
|
||||
|
@ -33,15 +34,18 @@ the lines:
|
|||
DataDir=.
|
||||
good_times=TRUE
|
||||
|
||||
It runs really slow!
|
||||
--------------------
|
||||
Residual understands two options: '-zbuffer' which enables masking, and '-screenblocks'
|
||||
which is a (currently broken) attempt to speed up masking on older cards.
|
||||
|
||||
It runs really slow when using -zbuffer!
|
||||
----------------------------------------
|
||||
A large portion of older cards (Such as 3dfx cards, Radeon 7500 and earlier,
|
||||
Matrox G4xx series cards, etc) do not have a fast glDrawPixels implementation.
|
||||
Unix users can achieve a usable speed by using Mesa 5.0 or newer, but people
|
||||
unable to upgrade or Windows users are stuck.
|
||||
|
||||
We are working on this problem, however it is a tricky one and no easy
|
||||
solution has yet been found.
|
||||
We do have a possible solution (-screenblocks), however it is experimental
|
||||
untested, and currently will thrash memory and potentially crash.
|
||||
|
||||
What is the state of Residual?
|
||||
-------------------------------
|
||||
|
|
4
TODO
4
TODO
|
@ -6,8 +6,8 @@ Residual in-progress items (in rough order of priority):
|
|||
|
||||
Residual TODO list (in rough order of priority):
|
||||
------------------------------------------------
|
||||
* Bounds check the ZBuffer/Screen stuff, so it stops trashing memory and making
|
||||
Residual unusable/unstable.
|
||||
* Bounds check the Screenblocks dirty rectangle stuff, so it stops trashing
|
||||
memory and making Residual unusable/unstable.
|
||||
* Implement 2D primitives
|
||||
* Remove hash_map usage (not implemented on Visual Studio & other compilers)
|
||||
* Remove as much other STL stuff as possible (see above)
|
||||
|
|
11
bitmap.cpp
11
bitmap.cpp
|
@ -120,8 +120,7 @@ void Bitmap::prepareGL() {
|
|||
}
|
||||
|
||||
void Bitmap::draw() const {
|
||||
|
||||
if (format_ == 1) {
|
||||
if (format_ == 1) { // Normal image
|
||||
if (curr_image_ != 0) {
|
||||
warning("Animation not handled yet in GL texture path !\n");
|
||||
}
|
||||
|
@ -152,8 +151,11 @@ void Bitmap::draw() const {
|
|||
glDisable(GL_TEXTURE_2D);
|
||||
glDepthMask(GL_TRUE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
} else if (format_ == 5) {
|
||||
#if 0
|
||||
} 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))
|
||||
return;
|
||||
|
||||
if (curr_image_ != 0) {
|
||||
warning("Animation not handled yet in GL texture path !\n");
|
||||
}
|
||||
|
@ -171,7 +173,6 @@ void Bitmap::draw() const {
|
|||
}
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
glDepthFunc(GL_LESS);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
2
debug.h
2
debug.h
|
@ -17,6 +17,8 @@
|
|||
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
// Hacky toggles for experimental / debug code (defined/set in main.cpp)
|
||||
extern int ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
|
||||
|
||||
void warning(const char *fmt, ...);
|
||||
void error(const char *fmt, ...);
|
||||
|
|
|
@ -84,7 +84,7 @@ void Engine::mainLoop() {
|
|||
|
||||
// Run asynchronous tasks
|
||||
lua_runtasks();
|
||||
|
||||
if (SCREENBLOCKS_GLOBAL == 1)
|
||||
screenBlocksReset();
|
||||
|
||||
// Draw the screen
|
||||
|
@ -119,7 +119,7 @@ void Engine::mainLoop() {
|
|||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
if (SCREENBLOCKS_GLOBAL == 1)
|
||||
screenBlocksBlitDirtyBlocks();
|
||||
|
||||
Bitmap::prepareGL();
|
||||
|
|
25
main.cpp
25
main.cpp
|
@ -30,6 +30,9 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
// Hacky global toggles for experimental/debug code
|
||||
int ZBUFFER_GLOBAL, SCREENBLOCKS_GLOBAL;
|
||||
|
||||
static void saveRegistry() {
|
||||
Registry::instance()->save();
|
||||
}
|
||||
|
@ -40,8 +43,28 @@ static void saveRegistry() {
|
|||
}
|
||||
#endif
|
||||
|
||||
int main(int /* argc */, char ** /* argv */) {
|
||||
int main(int argc, char *argv[]) {
|
||||
char GLDriver[1024];
|
||||
int i;
|
||||
|
||||
// Parse command line
|
||||
ZBUFFER_GLOBAL = 0;
|
||||
SCREENBLOCKS_GLOBAL = 0;
|
||||
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;
|
||||
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");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
||||
return 1;
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||
|
|
|
@ -709,6 +709,7 @@ void Model::Mesh::draw() const {
|
|||
|
||||
}
|
||||
|
||||
if (SCREENBLOCKS_GLOBAL == 1)
|
||||
screenBlocksAddRectangle( top, right, left, bottom, bestDepth );
|
||||
}
|
||||
|
||||
|
|
|
@ -169,6 +169,9 @@ void Scene::Setup::setupCamera() const {
|
|||
void Scene::setSetup(int num)
|
||||
{
|
||||
currSetup_ = setups_ + num;
|
||||
|
||||
if (SCREENBLOCKS_GLOBAL == 0)
|
||||
return;
|
||||
if(currSetup_->bkgnd_zbm_)
|
||||
screenBlocksInit( currSetup_->bkgnd_zbm_->getData() );
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue