Difference between revisions of "User talk:TPAINROXX"

From WiiBrew
Jump to: navigation, search
(Code (for corrections and help))
(←Replaced content with '...')
Line 1: Line 1:
{{tmbox
+
...
| type = notice
 
| text = '''To be updated after game release...'''
 
}}
 
 
 
=WiiMoveIt=
 
 
 
===Game Suggestions===
 
 
 
Hi TPAINROXX, I don't want to be rude, but you must work a little on your graphics for WiiMoveIt, it looks like something you did with powerpoint. (p.s. I like the idea of the game, I enjoy Smooth Moves). --[[User:Elisherer|Elisherer]] 09:32, 19 June 2009 (UTC)
 
 
 
:Noted. I made some earlier today before reading your suggestion, so give me some feedback.--[[User:TPAINROXX|TPAINROXX/BKW]] 00:59, 20 June 2009 (UTC)
 
 
 
===Mini Game Ideas===
 
 
 
'''Games (and be detailed):'''
 
 
 
What about a puzzle game based on something like crate man, but from above instead of a side view with easily editable levels via a simple text document?--[[User:TPAINROXX|TPAINROXX/BKW]] 22:14, 28 June 2009 (UTC)
 
 
 
:Sure. I'll work on it if I can the program to work (again).--[[User:TPAINROXX|TPAINROXX/BKW]] 22:14, 28 June 2009 (UTC)
 
 
 
==Code (for corrections and help)==
 
'''Code as of 6-28-09.
 
 
 
Currently the program doesn't work: either a blank screen or code dump.'''
 
 
 
<source lang=cpp>
 
 
 
/*=========================================================
 
WARNING: Working file; be carful with editing.
 
 
 
WiiMoveIt - By: Brandon Whitmire
 
 
 
Thanks for GRRLIB, and to NoNameNo and Crayon for GRRLIB help.
 
//=========================================================
 
GRRLIB Download and Help Forum : http://grrlib.santo.fr
 
*///=======================================================
 
//    START FILE INCLUSION
 
//---------------------------------------------------------
 
//    Important Files & Headers
 
///////////////////////////////////////////////////////////
 
//To switch between version because SVN doesn't always work.
 
//Or I don't know how to use it (mostly this is the problem).
 
 
 
// #include "GRRLIB/GRRLIB/GRRLIB.h" //Version packed with GRRLIB 4.0.0
 
 
 
#include "GRRLIB/SVN/GRRLIB.h"    //SVN Version; rev101.
 
 
///////////////////////////////////////////////////////////
 
#include <cstdlib>
 
#include <time.h> //For time comparison.
 
#include <unistd.h>  //For usleep();
 
#include <wiiuse/wpad.h>
 
#include <iostream>  //May not be used; for basic output (originally).
 
using namespace std;
 
 
 
//---------------------------------------------------------
 
//    Start All File Inclusion
 
//---------------------------------------------------------
 
 
 
#include "credits/intro.h"
 
#include "fonts/font.h"
 
 
 
//---------------------------------------------------------
 
//    For Regular Menu (aka "Lights Off")
 
//---------------------------------------------------------
 
 
 
#include "gfx/pointer1.h"
 
 
 
#include "gfx/menu_pix/menu.h"
 
 
 
#include "gfx/menu_pix/button1.h"
 
#include "gfx/menu_pix/button2.h"
 
#include "gfx/menu_pix/button3.h"
 
 
 
//---------------------------------------------------------
 
//    For Inverted Menu (aka "Lights On")
 
//---------------------------------------------------------
 
 
 
#include "gfx/pointer1_i.h"
 
 
 
#include "gfx/menu_pix/menu_i/menu_i.h"
 
 
 
#include "gfx/menu_pix/menu_i/button1_i.h"
 
#include "gfx/menu_pix/menu_i/button2_i.h"
 
#include "gfx/menu_pix/menu_i/button3_i.h"
 
 
 
//---------------------------------------------------------
 
//    Options
 
//---------------------------------------------------------
 
 
 
#include "gfx/menu_pix/options/options.h"
 
#include "gfx/menu_pix/options/button.h"
 
 
 
//---------------------------------------------------------
 
//    START GAME FILE INCLUSION BELOW
 
//---------------------------------------------------------
 
 
 
//For All Games
 
  #include "games/All/Game_Lose.h"
 
  #include "games/All/Game_Win.h"
 
  #include "games/All/Game_Over.h"
 
 
 
//Game 1 - Tunnel
 
      #include "games/Game 1 - Tunnel/game1_play.h"
 
      #include "games/Game 1 - Tunnel/game1_start.h"
 
      #include "games/Game 1 - Tunnel/thing.h"
 
     
 
//Game 2 - Target
 
      #include "games/Game 2 - Target/bkgd2.h"
 
      #include "games/Game 2 - Target/target.h"
 
      #include "games/Game 2 - Target/crosshair.h"
 
     
 
//Game 3 - Search Light
 
     
 
//Game 4 - SpaceTravel
 
      #include "games/Game 4 - SpaceTravel/Space4.h"
 
      #include "games/Game 4 - SpaceTravel/Spaceship.h"
 
 
 
//Game 5 - The Square
 
 
 
//---------------------------------------------------------
 
//    END OF FILE INCLUSION
 
//---------------------------------------------------------
 
///////////////////////////////////////////////////////////
 
//---------------------------------------------------------
 
//    Important Variables and Functions
 
//---------------------------------------------------------
 
 
 
void GRRLIB_FreeTexture(struct GRRLIB_texImg *tex)  //Declared here because of errors relating to not being declared.
 
{ //This is still part of GRRLIB, though.
 
    free(tex->data);
 
    free(tex);
 
    tex = NULL;
 
}
 
 
 
//Easy color codes from Crayon...
 
 
 
#define BLACK  0x000000FF
 
#define MAROON  0x800000FF
 
#define GREEN  0x008000FF
 
#define OLIVE  0x808000FF
 
#define NAVY    0x000080FF
 
#define PURPLE  0x800080FF
 
#define TEAL    0x008080FF
 
#define GRAY    0x808080FF
 
#define SILVER  0xC0C0C0FF
 
#define RED    0xFF0000FF
 
#define LIME    0x00FF00FF
 
#define YELLOW  0xFFFF00FF
 
#define BLUE    0x0000FFFF
 
#define FUCHSIA 0xFF00FFFF
 
#define AQUA    0x00FFFFFF
 
#define WHITE  0xFFFFFFFF
 
 
 
void clrscr()
 
{GRRLIB_FillScreen(BLACK);}
 
 
 
Mtx GXmodelView2D;  //Needed for GRRLIB
 
 
 
//Wiimote 1
 
ir_t ir1;  //IR Movement
 
 
orient_t or1;  //Orientation Movement
 
 
 
time_t start_time, cur_time;  //Time delays/comparisons; may not be used.
 
 
 
bool normal_menu  = true; //If true then the it will be "Lights Off" for the menu.
 
 
 
//---------------------------------------------------------
 
//    Rumble for IR Pointer Going Over a Button
 
//---------------------------------------------------------
 
 
 
bool do_rumble = true;  //This is so the Wiimote only rumbles one time if it's on a button.
 
 
 
void rumble(u32 remote_channel)
 
{
 
if (do_rumble == true)
 
{
 
WPAD_Rumble(remote_channel, 1);
 
 
usleep(25000);
 
 
WPAD_Rumble (remote_channel, 0);
 
 
do_rumble = false;
 
}
 
}
 
 
 
//---------------------------------------------------------
 
//    Game and Score Functions and Variables
 
//---------------------------------------------------------
 
 
 
#define GAME_NUM  1 //Number of [WORKING] games.
 
#define WIN      true  //A constant to help with "Win/Lose Game" instead of "True/False Game".
 
#define LOSE   false  // "ditto"
 
 
 
int  game_score = 0;  //Actual game score.
 
int  game_life  = 5;  //Make lives variable depending on difficulty/options.
 
bool game;   //This either increases your score or decreases your lives based on game performance.
 
bool game_easy = true;//The easy/hard difficulty variable.
 
 
 
void score()
 
{
 
/*
 
THIS IS GOOD IF YOU ARE NOT FAMILIAR WITH printf AND RELATED.
 
NORMALLY, I USE cout AND cin INSTEAD OF printf AND scanf.
 
 
 
EXCERPTED FROM DEV-CPP HELP ON INPUT/OUTPUT IN C.
 
 
 
The % Format Specifiers:
 
 
 
The % specifiers that you can use in ANSI C are:
 
 
 
      Usual variable type          Display
 
 
 
%c        char                    single character
 
%d (%i)  int                      signed integer
 
%e (%E)  float or double          exponential format
 
%f        float or double          signed decimal
 
%g (%G)  float or double          use %f or %e as required
 
%o        int                      unsigned octal value
 
 
 
%p        pointer                  address stored in pointer
 
%s        array of char            sequence of characters
 
%u        int                      unsigned decimal
 
%x (%X)  int                      unsigned hex value
 
*/
 
clrscr();
 
 
GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font);
 
GRRLIB_InitTileSet(tex_font, 16, 16, 32);
 
 
GRRLIB_Printf(100, 100, tex_font, BLACK, 2, "SCORE: %d", game_score );
 
 
GRRLIB_Printf(100, 175, tex_font, BLACK, 2, "LIVES: %d", game_life);
 
 
GRRLIB_Printf(100, 250, tex_font, BLACK, 2, (game_easy == true ? "DIFFICULTY: EASY" : "DIFFICULTY: HARD") );
 
 
GRRLIB_Render();
 
 
usleep(3000000);
 
 
GRRLIB_FreeTexture(tex_font);
 
 
clrscr();
 
}
 
 
 
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 
//    Main Game Program
 
//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
 
 
void GAME()
 
{
 
clrscr();
 
 
//For All Games | Win & Lose |
 
GRRLIB_texImg *tex_Game_Win  = GRRLIB_LoadTexture(Game_Win);
 
GRRLIB_texImg *tex_Game_Lose  = GRRLIB_LoadTexture(Game_Lose);
 
GRRLIB_texImg *tex_Game_Over  = GRRLIB_LoadTexture(Game_Over);
 
 
bool game_played[GAME_NUM];
 
 
for (int game_count = 1; game_count <= GAME_NUM; game_count++)  //This is to keep track of which games have been played
 
{game_played[game_count - 1] = false;}  //in a session.
 
 
 
while(1)
 
{
 
srand((unsigned)time(0));  //Generates a random number then starts a random game based off that number.
 
int random = ( (rand() % GAME_NUM)+1);
 
 
for (int game_count = 1; game_count <= GAME_NUM; game_count++)
 
{
 
if (game_played[game_count - 1] == true)
 
{continue;}  //If game has been played then it will go back to the beginning of the loop.
 
}
 
//.........................................................
 
if (random == 1)
 
{
 
GRRLIB_texImg *tex_thing      = GRRLIB_LoadTexture(thing);
 
GRRLIB_texImg *tex_game1_start = GRRLIB_LoadTexture(game1_start);
 
GRRLIB_texImg *tex_game1_play  = GRRLIB_LoadTexture(game1_play);
 
 
while(1)
 
{
 
GRRLIB_DrawImg(0, 0, tex_game1_start, 0, 1, 1, BLACK);
 
 
GRRLIB_DrawImg(ir1.x - (32), ir1.y - (26), tex_thing, or1.roll, ir1.z, ir1.z, BLACK);
 
 
GRRLIB_Render();
 
 
clrscr();
 
/*
 
if () //These are conditionals for declaring whether or not the game is won.
 
{game = WIN;}
 
 
else if ()
 
{game = LOSE;}
 
*/
 
}
 
 
game_played[0] = true;  //Game has been played.
 
 
GRRLIB_FreeTexture (tex_thing);
 
GRRLIB_FreeTexture (tex_game1_start);
 
GRRLIB_FreeTexture (tex_game1_play);
 
}
 
//.........................................................
 
/* else if (random == 2)
 
{}
 
 
else if (random == 3)
 
{}
 
 
else if (random == 4)
 
{}
 
*/
 
if (game == WIN)
 
{
 
game_score++;
 
 
GRRLIB_DrawImg( 0, 0, tex_Game_Win, 0, 1, 1, BLACK);
 
 
if ( (game_score % 10) == 0 )  //You get an extra life for every 10 pts attained.
 
{game_life++;} 
 
}
 
 
else if (game == LOSE)
 
{
 
game_life--;
 
 
GRRLIB_DrawImg( 0, 0, tex_Game_Lose, 0, 1, 1, BLACK);
 
}
 
 
GRRLIB_Render();
 
 
usleep(4000000);
 
 
score();  //Displays score.
 
 
if (game_life <= 0)  //To be conbined with score later (break won't work if in score();).
 
{
 
GRRLIB_DrawImg( 0, 0, tex_Game_Over, 0, 1, 1, BLACK);
 
 
GRRLIB_Render();
 
 
usleep(4000000);
 
 
break;
 
}
 
 
 
}
 
}
 
 
 
//---------------------------------------------------------
 
//    Options Function
 
//---------------------------------------------------------
 
 
 
void OPTIONS()
 
