static enum e_chip_offset_info // coi = chip offset info
{
Float: coi_offset_x,
Float: coi_offset_y,
coi_up,
coi_right,
coi_down,
coi_left
};
static const g_chip_offset_info[][e_chip_offset_info]
{
{ 0.074950, 0.566250, -1, 5, 3, 1 }, // Zero
{-0.168349, 0.413749, 0, 2, 6, 119}, // 1
{-0.046699, 0.413749, 0, 3, 7, 1}, // 2
{ 0.074950, 0.413749, 0, 4, 8, 2}, // 3
{ 0.196600, 0.413749, 0, 5, 9, 3}, // 4
{ 0.318250, 0.413749, 0, - 1, 10, 4}, // 5
{-0.168349, 0.337499, 1, 7, 11, 119}, // 6
{-0.046699, 0.337499, 2, 8, 12, 6}, // 7
{ 0.074950, 0.337499, 3, 9, 13, 7}, // 8
{ 0.196600, 0.337499, 4, 10, 14, 8}, // 9
{ 0.318250, 0.337499, 5, - 1, 15, 9}, // 10
{-0.168349, 0.261249, 6, 12, 16, 119}, // 11
{-0.046699, 0.261249, 7, 13, 17, 11}, // 12
{ 0.074950, 0.261249, 8, 14, 18, 12}, // 13
{ 0.196600, 0.261249, 9, 15, 19, 13}, // 14
{ 0.318250, 0.261249, 10, - 1, 20, 14}, // 15
{-0.168349, 0.184999, 11, 17, 21, 119}, // 16
{-0.046699, 0.184999, 12, 18, 22, 16}, // 17
{ 0.074950, 0.184999, 13, 19, 23, 17}, // 18
{ 0.196600, 0.184999, 14, 20, 24, 18}, // 19
{ 0.318250, 0.184999, 15, - 1, 25, 19}, // 20
{-0.168349, 0.108749, 16, 22, 26, 119}, // 21
{-0.046699, 0.108749, 17, 23, 27, 21}, // 22
{ 0.074950, 0.108749, 18, 24, 28, 22}, // 23
{ 0.196600, 0.108749, 19, 25, 29, 23}, // 24
{ 0.318250, 0.108749, 20, - 1, 30, 24}, // 25
{-0.168349, 0.032499, 21, 27, 31, 119}, // 26
{-0.046699, 0.032499, 22, 28, 32, 26}, // 27
{ 0.074950, 0.032499, 23, 29, 33, 27}, // 28
{ 0.196600, 0.032499, 24, 30, 34, 28}, // 29
{ 0.318250, 0.032499, 25, - 1, 35, 29}, // 30
{-0.168349, -0.043750, 26, 32, 36, 119}, // 31
{-0.046699, -0.043750, 27, 33, 37, 31}, // 32
{ 0.074950, -0.043750, 28, 34, 38, 32}, // 33
{ 0.196600, -0.043750, 29, 35, 39, 33}, // 34
{ 0.318250, -0.043750, 30, - 1, 40, 34}, // 35
{-0.168349, -0.120000, 31, 37, 41, 120}, // 36
{-0.046699, -0.120000, 32, 38, 42, 36}, // 37
{ 0.074950, -0.120000, 33, 39, 43, 37}, // 38
{ 0.196600, -0.120000, 34, 40, 44, 38}, // 39
{ 0.318250, -0.120000, 35, - 1, 45, 39}, // 40
{-0.168349, -0.196250, 36, 42, 46, 120}, // 41
{-0.046699, -0.196250, 37, 43, 47, 41}, // 42
{ 0.074950, -0.196250, 38, 44, 48, 42}, // 43
{ 0.196600, -0.196250, 39, 45, 49, 43}, // 44
{ 0.318250, -0.196250, 40, - 1, 50, 44}, // 45
{-0.168349, -0.272500, 41, 47, 51, 120}, // 46
{-0.046699, -0.272500, 42, 48, 52, 46}, // 47
{ 0.074950, -0.272500, 43, 49, 53, 47}, // 48
{ 0.196600, -0.272500, 44, 50, 54, 48}, // 49
{ 0.318250, -0.272500, 45, - 1, 55, 49}, // 50
{-0.168349, -0.348750, 46, 52, 56, 120}, // 51
{-0.046699, -0.348750, 47, 53, 57, 51}, // 52
{ 0.074950, -0.348750, 48, 54, 58, 52}, // 53
{ 0.196600, -0.348750, 49, 55, 59, 53}, // 54
{ 0.318250, -0.348750, 50, - 1, 60, 54}, // 55
{-0.168349, -0.425000, 51, 57, 61, 120}, // 56
{-0.046699, -0.425000, 52, 58, 62, 56}, // 57
{ 0.074950, -0.425000, 53, 59, 63, 57}, // 58
{ 0.196600, -0.425000, 54, 60, 64, 58}, // 59
{ 0.318250, -0.425000, 55, - 1, 65, 59}, // 60
{-0.168349, -0.501250, 56, 62, 66, 120}, // 61
{-0.046699, -0.501250, 57, 63, 67, 61}, // 62
{ 0.074950, -0.501250, 58, 64, 68, 62}, // 63
{ 0.196600, -0.501250, 59, 65, 69, 63}, // 64
{ 0.318250, -0.501250, 60, - 1, 70, 64}, // 65
{-0.168349, -0.577500, 61, 67, 71, 120}, // 66
{-0.046699, -0.577500, 62, 68, 72, 66}, // 67
{ 0.074950, -0.577500, 63, 69, 73, 67}, // 68
{ 0.196600, -0.577500, 64, 70, 74, 68}, // 69
{ 0.318250, -0.577500, 65, - 1, 75, 69}, // 70
{-0.168349, -0.653750, 66, 72, 76, 121}, // 71
{-0.046699, -0.653750, 67, 73, 77, 71}, // 72
{ 0.074950, -0.653750, 68, 74, 78, 72}, // 73
{ 0.196600, -0.653750, 69, 75, 79, 73}, // 74
{ 0.318250, -0.653750, 70, - 1, 80, 74}, // 75
{-0.168349, -0.730000, 71, 77, 81, 121}, // 76
{-0.046699, -0.730000, 72, 78, 82, 76}, // 77
{ 0.074950, -0.730000, 73, 79, 83, 77}, // 78
{ 0.196600, -0.730000, 74, 80, 84, 78}, // 79
{ 0.318250, -0.730000, 75, - 1, 85, 79}, // 80
{-0.168349, -0.806250, 76, 82, 86, 121}, // 81
{-0.046699, -0.806250, 77, 83, 87, 81}, // 82
{ 0.074950, -0.806250, 78, 84, 88, 82}, // 83
{ 0.196600, -0.806250, 79, 85, 89, 83}, // 84
{ 0.318250, -0.806250, 80, - 1, 90, 84}, // 85
{-0.168349, -0.882500, 81, 87, 91, 121}, // 86
{-0.046699, -0.882500, 82, 88, 92, 86}, // 87
{ 0.074950, -0.882500, 83, 89, 93, 87}, // 88
{ 0.196600, -0.882500, 84, 90, 94, 88}, // 89
{ 0.318250, -0.882500, 85, - 1, 95, 89}, // 90
{-0.168349, -0.958750, 86, 92, 96, 121}, // 91
{-0.046699, -0.958750, 87, 93, 97, 91}, // 92
{ 0.074950, -0.958750, 88, 94, 98, 92}, // 93
{ 0.196600, -0.958750, 89, 95, 99, 93}, // 94
{ 0.318250, -0.958750, 90, - 1, 100, 94}, // 95
{-0.168349, -1.035000, 91, 97, 101, 121}, // 96
{-0.046699, -1.035000, 92, 98, 102, 96}, // 97
{ 0.074950, -1.035000, 93, 99, 103, 97}, // 98
{ 0.196600, -1.035000, 94, 100, 104, 98}, // 99
{ 0.318250, -1.035000, 95, - 1, 105, 99}, // 100
{-0.168349, -1.111250, 96, 102, 106, 121}, // 101
{-0.046699, -1.111250, 97, 103, 107, 101}, // 102
{ 0.074950, -1.111250, 98, 104, 108, 102}, // 103
{ 0.196600, -1.111250, 99, 105, 109, 103}, // 104
{ 0.318250, -1.111250, 100, - 1, 110, 104}, // 105
{-0.168349, -1.187500, 101, 107, 111, 122}, // 106
{-0.046699, -1.187500, 102, 108, 112, 106}, // 107
{ 0.074950, -1.187500, 103, 109, 113, 107}, // 108
{ 0.196600, -1.187500, 104, 110, 114, 108}, // 109
{ 0.318250, -1.187500, 105, - 1, 115, 109}, // 110
{-0.168349, -1.263750, 106, 112, 116, 122}, // 111
{-0.046699, -1.263750, 107, 113, 117, 111}, // 112
{ 0.074950, -1.263750, 108, 114, 118, 112}, // 113
{ 0.196600, -1.263750, 109, 115, 119, 113}, // 114
{ 0.318250, -1.263750, 110, - 1, 120, 114}, // 115
{-0.168349, -1.416249, 111, 117, -1, -1}, // 116 - 3 to 1
{ 0.074950, -1.416249, 113, 118, -1, 116}, // 117 - 3 to 1
{ 0.318250, -1.416249, 115, -1, -1, 117}, // 118 - 3 to 1
{-0.411650, 0.185000, -1, 1, 120, 122}, // 119 - 1st 112
{-0.411650, -0.425000, 119, 13, 121, 124}, // 120 - 2nd 112
{-0.411650, -1.035000, 120, 25, -1, 126}, // 121 - 3rd 112
{-0.654950, 0.337500, -1, 119, 123, -1}, // 122 - 1 to 18
{-0.654950, 0.032499, 122, 119, 124, -1}, // 123 - EVEN
{-0.654950, -0.272500, 123, 120, 125, -1}, // 124 - RED
{-0.654950, -0.577499, 124, 120, 126, -1}, // 125 - BLACK
{-0.654950, -0.882500, 125, 121, 127, -1}, // 126 - ODD
{-0.654950, -1.187500, 126, 121, -1, -1} // 127 - 19 to 36
}
/*
создание фишки (инициализация на "zero")
*/
new
Float: offset_x = g_chip_offset_info[0][coi_offset_x],
Float: offset_y = g_chip_offset_info[0][coi_offset_y],
Float: cos_z
= floatcos(rZ_table
, degrees), Float: sin_z
= floatsin(rZ_table
, degrees),
Float: x_chip_pos = x_table + cos_z * offset_x - sin_z * offset_y,
Float: y_chip_pos = y_table + sin_z * offset_x + cos_z * offset_y;
CreateDynamicObject(..., x_chip_pos, y_chip_pos, ...);
/*
перемещение фишки (OnPlayerUpdate)
TODO: Нужно сохранять позицию фишки у игрока
*/
new
direction,
ud,
lr;
playerid,
direction,
ud,
lr
);
direction = -1;
switch (ud)
{
case KEY_UP:
{
direction = 0;
}
case KEY_DOWN:
{
direction = 2;
}
}
switch (lr)
{
case KEY_LEFT:
{
direction = 3;
}
case KEY_RIGHT:
{
direction = 1;
}
}
if (direction != -1)
{
new Float: angle
= atan2( x_table - x_camera_pos,
y_table - y_camera_pos
) + rZ_table;
new e_chip_offset_info: key_index = coi_up + e_chip_offset_info: (
direction
+ (((floatround(angle
) % 360) + 45) / 90) & 3 );
key_index = g_roullete_chip_offset[chip_index][key_index];
if (key_index != -1)
{
// сохраняем данные о фишке
// перемещаем фишку
/*
Float: x_chip_pos = x_table + cos_z * offset_x - sin_z * offset_y,
Float: y_chip_pos = y_table + sin_z * offset_x + cos_z * offset_y;
*/
}
}