Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - miotatsu

Pages: 1 [2]
16
Other Calculators / Hard Drive Wiped
« on: February 19, 2010, 12:18:34 am »
I regret to inform you all that my hard drive was wiped from an accidental format, i was unable to recover my projects and will be starting them over from scratch, new topics will be made for each project and the old ones locked.
luckily this is not as bad as it sounds, i probably have Piworld PC on my other computer, and Pifreak still has the original BasiC++ source, so when i say starting over from scratch that is a bit of an exaggeration. However i may/may not start them over from scratch anyway for various reasons.

17
Computer Projects and Ideas / BasiC++ Screenies
« on: February 18, 2010, 11:57:28 pm »
eye candy will go here, no discussion.

18
Computer Projects and Ideas / BasiC++ Downloads
« on: February 18, 2010, 11:56:12 pm »
this topic will be for BasiC++ downloads only, no discussion here

19
Computer Projects and Ideas / ATI-BASIC
« on: December 24, 2009, 03:23:09 am »
BasiC++ will be an interpreted programming language for the PC based directly off of Ti-Basic
currently it has:
ClrDraw
Pxl-On
Pxl-Off
Pxl-Change
Getkey(sort of)
storing(sort of)

right now i am working on the font system to be used with Text()

current features i want to get implemented are:
and
Ans
Else
End
For
getkey
Goto
If
Input
Lbl
not
or
Pause
Prgm
Prompt
Pxl-Test
RecallPic
Repeat
Return
Stop
Text
While
xor

credits go to pifreak for the original BasiC++ source :{D

info on why file loading wasn't working:

i was declaring
std::string Filename;
globally, (this is a string to hold the name of the file that gets loaded into the system, its declared globally so everything can use the code, it isn't limited to one single function)
next in the main function i stored the contents of the Filename into the string so that it can be opened in my run() function
std::string Filename = argv[1];
(when you drag and drop a file onto the program the name of the file is stored in Argv[1])
This will not work. What happens here is that the string is re-declared locally, this means it can't be used outside of main, this is because putting std::string in front of Filename tells it that you are declaring filename as a string, which overides the previous declaration.
in order to fix this you simply do
Filename = argv[1];
as can be seen it is a very basic mistake, but it should definitely be payed attention to because it can cause a lot of trouble if one doesn't understand it
thanks go to Chile from Efnet's #C++ for pointing this out to me, and pifreak for helping as well and stuff :)

20
Computer Projects and Ideas / piworld PC (old)
« on: November 21, 2009, 12:17:53 am »
Piworld PC Demo v0.2 download: http://www.megaupload.com/?d=R20BJLFT
source:
Code: [Select]
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_Mixer.h"
#include <string>
#include <fstream>
#include <sstream>

const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;

const int FRAMES_PER_SECOND = 20;

const int DOT_WIDTH = 20;
const int DOT_HEIGHT = 20;

const int LEVEL_WIDTH = 1280;
const int LEVEL_HEIGHT = 960;
int AREAX = 190;
int AREAY = 190;

const int TILE_WIDTH = 80;
const int TILE_HEIGHT = 80;
const int TOTAL_TILES = 192;
const int TILE_SPRITES = 12;

const int TILE_00 = 0;
const int TILE_01 = 1;
const int TILE_02 = 2;
const int TILE_03 = 3;
const int TILE_04 = 4;
const int TILE_05 = 5;
const int TILE_06 = 6;
const int TILE_07 = 7;
const int TILE_08 = 8;
const int TILE_09 = 9;
const int TILE_10 = 10;
const int TILE_11 = 11;

SDL_Surface *dot = NULL;
SDL_Surface *screen = NULL;
SDL_Surface *tileSheet = NULL;

SDL_Rect clips[ TILE_SPRITES ];

SDL_Event event;

SDL_Rect camera = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT };

Mix_Music *music = NULL;

class Tile
{
    private:
    SDL_Rect box;

    int type;

    public:
    Tile( int x, int y, int tileType );

    void show();

    int get_type();

    SDL_Rect get_box();
};

class Dot
{
    private:
    SDL_Rect box;

    int xVel, yVel;

    public:
    Dot();

    void handle_input();

    void move( Tile *tiles[] );

    void show();

    void set_camera();
};

class Timer
{
    private:
    int startTicks;

    int pausedTicks;

    bool paused;
    bool started;

    public:
    Timer();

    void start();
    void stop();
    void pause();
    void unpause();

    int get_ticks();

    bool is_started();
    bool is_paused();
};

SDL_Surface *load_image( std::string filename )
{
    SDL_Surface* loadedImage = NULL;

    SDL_Surface* optimizedImage = NULL;

    loadedImage = IMG_Load( filename.c_str() );

    if( loadedImage != NULL )
    {
        optimizedImage = SDL_DisplayFormat( loadedImage );

        SDL_FreeSurface( loadedImage );

        if( optimizedImage != NULL )
        {
            SDL_SetColorKey( optimizedImage, SDL_SRCCOLORKEY, SDL_MapRGB( optimizedImage->format, 0, 0xFF, 0xFF ) );
        }
    }

    return optimizedImage;
}

void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL )
{
    SDL_Rect offset;

    offset.x = x;
    offset.y = y;

    SDL_BlitSurface( source, clip, destination, &offset );
}

