Rev 502 |
Blame |
Last modification |
View Log
| RSS feed
/**************************************************
*
* class representing the Params Structure
*
* Author: Marcus -LiGi- Bueschleb
*
* see README for further Infos
*
*************************************************/
public class MKParamsParser
implements MKParamDefinitions
{
public final static int MAX_PARAMSETS=
20;
public final static int MAX_PARAMLENGTH=
70;
public int[][] field
;
public String[] names=
{"Paramset 1",
"Paramset 2",
"Paramset 3",
"Paramset 4",
"Paramset 5"};
public int act_paramset=
0;
public int get_field_from_act
(int pos
)
{ return field
[act_paramset
][pos
]; }
public void set_field_from_act
(int pos,
int val
)
{
if (val
>255) val=
255;
if (val
<0) val=
255;
field
[act_paramset
][pos
]=val
;
}
public void field_from_act_add
(int pos,
int val
)
{
set_field_from_act
(pos , get_field_from_act
(pos
)+val
);
}
// for boolean Flags
public void field_from_act_xor
(int pos,
int val
)
{
field
[act_paramset
][pos
]^=val
;
}
public MKParamsParser
()
{
field=
new int[MAX_PARAMSETS
][MAX_PARAMLENGTH
];
for (int ii=
0;ii
<MAX_PARAMSETS
;ii++
)
for (int i=
0;i
<MAX_PARAMLENGTH
;i++
)
field
[ii
][i
]=-
1;
}
public int[] param_type
;
public int[] param_pos
;
public int[] param_innerpos
;
public void set_by_mk_data
(int paramset_num,
int[] in_arr,MKVersion version
)
{
param_type=
new int[PARAM_COUNT
];
param_pos=
new int[PARAM_COUNT
];
param_innerpos=
new int[PARAM_COUNT
];
param_type
[PARAMID_STICK_ACCELERATE
]=PARAMTYPE_BYTE
;
param_pos
[PARAMID_STICK_ACCELERATE
]=
2;
param_innerpos
[PARAMID_STICK_ACCELERATE
]=
0;
switch (version.
compatible)
{
case 4:
case 5:
for ( int i=
0;i
<58;i++
)
field
[paramset_num
][i
]=in_arr
[i
];
names
[paramset_num
]=
"" +
(paramset_num+
1) +
": ";
for ( int i=
46;i
<58;i++
)
{
if(in_arr
[i
]==
0)break;
names
[paramset_num
]+=
(char)in_arr
[i
];
}
break;
case 6:
for ( int i=
0;i
<65;i++
)
field
[paramset_num
][i
]=in_arr
[i
];
names
[paramset_num
]=
"" +
(paramset_num+
1) +
": ";
for ( int i=
53;i
<65;i++
)
{
if(in_arr
[i
]==
0)break;
names
[paramset_num
]+=
(char)in_arr
[i
];
}
break;
case 7:
for ( int i=
0;i
<70;i++
)
field
[paramset_num
][i
]=in_arr
[i
];
names
[paramset_num
]=
"" +
(paramset_num+
1) +
": ";
for ( int i=
58;i
<70;i++
)
{
if(in_arr
[i
]==
0)break;
names
[paramset_num
]+=
(char)in_arr
[i
];
}
break;
}
}
}