[ Login | Register ]

The Shining Source

Show Posts

Pages: 1 2 [3]

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

32   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

33   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

34   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?

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

36   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...

37   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...

38   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...

39   Re: searching java code
I must have been Bill Gates:

the code works, but you never understand why  Cool

40   Re: searching java code
who (the hell) wrote this code?

Quote
      else if(key == KeyEvent.VK_DOWN) {
        if(battleModeOption < 4) battleModeOption = 3;
        else if(battleModeOption > 9 && battleModeOption < 13) {
          if(Buffer.Player().spell[battleModeOption-9] != null) {
            battleModeOption++;
            spellLevelChoice = Buffer.Player().spell[battleModeOption-10].level;
          }
        }
      }
      else if(key == KeyEvent.VK_LEFT) {
        if(battleModeOption < 4) battleModeOption = 1;
        else if(battleModeOption > 9 && battleModeOption < 13) {
           if(spellLevelChoice > 1) {
             spellLevelChoice--;
             //System.out.println("--:" +spell_lv_choice);
           }
        }
      }

these elseif-Cases are disjoint, so you don't ever need an elseif.
The same problem exists at th battlemodeOptions...  Huh?

41   Re: searching java code
I am reading the sources,
but in my opinion this is just a copy and paste thing of C/C++ there are some things missing/ wrong like names, comments code formatting etc.
I'll try my best but I give no guarantee that I'm finished soon Wink


Pages: 1 2 [3]

Powered by SMF 1.1.21 | SMF © 2013, Simple Machines