[ Login | Register ]

The Shining Source

« previous next »
Pages: 1 [2] 3 4 ... 6 Print
searching java code   (Read 46466 times)
Old Post July 24, 2010, 10:45:02 am
#16
Blahian *

Posts: 44

Logged
Re: searching java code
Although, disjoint else-if statements are actually faster in some programming languages. Wink
Yes, that's right, and that's why it's absolutely correct to use them.


Old Post July 24, 2010, 01:46:22 pm
#17
Blahian *

Posts: 41

Logged
Re: searching java code
I don't want to blame anyone here...

Ähm...but: Using 4-5 time the charAt(0) method in an if-else structure isn't really fast.
a switch would only once evaluate this method and then jump in the current cases; and a switch has also a deflaut-case...

...going to correct code...

...programming on holidays Wink


Old Post July 24, 2010, 03:27:15 pm
#18
Blahian *

Posts: 41

Logged
Re: searching java code
my Code correction is for example like this.
Open the code in a java editor (like eclipse) to see the differences:

Code:
public void targetExecutionCode() {

    /** A.I. targeting execution code!!! */

/** join the if-s
    if(Buffer.Player().ai == true && mode == Constant.selectYourTarget) {
    if(animationIterator == animationDelay-1) {
    contentPane.remove(screen);
*/
    if((Buffer.Player().ai == true) && (mode == Constant.selectYourTarget)
    && (animationIterator == animationDelay-1)) {
   
    contentPane.remove(screen);


       
    /**
    * a switch replacing the commented if-else structures
    */
    switch(attackType) {
   
    case Constant.normalAttack :
    if (Buffer.Player().range > 2) {
    attackType = Constant.rangedAttack;
    }
    battleAnimation = new MeleeSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
    battleAnimation.setBounds(0,0,maxX,maxY);
    /* TODO: Stop local animation loop? */
    contentPane.add(battleAnimation);
    break;
   
    case Constant.rangedAttack :
    rangedAnimation = new RangedSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
    rangedAnimation.setBounds(0,0,maxX,maxY);
    /* TODO: Stop local animation loop? */
    contentPane.add(rangedAnimation);
   
    break;
   
    }// switch
    } // combined if
} // end of targetExecutionCode()

/**
* Replaced if-else structure in targetExecutionCode()
*
* case constant.normalAttack

*      if(Buffer.Player().range > 2 && attackType == Constant.normalAttack) {
    attackType = Constant.rangedAttack;
    }

    if(attackType == Constant.normalAttack) {
    battleAnimation = new MeleeSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
    battleAnimation.setBounds(0,0,maxX,maxY);

    TODO: Stop local animation loop?
    contentPane.add(battleAnimation);
    }
    else if(attackType == Constant.rangedAttack) {
    rangedAnimation = new RangedSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
    rangedAnimation.setBounds(0,0,maxX,maxY);

    TODO: Stop local animation loop?
    contentPane.add(rangedAnimation);
    }
    a complicated way to call repaint()
    this.paint(this.getGraphics());
    mode = Constant.modeAttack;
    changing the sound
    JukeBox.PlayBattleTune(); */



I know its big, but I haven't any email adresses...

...programming on holidays Wink


Old Post July 24, 2010, 03:29:19 pm
#19
Blahian *

Posts: 41

Logged
Re: searching java code
maxY maxY and some other new variables are calculated before or are Object-Variables (see this. Operator in a Java tutorial)

The Constant.xxx values are the same as they are in the orginal-code:
Code:
public static final int overlandWalking = 0;
public static final int standardMenuActive = 1;
public static final int selectYourTarget = 2;
public static final int modeAttack = 5;
public static final int statusCheck = 6;
public static final int endOfTurn = 7;
[/code}
etc...

...programming on holidays Wink


Old Post July 24, 2010, 03:31:07 pm
#20
Ty
Administrator
Shining Sideburns *

Posts: 830

Logged
Re: searching java code
If you have any experience with Subversion, I could host the current babs code.


Old Post July 24, 2010, 03:32:27 pm
#21
Blahian *

Posts: 41

Logged
Re: searching java code
I am more likely with zip versions, or tell me more about it I'll look after subversion later...Wink

...programming on holidays Wink


Old Post July 24, 2010, 03:36:59 pm
#22
Ty
Administrator
Shining Sideburns *

Posts: 830

Logged
Re: searching java code
The official subversion site doesn't really give much info, but if you're using Windows I'd advise looking at TortoiseSVN. It makes checking things in and out much easier.

If you're happier with zip files, you can just post them here as attachments (maybe in their own thread to make them easier to find).


Old Post July 24, 2010, 04:53:48 pm
#23
Administrator
Shining Spammer *

Posts: 1,207

Logged
Re: searching java code
Hmm... BABS on Subversion would be awesome! It would also make it much easier for me to check the code from anywhere and help people working on it whenever they get stuck Wink.

Devlyn

Great news for Shining fangame developers! Wink

Correcting your non-working <img> tags since 1982 Wink


Old Post July 24, 2010, 05:21:51 pm
#24
Ty
Administrator
Shining Sideburns *

Posts: 830

Logged
Re: searching java code
Okey doke, I'll set it up today. If anyone would like access to it, just pm your desired username / password and I'll add your account & pm you the access details.


Old Post July 24, 2010, 09:39:28 pm
#25
Blahian *

Posts: 41

Logged
Re: searching java code
can anyone explain me waht  these variables mean


Code:
private int up = 0;
private int down = 0;
private int left = 0;
private int right = 0;

/**equals 1 if particular button was once pressed and not released yet.*/
private int opup = 0;
private int opdown = 0;
private int opleft = 0;
private int opright = 0;

and which values they takes and what does these values mean.
Sometimes they take the value 3 - I can't imagine what that should mean?

...programming on holidays Wink


Old Post July 24, 2010, 10:31:11 pm
#26
Blahian *

Posts: 41

Logged
Re: searching java code
under

http://www.informatik.uni-freiburg.de/~marquard/

in the very last line you find a the partially corrected [BattleFrame.java] sourcefile

...programming on holidays Wink


Old Post July 25, 2010, 03:15:07 am
#27
Administrator Shining Spammer *

Posts: 1,126

Logged
Re: searching java code
Thanks for this christian, I really appreciate all of your efforts.

I have probably also corrupted the code with my style as well, so don't blame all the issues on Devlyn.
However unfortunately in my case you won't have reasonable explanations, since my method at the time simply required the end result to work in general, rather than being fast, efficient, or bug free Wink


~Elvenfyre


Old Post July 25, 2010, 12:35:14 pm
#28
Blahian *

Posts: 41

Logged
Re: searching java code
I don't blame anyone - I'm just reorganizing the code.

the newest code can be found at

http://www.informatik.uni-freiburg.de/~marquard/

please have a look at it, if it works how you expected it
 Wink

...programming on holidays Wink


Old Post July 25, 2010, 12:39:28 pm
#29
Blahian *

Posts: 41

Logged
Re: searching java code
what's about subversion? - I read it Wink

...programming on holidays Wink


Old Post July 25, 2010, 09:18:57 pm
#30
Blahian *

Posts: 41

Logged
Re: searching java code
hello,

anyone out there ?

I would be happy if didn't have to work alone.... !  Smiley

...programming on holidays Wink


Pages: 1 [2] 3 4 ... 6 Print 
« previous next »
Jump to:  

Powered by SMF 1.1.21 | SMF © 2013, Simple Machines