home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Maps are always squares, therefore define only their edge lengths.
[plomrogue]
/
src
/
client
/
map.c
diff --git
a/src/client/map.c
b/src/client/map.c
index a41903906dcc012bfedfbae7e1c71f6917664d85..7c2dcc384590df51b3dcfa46c9bcb577a6755e27 100644
(file)
--- a/
src/client/map.c
+++ b/
src/client/map.c
@@
-1,9
+1,8
@@
/* src/client/map.c */
#include "map.h"
/* src/client/map.c */
#include "map.h"
-#include <stdint.h> /* uint16_t */
-#include "misc.h" /* center_offset() */
-#include "windows.h" /* struct Win, get_win_by_id() */
+#include <stdint.h> /* uint8_t */
+#include "windows.h" /* struct Win, center_offset(), get_win_by_id() */
#include "world.h" /* for global world */
#include "world.h" /* for global world */
@@
-12,24
+11,24
@@
extern void map_scroll(char d)
{
struct Win * win = get_win_by_id('m');
uint16_t offset;
{
struct Win * win = get_win_by_id('m');
uint16_t offset;
- if (('8' == d || '2' == d) && world.map.
size.y
> win->frame_size.y)
+ if (('8' == d || '2' == d) && world.map.
length
> win->frame_size.y)
{
offset = center_offset(win->center.y,
{
offset = center_offset(win->center.y,
- world.map.
size.y
, win->frame_size.y);
+ world.map.
length
, win->frame_size.y);
win->center.y = offset + (win->frame_size.y / 2);
win->center.y = offset + (win->frame_size.y / 2);
- if ('2' == d && win->center.y < world.map.
size.y
- 1)
+ if ('2' == d && win->center.y < world.map.
length
- 1)
{
win->center.y++;
return;
}
win->center.y = win->center.y - ('8' == d && win->center.y > 0);
}
{
win->center.y++;
return;
}
win->center.y = win->center.y - ('8' == d && win->center.y > 0);
}
- else if (('4' == d || '6' == d) &&
world.map.size.x
> win->frame_size.x)
+ else if (('4' == d || '6' == d) &&
(world.map.length*2)
> win->frame_size.x)
{
offset = center_offset(win->center.x,
{
offset = center_offset(win->center.x,
- world.map.
size.x
, win->frame_size.x);
+ world.map.
length*2
, win->frame_size.x);
win->center.x = offset + (win->frame_size.x / 2);
win->center.x = offset + (win->frame_size.x / 2);
- if ('6' == d && win->center.x <
world.map.size.x
- 1)
+ if ('6' == d && win->center.x <
(world.map.length * 2)
- 1)
{
win->center.x++;
return;
{
win->center.x++;
return;
@@
-43,5
+42,6
@@
extern void map_scroll(char d)
extern void map_center()
{
struct Win * win_map = get_win_by_id('m');
extern void map_center()
{
struct Win * win_map = get_win_by_id('m');
- win_map->center = world.player_pos;
+ win_map->center.y = world.player_pos.y;
+ win_map->center.x = world.player_pos.x * 2;
}
}