opengl_tgm1

Thread in 'Research & Development' started by nightmareci, 20 Apr 2013.

  1. This is a semi-playable pre-alpha of my current efforts to clone TGM1 using OpenGL for graphics, and SDL 2.0 for everything else. The package attached to this post is source-code-only; I'm posting now to get assistance in fixing gameplay bugs that I don't quite know how to fix. Any fixes will be credited to the user(s) that provide them.

    Source updates:
    2013-04-22: Fixed 20G a bit, and now holding down never causes gravity to halt.
    2013-04-22: Added visible playfield borders that look just like TGM1's.
    2013-04-24: Added joystick support, a configuration file, the option to choose screen/block resolution, and fullscreen support.
    2013-05-06: Added joystick POV HAT support (D-pad), improved TGM1 accuracy, and the code should work on Mac OS X now.
     

    Attached Files:

    Last edited: 6 May 2013
  2. as a computer programming drop out. I will be doing extensive testing on this.
     
  3. Code:
    goto DONE;
    :sowsuser:
     
  4. haven't looked at the code yet, just trying to run the damn thing. the make runs fine, but I'm having opengl errors specific to my linux drivers from the looks of it. might try again tomorrow.
     
  5. Muf

    Muf

    I'm not sure what the context is here, but that is a very common pattern and a legitimate use of goto.
     
  6. Too bad there is no "Goto - not even once" meme :p
     
  7. Is there a difference between the .zip and the .7z files?
     
  8. Muf

    Muf

    The 7z is the build and the zip is the source code, as far as I can tell.
     
  9. Muf

    Muf

  10. MSVCR110.dll is missing.
     
  11. Muf

    Muf

  12. Muf

    Muf

  13. Goto is much better than break in this instance, as its a nested loop and C++ doesn't have labeled breaks. Using break would require an extra variable, and would increase the possibility of branching screwing up your cache pipelines.
     
  14. If I have some extra time this week, I'll probably post an OSX build.

    I played around with it earlier today, and it kept segfaulting after I got it to compile. I tracked it down to the glGenVertexArrays() call in void init(void)... Apparently OSX 10.7 requires a few extra API calls to obtain an actual OpenGL 3.2+ context.
     
  15. I'll probably love you forever.
     
  16. Code:
    bool TGM1Game::isBravoField() {
    	bool bravoField = true;
    
    	/* Check each row. If a row is found with blocks, but it isn't a filled
    	 * row, then it's not a bravo field; else, it is a bravo field. */
    	for (int row = 0; row < FIELD_HEIGHT; row++) {
    		if (!filledRow(row)) {
    			for (int x = 0; x < FIELD_WIDTH; x++) {
    				if (state.field[row][x] != PIECE_EMPTY) {
    					bravoField = false;
    					goto DONE;
    				}
    			}
    		}
    	}
    DONE:
    	return bravoField;
    }
    Really?
    Code:
    bool TGM1Game::isBravoField() {
    	/* Check each row. If a row is found with blocks, but it isn't a filled
    	 * row, then it's not a bravo field; else, it is a bravo field. */
    	for (int row = 0; row < FIELD_HEIGHT; row++) {
    		if (!filledRow(row)) {
    			for (int x = 0; x < FIELD_WIDTH; x++) {
    				if (state.field[row][x] != PIECE_EMPTY) {
    					return false;
    				}
    			}
    		}
    	}
    	return true;
    }
     
  17. You have a point. I guess I didn't read into it too thoroughly. Goto is a common pattern in C/C++ for labelled breaks and error handling, and I just assumed thats what it was being used for.
     
  18. Thanks XaeL. That little refactor is much better than my goto; you'll be credited in the source for that change.
     
  19. Do you happen to have your code in version control (Git, HG, etc)? I've made quite a few changes to the original files you posted to get it to compile on OS X, which you might want to include... Unfortunately, it seems that OS X still doesn't fully support OpenGL 3.3, so I'm having a bit of trouble getting the graphics to display properly :\
     
  20. Sorry, no version control right now. Just post an archive of the code in a post to this thread (no .dmg files, please!), and I'll manually merge the code into my version.
     

Share This Page