bool check_collision( SDL_Rect A, SDL_Rect B )
{
    int leftA, leftB;
    int rightA, rightB;
    int topA, topB;
    int bottomA, bottomB;

    leftA = A.x;
    rightA = A.x + A.w;
    topA = A.y;
    bottomA = A.y + A.h;

    leftB = B.x;
    rightB = B.x + B.w;
    topB = B.y;
    bottomB = B.y + B.h;

    if( bottomA <= topB )
    {
        return false;
    }

    if( topA >= bottomB )
    {
        return false;
    }

    if( rightA <= leftB )
    {
        return false;
    }

    if( leftA >= rightB )
    {
        return false;
    }

    return true;
}

bool init()
{
    if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
    {
        return false;
    }

    screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );

    if( screen == NULL )
    {
        return false;
    }
    
    if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 )
    {
        return false;
    }

    return true;
}

bool load_files()
{
    dot = load_image( "Images/dot.png" );

    if( dot == NULL )
    {
        return false;
    }

    tileSheet = load_image( "Images/tiles.png" );

    if( tileSheet == NULL )
    {
        return false;
    }
    
    music = Mix_LoadMUS( "Music/Music1.mp3" );

    if( music == NULL )
    {
        return false;
    }

    return true;
}

void clean_up( Tile *tiles[] )
{
    SDL_FreeSurface( dot );
    SDL_FreeSurface( tileSheet );

    for( int t = 0; t < TOTAL_TILES; t++ )
    {
        delete tiles[ t ];
    }
    
    Mix_FreeMusic( music );

    Mix_CloseAudio();

    SDL_Quit();
}

void clip_tiles()
{
    clips[ TILE_00 ].x = 0;
    clips[ TILE_00 ].y = 0;
    clips[ TILE_00 ].w = TILE_WIDTH;
    clips[ TILE_00 ].h = TILE_HEIGHT;

    clips[ TILE_01 ].x = 0;
    clips[ TILE_01 ].y = 80;
    clips[ TILE_01 ].w = TILE_WIDTH;
    clips[ TILE_01 ].h = TILE_HEIGHT;

    clips[ TILE_02 ].x = 0;
    clips[ TILE_02 ].y = 160;
    clips[ TILE_02 ].w = TILE_WIDTH;
    clips[ TILE_02 ].h = TILE_HEIGHT;

    clips[ TILE_11 ].x = 80;
    clips[ TILE_11 ].y = 0;
    clips[ TILE_11 ].w = TILE_WIDTH;
    clips[ TILE_11 ].h = TILE_HEIGHT;

    clips[ TILE_10 ].x = 80;
    clips[ TILE_10 ].y = 80;
    clips[ TILE_10 ].w = TILE_WIDTH;
    clips[ TILE_10 ].h = TILE_HEIGHT;

    clips[ TILE_09 ].x = 80;
    clips[ TILE_09 ].y = 160;
    clips[ TILE_09 ].w = TILE_WIDTH;
    clips[ TILE_09 ].h = TILE_HEIGHT;

    clips[ TILE_04 ].x = 160;
    clips[ TILE_04 ].y = 0;
    clips[ TILE_04 ].w = TILE_WIDTH;
    clips[ TILE_04 ].h = TILE_HEIGHT;

    clips[ TILE_03 ].x = 160;
    clips[ TILE_03 ].y = 80;
    clips[ TILE_03 ].w = TILE_WIDTH;
    clips[ TILE_03 ].h = TILE_HEIGHT;

    clips[ TILE_08 ].x = 160;
    clips[ TILE_08 ].y = 160;
    clips[ TILE_08 ].w = TILE_WIDTH;
    clips[ TILE_08 ].h = TILE_HEIGHT;

    clips[ TILE_05 ].x = 240;
    clips[ TILE_05 ].y = 0;
    clips[ TILE_05 ].w = TILE_WIDTH;
    clips[ TILE_05 ].h = TILE_HEIGHT;

    clips[ TILE_06 ].x = 240;
    clips[ TILE_06 ].y = 80;
    clips[ TILE_06 ].w = TILE_WIDTH;
    clips[ TILE_06 ].h = TILE_HEIGHT;

    clips[ TILE_07 ].x = 240;
    clips[ TILE_07 ].y = 160;
    clips[ TILE_07 ].w = TILE_WIDTH;
    clips[ TILE_07 ].h = TILE_HEIGHT;
}

bool set_tiles( Tile *tiles[] )
{
    int x = 0, y = 0;

    std::ifstream map( "Maps/MAP1.map" );

    if( map == NULL )
    {
        return false;
    }

    for( int t = 0; t < TOTAL_TILES; t++ )
    {
        int tileType = -1;

        map >> tileType;

        if( map.fail() == true )
        {
            map.close();
            return false;
        }

        if( ( tileType >= 0 ) && ( tileType < TILE_SPRITES ) )
        {
            tiles[ t ] = new Tile( x, y, tileType );
        }
        else
        {
            map.close();
            return false;
        }

        x += TILE_WIDTH;

        if( x >= LEVEL_WIDTH )
        {
            x = 0;

            y += TILE_HEIGHT;
        }
    }

    map.close();

    return true;
}

bool touches_wall( SDL_Rect box, Tile *tiles[] )
{
    for( int t = 0; t < TOTAL_TILES; t++ )
    {
        if( ( tiles[ t ]->get_type() >= TILE_03 ) && ( tiles[ t ]->get_type() <= TILE_11 ) )
        {
            if( check_collision( box, tiles[ t ]->get_box() ) == true )
            {
                return true;
            }
        }
    }

    return false;
}

Tile::Tile( int x, int y, int tileType )
{
    box.x = x;
    box.y = y;

    box.w = TILE_WIDTH;
    box.h = TILE_HEIGHT;

    type = tileType;
}

void Tile::show()
{
    if( check_collision( camera, box ) == true )
    {
        apply_surface( box.x - camera.x, box.y - camera.y, tileSheet, screen, &clips[ type ] );
    }
}

int Tile::get_type()
{
    return type;
}

SDL_Rect Tile::get_box()
{
    return box;
}

Dot::Dot()
{
    box.x = 190;
    box.y = 190;
    box.w = DOT_WIDTH;
    box.h = DOT_HEIGHT;

    xVel = 0;
    yVel = 0;
}

void Dot::handle_input()
{
    if( event.type == SDL_KEYDOWN )
    {
        switch( event.key.keysym.sym )
        {
            case SDLK_UP: yVel -= DOT_HEIGHT / 2; break;
            case SDLK_DOWN: yVel += DOT_HEIGHT / 2; break;
            case SDLK_LEFT: xVel -= DOT_WIDTH / 2; break;
            case SDLK_RIGHT: xVel += DOT_WIDTH / 2; break;
        }
    }
    else if( event.type == SDL_KEYUP )
    {
        switch( event.key.keysym.sym )
        {
            case SDLK_UP: yVel += DOT_HEIGHT / 2; break;
            case SDLK_DOWN: yVel -= DOT_HEIGHT / 2; break;
            case SDLK_LEFT: xVel += DOT_WIDTH / 2; break;
            case SDLK_RIGHT: xVel -= DOT_WIDTH / 2; break;
        }
    }
}

void Dot::move( Tile *tiles[] )
{
    box.x += xVel;
    AREAX += xVel;

    if( ( box.x < 0 ) || ( box.x + DOT_WIDTH > LEVEL_WIDTH ) || touches_wall( box, tiles ) )
    {
        box.x -= xVel;
        AREAX -= xVel;
    }
    
    box.y += yVel;
    AREAY += yVel;

    if( ( box.y < 0 ) || ( box.y + DOT_HEIGHT > LEVEL_HEIGHT ) || touches_wall( box, tiles ) )
    {
        box.y -= yVel;
        AREAY -= yVel;
    }
            
        std::stringstream caption;
        caption << "DEMO " << box.x << "  " << box.y;
        SDL_WM_SetCaption( caption.str().c_str(), NULL );
    
}

void Dot::show()
{
    apply_surface( box.x - camera.x, box.y - camera.y, dot, screen );
}

