byte copy/reverse function for Game A Gogo

You must understand the Game Editor concepts, before post here.

byte copy/reverse function for Game A Gogo

Postby Sgt. Sparky » Tue Jul 10, 2007 7:35 pm

here is the function Game A Gogo. :D
Code: Select all
char smpl[255];
void sample(char s[255])
{
    strcpy(smpl, s);
}
void printsample(char s[255])
{
    strcpy(s, smpl);
}
void reverse(char s[255])
{
     int c, i, j;
     sample(s);
     for(i = 0, j = strlen(smpl)-1; i < j; i++, j--) {
           c = smpl[i];
           smpl[i] = smpl[j];
           smpl[j] = c;
                                                     }
      printsample(s);
}
void bytecpy(char chvar[255])
{
    strncpy(tempe, &chvar[0], 1);
    strcat(newchar[0], tempe);
    strncpy(tempe, &chvar[1], 1);
    strcat(newchar[0], tempe);
    strncpy(tempe, &chvar[2], 1);
    strcat(newchar[1], tempe);
    strncpy(tempe, &chvar[3], 1);
    strcat(newchar[1], tempe);
    strncpy(tempe, &chvar[4], 1);
    strcat(newchar[2], tempe);
    strncpy(tempe, &chvar[5], 1);
    strcat(newchar[2], tempe);
    strncpy(tempe, &chvar[6], 1);
    strcat(newchar[3], tempe);
    strncpy(tempe, &chvar[7], 1);
    strcat(newchar[3], tempe);
    reverse(newchar[0]);
    reverse(newchar[1]);
    reverse(newchar[2]);
    reverse(newchar[3]);
}

you know how to put it in global,
to use this after you put it in global just use on any event
Code: Select all
bytecopy(text);//or whatever other source.

I could have made the function alot simpler, but I wanted to work fast. :(
(limited time)
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Fuzzy » Tue Jul 10, 2007 9:36 pm

Sparky is a genius. i was trying to teach gogo how to do that with bit operators, and i totally looked over the fact that they could be used as text.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby Game A Gogo » Wed Jul 11, 2007 12:11 am

Ok, I will defenetly give it a try! Even if this confuses me a little xD
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Game A Gogo » Wed Jul 11, 2007 12:15 am

There are about two variable that are not declared and it causes error, and I dunno how to declare them :/
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Sgt. Sparky » Wed Jul 11, 2007 2:20 am

I IM'd you on how to declare them.

and thanks Fuzzy. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest