Rev 495 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
303 | ligi | 1 | /************************************************** |
2 | * |
||
3 | * class representing the Params Structure |
||
4 | * |
||
5 | * Author: Marcus -LiGi- Bueschleb |
||
403 | ligi | 6 | * |
7 | * see README for further Infos |
||
8 | * |
||
303 | ligi | 9 | *************************************************/ |
10 | |||
11 | public class MKParamsParser |
||
475 | ligi | 12 | implements MKParamDefinitions |
303 | ligi | 13 | |
14 | { |
||
15 | |||
314 | ligi | 16 | public final static int MAX_PARAMSETS=20; |
303 | ligi | 17 | |
314 | ligi | 18 | public int[][] field; |
19 | public String[] names={"Paramset 1","Paramset 2","Paramset 3","Paramset 4","Paramset 5"}; |
||
303 | ligi | 20 | |
314 | ligi | 21 | public int act_paramset=0; |
22 | |||
23 | |||
390 | ligi | 24 | public int get_field_from_act(int pos) |
25 | { return field[act_paramset][pos]; } |
||
314 | ligi | 26 | |
390 | ligi | 27 | public void set_field_from_act(int pos,int val) |
411 | ligi | 28 | { |
29 | if (val>255) val=255; |
||
30 | if (val<0) val=255; |
||
31 | field[act_paramset][pos]=val; |
||
32 | } |
||
390 | ligi | 33 | |
34 | |||
314 | ligi | 35 | public void field_from_act_add(int pos,int val) |
36 | { |
||
411 | ligi | 37 | set_field_from_act(pos , get_field_from_act(pos)+val); |
314 | ligi | 38 | } |
39 | |||
411 | ligi | 40 | // for boolean Flags |
314 | ligi | 41 | public void field_from_act_xor(int pos,int val) |
42 | { |
||
43 | field[act_paramset][pos]^=val; |
||
44 | } |
||
45 | |||
303 | ligi | 46 | public MKParamsParser() |
47 | { |
||
475 | ligi | 48 | field=new int[MAX_PARAMSETS][65]; |
314 | ligi | 49 | for (int ii=0;ii<MAX_PARAMSETS;ii++) |
475 | ligi | 50 | for (int i=0;i<65;i++) |
314 | ligi | 51 | field[ii][i]=-1; |
303 | ligi | 52 | |
53 | } |
||
54 | |||
475 | ligi | 55 | |
56 | public int[] param_type; |
||
57 | public int[] param_pos; |
||
58 | public int[] param_innerpos; |
||
59 | |||
314 | ligi | 60 | public void set_by_mk_data(int paramset_num,int[] in_arr,MKVersion version) |
303 | ligi | 61 | { |
475 | ligi | 62 | param_type=new int[PARAM_COUNT]; |
63 | param_pos=new int[PARAM_COUNT]; |
||
64 | param_innerpos=new int[PARAM_COUNT]; |
||
65 | |||
66 | param_type[PARAMID_STICK_ACCELERATE]=PARAMTYPE_BYTE; |
||
67 | param_pos[PARAMID_STICK_ACCELERATE]=2; |
||
68 | param_innerpos[PARAMID_STICK_ACCELERATE]=0; |
||
69 | |||
70 | |||
71 | switch (version.compatible) |
||
314 | ligi | 72 | { |
475 | ligi | 73 | case 4: |
495 | ligi | 74 | case 5: |
475 | ligi | 75 | |
76 | for ( int i=0;i<58;i++) |
||
77 | field[paramset_num][i]=in_arr[i]; |
||
78 | names[paramset_num]="" + (paramset_num+1) +": "; |
||
79 | for ( int i=46;i<58;i++) |
||
80 | { |
||
81 | if(in_arr[i]==0)break; |
||
82 | names[paramset_num]+=(char)in_arr[i]; |
||
83 | } |
||
84 | break; |
||
85 | |||
86 | case 6: |
||
502 | ligi | 87 | case 7: |
475 | ligi | 88 | for ( int i=0;i<65;i++) |
89 | field[paramset_num][i]=in_arr[i]; |
||
90 | names[paramset_num]="" + (paramset_num+1) +": "; |
||
91 | for ( int i=53;i<65;i++) |
||
92 | { |
||
93 | if(in_arr[i]==0)break; |
||
94 | names[paramset_num]+=(char)in_arr[i]; |
||
95 | } |
||
96 | break; |
||
97 | |||
314 | ligi | 98 | } |
303 | ligi | 99 | } |
100 | |||
101 | |||
102 | |||
103 | } |