Blastcore development thread

Discussion in 'Development General' started by Blastcore, Dec 31, 2010.

  1. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Yeah, RegExp. (QRegExp) Basically, ive found some issue. For when people does " + lalla + " they can do it like "+lala+" "+ lala+" "+ lala+", etc. Think that would be an issue?
     
  2. Super SkarmPiss

    Super SkarmPiss Member

    Joined:
    Jul 27, 2011
    Messages:
    36
    Likes Received:
    0
    What do you mean?
     
  3. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    He probably found out he can't parse context free languages with regular grammars.
     
    Last edited: Aug 19, 2011
  4. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Well here is an example of what ive said:

    You can do in your script " + sys.name(src) + " "+sys.name(src)+" " +sys.name(src) + " "+ sys.name(src)+ ", etc. I think you found the difference between them, right? Well, if you find the diferences, youll know of what im taliking about hehe.
     
  5. Super SkarmPiss

    Super SkarmPiss Member

    Joined:
    Jul 27, 2011
    Messages:
    36
    Likes Received:
    0
    I don't see why that would be problematic. Just use regular expressions.
     
  6. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Creating lot of Regular Expressions since people can use different ways to show something? The spaces, the spaces are the problem...
     
  7. Super SkarmPiss

    Super SkarmPiss Member

    Joined:
    Jul 27, 2011
    Messages:
    36
    Likes Received:
    0
    Use the \s class with the ? quantifier or something. o-o Can you possibly post the code you have for the highlighter? http://pastebin.com
     
  8. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Just redoing it, though. Need Qt finish download, gah. Takes years. (Online Installer)
     
  9. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Well, i managed to add Animated Gifs (Well, still not in-game, done tests and seems to work fine.) of Pokemons. Waiting to see if this will be accepted by coyo and the others before i commit it. (Still need the gifs so we'll have to wait).

    Uploading an image (Well, video?) in a little. :)

    EDIT: Seems hard to implement on PO since the way it displays the pokemon images. I'm using QMovie and a QLabel to display it when PO uses QPixmap, etc, etc to display images.

    I'll wait for some answer before doing something. ;)
     
    Last edited: Dec 9, 2011
  10. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    It's git, make it another branch, that way you don't have to mess with your main line of code.
     
  11. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    I'll work harder on it before doing some sort of release ^^
     
  12. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    It's git, you don't have to push it online, you can keep it in your computer.
     
  13. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Well.

    Pokemoninfo.cpp
    Code (CPP):
    1.  
    2. QMovie *PokemonInfo::AnimatedPicture(const Pokemon::uniqueId &pokeid, int gender, bool shiney, bool back) {
    3.     QString archive;
    4.     archive = path("") + "Animated Sprites/";
    5.     QString file;
    6.     file = QString("%1/%2%3%4.gif").arg(pokeid.toString(), back?"b":"f", (gender==Pokemon::Female)?"f":"", shiney?"s":"");
    7.     QMovie *animationReturn = new QMovie;
    8.     animationReturn->setFileName(QString("%1%2").arg(archive, file));
    9.     animationReturn->start();
    10.     return animationReturn;
    11. }
    12.  
    But here i got the issue. If the Pokemon has no Female Sprite it sets to invisible. How do icheck if it has female sprite?

    Advanced.cpp
    Code (CPP):
    1.  
    2. void TB_Advanced::updatePokeImage()
    3. {
    4.     QSettings s;
    5.     if(s.value("enable_animated_sprites").toBool() == 1) {
    6.         // We need to do it DIRECTLY. If we do it in the same way that poke()->picture() works it'll result
    7.         // In a program crash.
    8.         QMovie *MyMovie = new QMovie();
    9.         MyMovie = PokemonInfo::AnimatedPicture(poke()->num(), poke()->gender(), poke()->shiny(), false);
    10.         pokeImage->setMovie(MyMovie);
    11.         MyMovie->start();
    12.     } else {
    13.         pokeImage->setFixedSize(poke()->picture().size());
    14.         pokeImage->setPixmap(poke()->picture());
    15.     }
    16. }
    [​IMG]

    EDIT 3: The issue seems to be related with the gif, nothing with code. ^_^

    EDIT 4: Video.

    [video=youtube;GKUC0RNJQz8]http://www.youtube.com/watch?v=GKUC0RNJQz8[/video]
     
    Last edited: Dec 10, 2011
  14. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    After updating my fork with the changes done in nixeagle's one got warns & errors while compiling:

    [​IMG]

    EDIT: Those file exists o.O
     
  15. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    Did you merge testing or master? Testing is borken currently, but also merging master might get your code screwed up. Branches have diverged so much.
     
  16. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Oh, god. I merged master.
     
  17. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    Hope you find a solution, you should double check that all files are there.
     
  18. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    I'll try re-downloading all the source from my fork, since all changes are there now.

    I'm also thinking to go back on Windows XP, Developer Preview (WIn 8) becomes slower everytime you use it. ;_;

    EDIT: Files are there, moves1.cpp is a copy of moves.cpp. But we'll wait for him to see.
     
    Last edited: Dec 11, 2011
  19. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    moves1.cpp is not a copy. Those files contain different move implementations. The file had to be split because it became too huge to compile.
     
  20. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    I see. Well, we just can wait i think.
     
  21. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Lol, the errors magically fixed. Weird. Still the unsigned and signed int comparison warns lol.

    EDIT: Lel, i love the image of the server.

    Code (CPP):
    1.  
    2. // basebattlewindow.cpp Also in case SentOut and case SendBack
    3.  
    4.     case UseAttack:
    5.     {
    6.         qint16 attack;
    7.         in >> attack;
    8.         QSettings s;
    9.         if(!qApp->activeWindow() && flashWhenMoved()) {
    10.             qApp->alert(this, 0);
    11.         }
    12.         printHtml(tr("%1 used %2!").arg(escapeHtml(tu(nick(spot))), toBoldColor(MoveInfo::Name(attack), Theme::TypeColor(MoveInfo::Type(attack, gen())))));
    13.         break;
    14.     }
    15.  
    16. bool BaseBattleWindow::flashWhenMoved() const
    17. {
    18.     QSettings s;
    19.     return s.value("flash_when_enemy_moves").toBool();
    20. }
    21.  
    22. // client.cpp
    23.  
    24.     QAction * flashmove = menuActions->addAction(tr("Flash when a move is done"));
    25.     flashmove->setCheckable(true);
    26.     flashmove->setChecked(s.value("flash_when_attack_is_done").toBool());
    27.  
    28. void Client::flashEnable(bool b)
    29. {
    30.     QSettings s;
    31.     s.setValue("flash_when_attack_is_done", b);
    32. }
    33.  
    34. // mainwindow.cpp
    35.  
    36. setDefaultValue(s, "flash_when_attack_is_done", true);
    37.  
    38.  
    Of working, it works.
     
    Last edited: Dec 12, 2011
  22. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    Good, but couple of things:

    Make it a class variable in BaseBattleWindow (or better, even in Client), so the settings file isn't read every time attack is made.

    Add a button to basebattlewindow to toggle it.
     
  23. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Code (CPP):
    1.  
    2. mylayout->addWidget(flashWhenMoveDone = new QCheckBox(tr("Flash when a move is done")), 1, 2, 1, 2);
    3.  
    4.     QSettings s;
    5.     musicOn->setChecked(s.value("play_battle_music").toBool());
    6.     flashWhenMoveDone->setChecked(s.value("flash_when_enemy_moves").toBool());
    7.  
    8. bool BaseBattleWindow::flashWhenMoved() const
    9. {
    10.     return flashWhenMoveDone->isChecked();
    11. }
    12.  
    13. // Same thing in SendOut SendBack and UseAttack
    14.         if(!this->window()->isActiveWindow() && flashWhenMoved()) {
    15.             qApp->alert(this, 0);
    16.         }
    17.  
    :P (Seems like in 30 mins i go to sleep. 3:00 AM lol)
     
    Last edited: Dec 12, 2011
  24. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    Make sure to send Pull request to nixeagle on Github, he won't notice this otherwise.
     
  25. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    I'll. (When i find out how to put the button in the BaseBattleWindow without having to move other things x))

    Also a question for Animated Sprites. Know how to do it but since QMovie doesn't have a readFromData() like QPixmap does it won't be able to read from zip files. Also, i have issues while pokemon changes formes. :(
     
  26. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    It does have a constructor with QIODevice as its parameter. You can pass ie. QBuffer to it which encapsulates the data read from zips.
     
  27. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Well, actually by trying to see how this type of things works (QIODevice and QFile) i got this. Now to make it work with QIODevice (Which is a pain lol)

    Code (CPP):
    1.  
    2. QMovie *PokemonInfo::AnimatedPicture(const Pokemon::uniqueId &pokeid, int gender, bool shiney, bool back)
    3. {
    4.     QString archive = path("black_white_animated.zip");
    5.     QString file = QString("%1/%2%3%4.gif").arg(pokeid.toString(), back?"b":"f", (gender==Pokemon::Female)?"f":"", shiney?"s":"");
    6.     QMovie *AnimatedSprite = new QMovie();
    7.     QByteArray data = readZipFile(archive.toUtf8(), file.toUtf8());
    8.     QFile file2(path("") + "temp.gif");
    9.     file2.open(QIODevice::ReadWrite);
    10.     file2.write(data);
    11.     file2.close();
    12.     AnimatedSprite->setFileName(path("") + "temp.gif");
    13.     AnimatedSprite->start();
    14.     return AnimatedSprite;
    15. }
    16.  
    :D
     
  28. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    QMovie *AnimatedSprite = new QMovie(QBuffer(data));

    works no?

    You don't need the QFile at all, just remove it :x
     
  29. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Yah i know lol, i had that to test (I'm the type of guy that tests eveeeeeeerything. .-.) i had commented lot of code for doing this. :P

    It'll be harder i think hehe.
     
    Last edited: Dec 12, 2011
  30. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Got it! ;)

    Code (CPP):
    1.  
    2.  
    3. QMovie *PokemonInfo::AnimatedPicture(const Pokemon::uniqueId &pokeid, int gender, bool shiney, bool back)
    4. {
    5.     QString archive = path("black_white_animated.zip");
    6.     QString file = QString("%1/%2%3%4.gif").arg(pokeid.toString(), back?"b":"f", (gender==Pokemon::Female)?"f":"", shiney?"s":"");
    7.     QByteArray *data = new QByteArray(readZipFile(archive.toUtf8(), file.toUtf8()));
    8.     QBuffer *animatedSpriteData = new QBuffer(data);
    9.     QMovie *animatedSprite = new QMovie(animatedSpriteData);
    10.     if (data->length() == 0)
    11.     {
    12.         if (gender == Pokemon::Female)
    13.             return PokemonInfo::AnimatedPicture(pokeid, Pokemon::Male, shiney, back);
    14.         if (shiney)
    15.             return PokemonInfo::AnimatedPicture(pokeid, Pokemon::Male, false, back);
    16.         if (pokeid.subnum != 0)
    17.             return PokemonInfo::AnimatedPicture(OriginalForme(pokeid), Pokemon::Male, false, back);
    18.         animatedSprite->start();
    19.         return animatedSprite;
    20.     }
    21.     animatedSprite->start();
    22.     return animatedSprite;
    23. }
    24.  
    :D

    Also why doing it with load of functions and not directly?

    Code (CPP):
    1.  
    2.     if(s.value("enable_animated_sprites").toBool() == 1) {
    3.         setAnimatedPicture(PokemonInfo::AnimatedPicture(poke.num(), poke.gender(), poke.shiny(), false));
    4.     }else{
    5.         setPicture(poke.picture());
    6.     }
    7.  
    8. void PokeBodyWidget::setPicture(const QPixmap &picture)
    9. {
    10.     pokeImage->setFixedSize(picture.size());
    11.     pokeImage->setPixmap(picture);
    12. }
    13.  
    14. void PokeBodyWidget::setAnimatedPicture(QMovie *movie)
    15. {
    16.     pokeImage->setMovie(movie);
    17. }
    18.  
     
    Last edited: Dec 12, 2011
  31. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    This is what i have planned for the next version (With all the new stuff and blabla):


    I don't know if i'll get all this finished, but i think i'll (Won't sleep at night!). (Don't take anything from thiz list </3)

    -New Plugins
    • Player Stats: Let's you retrieve some player stats (Such as win, loses, ties, battles, etc)
    • Global Stats (Server-Side): Same as the Player Stats but for the Server (Means, stadistics of the server, not just a client).
    • Battle Data Functions (Server-Side): Now, instead of having them in Script Side (I prefer doing this, but seems like not many people uses it. ;_;) we have them as a plugin. (Although i don't know how to make them available to call though sys. like all script functions.

    -Client Side
    • Update the Plugin Manager to show some description about the plugins and not just the name.
    • Tweaks to the plugin system
    • Animated Sprites in the new Teambuilder. (If i get how to, same in the old Battle Window)
      [*]Multipeople PM: Talk with multiple people at same time in same window.
      [*]Tabbed PM: Instead of having private messages in separate windows, let's have them in tabs! :)
    • Voice Chat: Let's you talk with people using Microphone. (Though, it's possible, but bandwidth, etc.)
    • Improve the Ignore System: No idea of how to do this though, well, a little yes.
    • Players can select their default channel when joining a server.
      [*]Fix Replays Name: So we avoid using illegal characters for filenames.
    • Add a Tooltip when you put mouse over Item label in new teambuilder.

    -Server Side
    • Update the Plugin Manager to show some description about the plugins and not just the name.
    • Tweaks to the plugin system
      [*]sys.hostName(player_ip): Retrieves the hostname of the player ip.
    • Translation for Server. (It's annoying to have it in some different language.)
    • Ability to handle multiple scripts files. (I mean, instead of having one file and need to change it each time, you can have multiple files. And you can select them using a checkbox or something).

    (Things in green mean they're done. ;))

    Coyo: A few questions :3

    -Would be possible to move all the Plugins inside a "Plugins" folder? So it's more organizated.
    -Can i create a "Plugins Thread" and a "Request a Plugin Thread"? Most likely so people can download plugins and in the request a plugin thread people can request some sort of plugin to be created. (Some dev take it and create it)
    -Do we need to have the plugins in the Client/Server download? Can't we give the download links in the Plugins Thread?

    Coyo Note: All of this features, will go inside devel, right? :3

    I'll do the changes on the source, if you want to merge them into the main source code it's fine. ;) Just so i don't have to wait for an official answer.

    Btw, could i have this thread clean? I meant, delete posts. <3

    ----------------

    I'll keep adding things to this list before the 1.0.54 or whatever. <3
     
    Last edited: Jan 12, 2012
  32. Mystra

    Mystra Active Member

    Joined:
    Jul 12, 2010
    Messages:
    1,389
    Likes Received:
    4
    Don't delete posts. Also, are you sure you can handle that much? :|
     
  33. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Possibly, yes. (Just working, i'm bored, can't sleep due temperature (Too hot ;_;)) and blablah.
     
  34. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    Is tabbed PMs optional? I would not use it, to see several PMs at time. (I suggested you to make 'attachable' and 'detachable' tabs instead of yes / no, best would be dragging them on top of each other to attach, detaching can be done by dragging or clicking a detach button)

    Depending on if the feature will be need protocol or new teambuilder, implement it into devel branch, but if it would be working without the new massive changes, I see no reason to not make it into master branch.
     
  35. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
  36. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Shouldn't the server use DataStream?
     
  37. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    If it goes through network stream, yes (Starting from next major release)
     
  38. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Oh, nevermind. I was in master branch.
     
  39. Blastcore

    Blastcore Developer

    Joined:
    Jul 19, 2010
    Messages:
    763
    Likes Received:
    1
    Well, this of school is killing me off, my activity will be reduced a bit but this weekend i'll get to work on the sim again. (Those classes ;_;)
     
  40. coyotte508

    coyotte508 Well-Known Member Administrator Server Owner Administrator Server Owner

    Joined:
    Apr 21, 2010
    Messages:
    6,363
    Likes Received:
    168
    :(

    Work well in school!