void Dot::set_camera()
{
    if( ( AREAX >= SCREEN_WIDTH ) && ( box.x < LEVEL_WIDTH ) && ( xVel == 10 ) )
    {
        for( int SCROLL = 0; SCROLL < 650; SCROLL += 10 )
        {
             camera.x = SCROLL;
        }
        AREAX -= SCREEN_WIDTH;
    }
    
    if( ( AREAX <= -15 ) && ( box.x > 0 ) && ( xVel == -10 ) )    
    {
        for( int SCROLL = 650; SCROLL > -10; SCROLL -= 10 )
        {
             camera.x = SCROLL;
        }
        AREAX += SCREEN_WIDTH;
}

if( ( AREAY >= SCREEN_HEIGHT ) && ( box.y < LEVEL_HEIGHT ) && ( yVel == 10 ) )
{
    for( int SCROLL = 0; SCROLL < 490; SCROLL += 10 )
    {
         camera.y = SCROLL;
    }
    AREAY -= SCREEN_HEIGHT;
}

if( ( AREAY <= -15 ) && ( box.y > 0 ) && ( yVel == -10 ) )
{
    for( int SCROLL = 490; SCROLL > -10; SCROLL -= 10 )
    {
         camera.y = SCROLL;
    }
    AREAY += SCREEN_HEIGHT;
}

}

Timer::Timer()
{
    startTicks = 0;
    pausedTicks = 0;
    paused = false;
    started = false;
}

void Timer::start()
{
    started = true;

    paused = false;

    startTicks = SDL_GetTicks();
}

void Timer::stop()
{
    started = false;

    paused = false;
}

void Timer::pause()
{
    if( ( started == true ) && ( paused == false ) )
    {
        paused = true;

        pausedTicks = SDL_GetTicks() - startTicks;
    }
}

void Timer::unpause()
{
    if( paused == true )
    {
        paused = false;

        startTicks = SDL_GetTicks() - pausedTicks;

        pausedTicks = 0;
    }
}

int Timer::get_ticks()
{
    if( started == true )
    {
        if( paused == true )
        {
            return pausedTicks;
        }
        else
        {
            return SDL_GetTicks() - startTicks;
        }
    }

    return 0;
}

bool Timer::is_started()
{
    return started;
}

bool Timer::is_paused()
{
    return paused;
}

int main( int argc, char* args[] )
{
    bool quit = false;

    Dot myDot;

    Tile *tiles[ TOTAL_TILES ];

    Timer fps;

    if( init() == false )
    {
        return 1;
    }

    if( load_files() == false )
    {
        return 1;
    }

    clip_tiles();

    if( set_tiles( tiles ) == false )
    {
        return 1;
    }

    if( Mix_PlayMusic( music, -1 ) == -1 ) { return 1; }

    while( quit == false )
    {
        fps.start();

        while( SDL_PollEvent( &event ) )
        {
            myDot.handle_input();

            if( event.type == SDL_QUIT )
            {
                quit = true;
            }
        }

        myDot.move( tiles );

        myDot.set_camera();
        
        for( int t = 0; t < TOTAL_TILES; t++ )
        {
            tiles[ t ]->show();
        }

        myDot.show();

        if( SDL_Flip( screen ) == -1 )
        {
            return 1;
        }

        if( fps.get_ticks() < 1000 / FRAMES_PER_SECOND )
        {
            SDL_Delay( ( 1000 / FRAMES_PER_SECOND ) - fps.get_ticks() );
        }
        
    }

    clean_up( tiles );

    return 0;
}

21
TI Z80 / piworld 83+ ScreenShots and Concept Art
« on: October 16, 2009, 08:37:58 pm »
ScreenShots:

Starting town:


West of Town:


The Maze:


South of Town:


unnamed area:


North of Town:


Talking to one of the NPC's:


GamePlay:


V1.0:


Creatures Loading:

22
TI Z80 / piworld 83+ Creature Demo
« on: October 01, 2009, 08:56:22 pm »
a quick demo of what the creatures will be like in piworld, this version is unoptimized and so it runs a bit slow, has a glitch with the health display, and could be better, but its my first attempt at creatures, and i think its a pretty good start, i hope you guys like it


23
Introduce Yourself! / Ohai
« on: July 26, 2009, 10:26:03 pm »
Ohai, i believe i would be the only person posting in here who is actually new xD

24
TI Z80 / piworld 83+
« on: July 19, 2009, 10:04:45 pm »
I am currently working on a pure ti-basic adventure game named piworld.
as of now i have:
    6 maps
     1 item
     2 npc's
     1 warp tile
     a good movement engine
     collision detection
the game uses ASCII characters for the npc's and main character and the maps are called up using Iambian's asm lib PicArc, it runs on the graph screen. the game is still in its very early stages of development but once i have creatures to fight and a few other things i'll release it.

Pages: 1 [2]