{
 
/* Locations
 
First Button: 
 
 
 
X 540-152 = 388
 
Y 280-76  = 204
 
 
 
Second Button:
 
 
 
X 540-152 = 388
 
Y 380-76  = 304
 
*/
 
  GRRLIB_texImg *tex_options = GRRLIB_LoadTexture(options);
 
  GRRLIB_texImg *tex_button  = GRRLIB_LoadTexture(button);
 
  GRRLIB_texImg *tex_pointer1  = GRRLIB_LoadTexture(pointer1);
 
 
 
  while(1)
 
  {
 
WPAD_ScanPads();
 
 
if (WPAD_ButtonsDown(0) && WPAD_BUTTON_PLUS)
 
{
 
GRRLIB_FreeTexture(tex_options);
 
GRRLIB_FreeTexture(tex_button);
 
 
score();
 
 
break;
 
}
 
 
 
clrscr();
 
 
GRRLIB_DrawImg( 0, 0, tex_options, 0, 1, 1, BLACK);
 
 
if (normal_menu == true)  //Because the normal menu is "Lights Off"
 
{GRRLIB_DrawImg( 388, 204, tex_button, 0, 1, 1, BLACK);}
 
 
if (game_easy == false)  //But easy is on and not easy is off.
 
{GRRLIB_DrawImg( 388, 304, tex_button, 0, 1, 1, BLACK);}
 
 
WPAD_IR(WPAD_CHAN_0, &ir1);          //For Wiimote 1 IR.
 
WPAD_Orientation(WPAD_CHAN_0, &or1);  //For Wiimote 1 orientation.
 
 
GRRLIB_DrawImg(ir1.x - 48, ir1.y - 45, tex_pointer1, or1.roll, ir1.z, ir1.z, BLACK);
 
 
GRRLIB_Render();
 
 
if ( ((ir1.x >= 388) & (ir1.x <= 540)) & ((ir1.y >= 204) & (ir1.y <= 280)) )
 
{
 
rumble(0);
 
 
WPAD_ScanPads();
 
 
if (WPAD_BUTTON_A & WPAD_ButtonsDown(0))
 
{
 
if (normal_menu == true)  //Lights off.
 
{normal_menu = false;}
 
 
else if (normal_menu == false)  //Lights on.
 
{normal_menu = true;}
 
}
 
 
}
 
 
else if ( ((ir1.x >= 388) & (ir1.x <= 540)) & ((ir1.y >= 304) & (ir1.y <= 380)) )
 
{
 
rumble(0);
 
 
WPAD_ScanPads();
 
 
if (WPAD_BUTTON_A & WPAD_ButtonsDown(0))
 
{
 
if (game_easy == true)
 
{
 
game_easy = false;
 
game_life = 3;
 
}
 
 
else if (game_easy == false)
 
{
 
game_easy = true;
 
game_life = 5;
 
}
 
}
 
}
 
 
else
 
{do_rumble = true;}
 
 
  }
 
 
}
 
 
 
//---------------------------------------------------------
 
//    Intro/Credits Function
 
//---------------------------------------------------------
 
 
 
void play_intro()
 
{
 
clrscr();
 
 
GRRLIB_texImg *tex_intro = GRRLIB_LoadTexture(intro);
 
 
GRRLIB_DrawImg( 0, 0, tex_intro, 0, 1, 1, BLACK);
 
 
GRRLIB_Render();
 
 
usleep(400000);
 
 
 
GRRLIB_FreeTexture(tex_intro);
 
 
 
clrscr();
 
}
 
//
 
///////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////
 
////-------------------------------------------------------////
 
////    Main Program                                      ////
 
////-------------------------------------------------------////
 
///////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////
 
//
 
int main()
 
{
 
GRRLIB_texImg *tex_pointer1  = GRRLIB_LoadTexture(pointer1);
 
 
GRRLIB_texImg *tex_menu      = GRRLIB_LoadTexture(menu);
 
 
GRRLIB_texImg *tex_button1    = GRRLIB_LoadTexture(button1);
 
GRRLIB_texImg *tex_button2    = GRRLIB_LoadTexture(button2);
 
GRRLIB_texImg *tex_button3    = GRRLIB_LoadTexture(button3);
 
 
GRRLIB_texImg *tex_pointer1_i = GRRLIB_LoadTexture(pointer1_i);
 
 
GRRLIB_texImg *tex_menu_i    = GRRLIB_LoadTexture(menu_i);
 
 
GRRLIB_texImg *tex_button1_i  = GRRLIB_LoadTexture(button1_i);
 
GRRLIB_texImg *tex_button2_i  = GRRLIB_LoadTexture(button2_i);
 
GRRLIB_texImg *tex_button3_i  = GRRLIB_LoadTexture(button3_i);
 
 
    GRRLIB_Init(); //Starts GRRLIB
 
 
WPAD_Init();  //Start WPAD-related Stuff
 
 
WPAD_SetDataFormat(WPAD_CHAN_0, WPAD_FMT_BTNS_ACC_IR);
 
 
WPAD_SetVRes(WPAD_CHAN_0, 640, 480);
 
 
play_intro();  //Plays intro/credits
 
   
 
while(1)
 
{
 
//***********MENU START******************************************************************************
 
 
 
GRRLIB_DrawImg( 0, 0, (normal_menu == true ? tex_menu : tex_menu_i), 0, 1, 1, BLACK);
 
 
WPAD_ScanPads();
 
 
//***********START***********************************************************************************
 
if ( ( (ir1.x >= 20) & (ir1.x <= 212) & ( (ir1.y >= 364) & (ir1.y <= 620) ) ) )
 
{
 
rumble(0);
 
 
GRRLIB_DrawImg(20, 364, (normal_menu == true ? tex_button1 : tex_button1_i), 0, 1, 1, BLACK);
 
 
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A)
 
{GAME();}
 
 
//************OPTIONS********************************************************************************
 
else if ( ( (ir1.x >= 225) & (ir1.x <= 417) ) & ( (ir1.y >= 364) & (ir1.y <= 620) ) )
 
{
 
rumble(0);
 
 
GRRLIB_DrawImg(225, 364, (normal_menu == true ? tex_button2 : tex_button2_i), 0, 1, 1, BLACK);
 
 
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A)
 
{OPTIONS();}
 
 
 
 
//************EXIT***********************************************************************************
 
else if ( ( (ir1.x >= 428) & (ir1.x <= 620) ) & ( (ir1.y >= 364) & (ir1.y <= 620) ) )
 
{
 
rumble(0);
 
 
GRRLIB_DrawImg(428, 364, (normal_menu == true ? tex_button3 : tex_button3_i), 0, 1, 1, BLACK);
 
 
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A)
 
{goto exit;}
 
 
//************FOR RUMBLE*****************************************************************************
 
else
 
{do_rumble = true;}
 
//***********END LOOP }******************************************************************************
 
WPAD_IR(WPAD_CHAN_0, &ir1);          //For Wiimote 1 IR.
 
WPAD_Orientation(WPAD_CHAN_0, &or1);  //For Wiimote 1 orientation.
 
 
GRRLIB_DrawImg(ir1.x - 48, ir1.y - 45, (normal_menu == true ? tex_pointer1 : tex_pointer1_i), or1.roll, ir1.z, ir1.z, BLACK);
 
 
GRRLIB_Render();
 
 
clrscr();
 
}
 
//***********END*************************************************************************************
 
exit: //This is just in case I add anything after the loop, then it will exit correctly.
 
 
GRRLIB_FreeTexture(tex_pointer1);  //Not necessarily needed due to GRRLIB_Exit();, but here for future revision.
 
 
GRRLIB_FreeTexture(tex_menu);
 
 
GRRLIB_FreeTexture (tex_button1);
 
GRRLIB_FreeTexture (tex_button2);
 
GRRLIB_FreeTexture (tex_button3);
 
 
GRRLIB_FreeTexture (tex_pointer1_i);
 
 
GRRLIB_FreeTexture (tex_menu_i);
 
 
GRRLIB_FreeTexture (tex_button1_i);
 
GRRLIB_FreeTexture (tex_button2_i);
 
GRRLIB_FreeTexture (tex_button3_i);
 
 
GRRLIB_Exit();  // Be a good boy, clear the memory allocated by GRRLIB
 
 
    return 0;
 
}
 
 
 
//---------------------------------------------------------
 
//    End of Program
 
//---------------------------------------------------------
 
 
 
</source>
 
:Hi, did you see that post: http://grrlib.santo.fr/forum/viewtopic.php?pid=795#p795 from 2009-06-30 17:14:17? -[[User:Crayon|Crayon]] 03:05, 7 July 2009 (UTC)
 
 
::Oh no, I didn't see that. I'll start implementing it tomorrow (as I've been on vacation a few days...), but thanks Crayon once again! --[[User:TPAINROXX|<font face="VINETA BT"><font color="black">-TPAINROXX</font>/<font color="green">BKW</font></font>]] 03:19, 7 July 2009 (UTC)
 

Revision as of 22:55, 7 July 2009

...