@ -602,7 +602,6 @@ void winch_motor_update (Motor* motor) {
@@ -602,7 +602,6 @@ void winch_motor_update (Motor* motor) {
Body * body = motor - > end_object ;
uint32_t now = SDL_GetTicks ( ) ;
if ( body - > strings [ 0 ] . max_length < 0.1
| | ! body - > strings [ 0 ] . attached ) {
motor - > stop = true ;
@ -639,7 +638,8 @@ void stop_pull_rope(void) {
@@ -639,7 +638,8 @@ void stop_pull_rope(void) {
player . physics - > motors [ M_WINCH ] . stop = true ;
}
void add_rope ( void ) {
void add_rope ( int mouse_x ) {
if ( player . physics - > strings [ 0 ] . attached ) {
return ;
}
@ -652,6 +652,10 @@ void add_rope(void) {
@@ -652,6 +652,10 @@ void add_rope(void) {
}
end . y = 0 ;
if ( mouse_x ! = 0 ) {
end . x = mouse_x + viewport_pos . x ;
}
Floor * ceiling = world . uniques_index [ CEILING ] - > floor ;
int y = 0 ;
@ -1064,7 +1068,7 @@ GlobWorld create_world() {
@@ -1064,7 +1068,7 @@ GlobWorld create_world() {
memset ( c . things , 0 , sizeof ( world_thing ) * 100 ) ;
c . capacity = 100 ;
c . size = 0 ;
c . uniques_index = calloc ( 3 , sizeof ( world_thing * ) ) ;
c . uniques_index = calloc ( 10 , sizeof ( world_thing * ) ) ;
return c ;
}
@ -1119,7 +1123,7 @@ void handle_input_event(SDL_Event event) {
@@ -1119,7 +1123,7 @@ void handle_input_event(SDL_Event event) {
switch ( event . type ) {
case SDL_KEYDOWN :
if ( event . key . keysym . scancode = = input_map . player_rope ) {
add_rope ( ) ;
add_rope ( 0 ) ;
} if ( sc = = input_map . player_up ) {
walk_player ( 0 , - 1 ) ;
} if ( sc = = input_map . player_left ) {
@ -1143,6 +1147,18 @@ void handle_input_event(SDL_Event event) {
@@ -1143,6 +1147,18 @@ void handle_input_event(SDL_Event event) {
stop_pull_rope ( ) ;
}
break ;
case SDL_MOUSEBUTTONDOWN :
if ( event . button . button = = SDL_BUTTON_LEFT )
add_rope ( event . button . x ) ;
if ( event . button . button = = SDL_BUTTON_RIGHT )
pull_rope ( 900 ) ;
break ;
case SDL_MOUSEBUTTONUP :
if ( event . button . button = = SDL_BUTTON_LEFT )
delete_rope ( ) ;
if ( event . button . button = = SDL_BUTTON_RIGHT )
stop_pull_rope ( ) ;
break ;
}
}