Changeset 686
- Timestamp:
- Jul 30, 2013, 4:20:28 PM (10 years ago)
- Location:
- abuse/branches/lol
- Files:
-
- 4 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/branches/lol/.gitignore
r610 r686 14 14 .auto 15 15 .deps 16 .dirstamp 16 17 src/abuse 17 18 src/abuse-tool -
abuse/branches/lol/Makefile.am
r622 r686 1 ## Process this file with automake to produce Makefile.in 1 2 include $(top_srcdir)/build/autotools/common.am 2 3 3 4 SUBDIRS = src data doc 4 5 5 EXTRA_DIST = COPYING.GPL COPYING.WTFPL PACKAGERS bootstrap6 EXTRA_DIST += COPYING.GPL COPYING.WTFPL PACKAGERS bootstrap 6 7 7 8 dist-hook: -
abuse/branches/lol/doc/Makefile.am
r624 r686 2 2 man_MANS = abuse.6 abuse-tool.6 3 3 4 assetdir = $(sharedir)/asset 4 5 asset_DATA = abuse.bmp abuse.png 5 6 -
abuse/branches/lol/src/Makefile.am
r651 r686 7 7 abuse_SOURCES = \ 8 8 common.h \ 9 \10 lol/matrix.cpp lol/matrix.h \11 lol/timer.cpp lol/timer.h \12 9 \ 13 10 specache.cpp specache.h \ … … 66 63 67 64 EXTRALIBS = lisp/liblisp.a sdlport/libsdlport.a imlib/libimlib.a net/libnet.a 68 abuse_LDADD = $(EXTRALIBS) 65 abuse_LDADD = $(EXTRALIBS) $(LOL_LIBS) 69 66 abuse_DEPENDENCIES = $(EXTRALIBS) 70 67 -
abuse/branches/lol/src/ant.cpp
r682 r686 58 58 for (game_object *d=current_level->first_active_object(); d; d=d->next_active) 59 59 { 60 if (d->otype==o->otype && abs(o->x-d->x)<30 &&abs(o->x-d->y)<20) return 1;60 if (d->otype==o->otype && lol::abs(o->x-d->x)<30 && lol::abs(o->x-d->y)<20) return 1; 61 61 } 62 62 return 0; … … 174 174 b=current_level->attacker(current_object); 175 175 else b=player_list->m_focus; 176 if ( abs(b->x-o->x)<130 && (o->y<b->y))176 if (lol::abs(b->x-o->x)<130 && (o->y<b->y)) 177 177 fall=1; 178 178 } … … 206 206 b=current_level->attacker(current_object); 207 207 else b=player_list->m_focus; 208 if ( abs(b->x-o->x)<130 && (o->y<b->y))208 if (lol::abs(b->x-o->x)<130 && (o->y<b->y)) 209 209 fall=1; 210 210 } … … 269 269 { 270 270 o->next_picture(); 271 if ((jrand()%4)==0 && abs(o->x-b->x)<180 &&abs(o->y-b->y)<100 && can_hit_player(o,b))271 if ((jrand()%4)==0 && lol::abs(o->x-b->x)<180 && lol::abs(o->y-b->y)<100 && can_hit_player(o,b)) 272 272 { 273 273 o->set_state((character_state)S_weapon_fire); 274 274 o->set_aistate(ANT_FIRE); 275 } else if ( abs(o->x-b->x)<100 &&abs(o->y-b->y)<10 && (jrand()%4)==0)275 } else if (lol::abs(o->x-b->x)<100 && lol::abs(o->y-b->y)<10 && (jrand()%4)==0) 276 276 o->set_aistate(ANT_POUNCE_WAIT); 277 else if ( abs(o->x-b->x)>140 && !ant_congestion(o))277 else if (lol::abs(o->x-b->x)>140 && !ant_congestion(o)) 278 278 o->set_aistate(ANT_JUMP); 279 279 else … … 287 287 { 288 288 new_xm=xm; 289 ym=- abs(xm);289 ym=-lol::abs(xm); 290 290 o->try_move(o->x,o->y,new_xm,ym,3); 291 291 if (new_xm==xm) … … 294 294 o->y+=ym; 295 295 new_xm=0; 296 ym= abs(xm); // now get back on the ground296 ym=lol::abs(xm); // now get back on the ground 297 297 o->try_move(o->x,o->y,new_xm,ym,3); 298 298 o->x+=new_xm; … … 388 388 else b=player_list->m_focus; 389 389 scream_check(o,b); 390 if (((jrand()%8)==0 && abs(o->x-b->x)<10 && o->y<b->y) ||390 if (((jrand()%8)==0 && lol::abs(o->x-b->x)<10 && o->y<b->y) || 391 391 o->lvars[ANT_need_to_dodge]==1) 392 392 { … … 400 400 if ((o->x>b->x && o->direction>0) || (o->x<b->x && o->direction<0)) 401 401 o->direction=-o->direction; 402 else if ( abs(o->x-b->x)<120 && (jrand()%4)==0)402 else if (lol::abs(o->x-b->x)<120 && (jrand()%4)==0) 403 403 { 404 404 o->set_state((character_state)S_ceil_fire); … … 484 484 wm->font()->PutString(main_screen, ivec2(x, y), msg, wm->bright_color()); 485 485 wm->flush_screen(); 486 Timer now; now.Wait Ms(500);487 } 488 } 489 486 Timer now; now.Wait(0.5); 487 } 488 } 489 -
abuse/branches/lol/src/clisp.cpp
r682 r686 1049 1049 case 1: 1050 1050 { 1051 return abs(current_object->x-current_level->attacker(current_object)->x);1051 return lol::abs(current_object->x-current_level->attacker(current_object)->x); 1052 1052 } break; 1053 1053 case 2: 1054 1054 { 1055 return abs(current_object->y-current_level->attacker(current_object)->y);1055 return lol::abs(current_object->y-current_level->attacker(current_object)->y); 1056 1056 } break; 1057 1057 case 3: -
abuse/branches/lol/src/common.h
r682 r686 21 21 // Lol Engine 22 22 // 23 #include "lol/matrix.h" 24 #include "lol/timer.h" 23 #include "core.h" 25 24 using namespace lol; 26 25 -
abuse/branches/lol/src/cop.cpp
r682 r686 175 175 176 176 // if the pointer is too close to the player go with the angle shown, not the angle through the pointer 177 if ( abs(q->y-fb[1]-v->pointer_y)<45 &&abs(v->pointer_x-q->x+fb[0])<40)177 if (lol::abs(q->y-fb[1]-v->pointer_y)<45 && lol::abs(v->pointer_x-q->x+fb[0])<40) 178 178 o->lvars[point_angle]=lisp_atan2(fb[1]-iy,fb[0]-ix); 179 179 else … … 390 390 for (p=current_level->first_active_object(); p; p=p->next_active) 391 391 { 392 xd= abs(p->x-o->x);393 yd= abs(p->y-o->y);392 xd=lol::abs(p->x-o->x); 393 yd=lol::abs(p->y-o->y); 394 394 if (xd<160 && yd<130 && bad_guy_array[p->otype] && p!=other) 395 395 { … … 1088 1088 1089 1089 wm->flush_screen(); 1090 Timer now; now.Wait Ms(4000); // wait 4 seconds1090 Timer now; now.Wait(4.f); // wait 4 seconds 1091 1091 1092 1092 return NULL; -
abuse/branches/lol/src/demo.cpp
r682 r686 205 205 /* 206 206 fade_in(cache.img(cache.reg("art/help.spe","sell6",SPEC_IMAGE,1)),8); 207 Timer now; now.Wait Ms(2000);207 Timer now; now.Wait(2.f); 208 208 fade_out(8); 209 209 */ -
abuse/branches/lol/src/dev.cpp
r682 r686 1556 1556 ivec2 pos1 = the_game->GameToMouse(ivec2(a->x, a->y), v); 1557 1557 ivec2 pos2 = the_game->GameToMouse(ivec2(a->x + a->w, a->y + a->h), v); 1558 if ( abs(pos1.x - m.x) < 2 &&abs(pos1.y - m.y) < 2)1558 if (lol::abs(pos1.x - m.x) < 2 && lol::abs(pos1.y - m.y) < 2) 1559 1559 { find = a; find_top = 1; } 1560 else if ( abs(pos2.x - m.x) < 2 &&abs(pos2.y - m.y) < 2)1560 else if (lol::abs(pos2.x - m.x) < 2 && lol::abs(pos2.y - m.y) < 2) 1561 1561 { find = a; find_top = 0; } 1562 1562 } -
abuse/branches/lol/src/endgame.cpp
r682 r686 72 72 *(lrem++)=*(sl_start++); 73 73 /* if (x==size/2 || x==size/2-1 || x==size/2+1) 74 *rem=(int)( sqrt(0.5)*map_width/2.0);74 *rem=(int)(lol::sqrt(0.5)*map_width/2.0); 75 75 else*/ 76 76 if (x<=size/2) 77 *rem=(int)( sqrt(x/(double)(size*2.0))*map_width/2.0);77 *rem=(int)(lol::sqrt(x/(double)(size*2.0))*map_width/2.0); 78 78 else 79 *rem=map_width/2-(int)( sqrt((size-x)/(double)(size*2.0))*map_width/2.0);80 81 // (int)(mask->Size().x-( sqrt((size-x)/(double)size)*map_width/2.0)+mask->Size().x/2);79 *rem=map_width/2-(int)(lol::sqrt((size-x)/(double)(size*2.0))*map_width/2.0); 80 81 // (int)(mask->Size().x-(lol::sqrt((size-x)/(double)size)*map_width/2.0)+mask->Size().x/2); 82 82 } 83 83 } -
abuse/branches/lol/src/game.cpp
r682 r686 148 148 continue; 149 149 150 int d, cx = abs(f->x_center() - x), cy =abs(f->y_center() - y);150 int d, cx = lol::abs(f->x_center() - x), cy = lol::abs(f->y_center() - y); 151 151 if(cx < cy) 152 152 d = cx + cy - (cx >> 1); … … 1079 1079 { 1080 1080 /* 25ms per step */ 1081 float const duration = 25.f;1081 float const duration = 0.025f; 1082 1082 1083 1083 palette *old_pal = pal->copy(); … … 1090 1090 } 1091 1091 1092 for (Timer total; total.Poll Ms() < duration * steps; )1092 for (Timer total; total.Poll() < duration * steps; ) 1093 1093 { 1094 1094 Timer frame; 1095 1095 uint8_t *sl1 = (uint8_t *)pal->addr(); 1096 1096 uint8_t *sl2 = (uint8_t *)old_pal->addr(); 1097 int i = (int)(total.Poll Ms() / duration);1097 int i = (int)(total.Poll() / duration); 1098 1098 int v = (N ? i + 1 : steps - i) * 256 / steps; 1099 1099 … … 1103 1103 pal->load(); 1104 1104 wm->flush_screen(); 1105 frame.Wait Ms(duration);1105 frame.Wait(duration); 1106 1106 } 1107 1107 … … 1158 1158 delete blank; 1159 1159 fade_in(cache.img(cdc_logo), 32); 1160 Timer tmp; tmp.Wait Ms(400);1160 Timer tmp; tmp.Wait(0.4f); 1161 1161 fade_out(32); 1162 1162 … … 1203 1203 1204 1204 // 120 ms per step 1205 int i = (int)(total.Poll Ms() / 120.f);1205 int i = (int)(total.Poll() / 0.120f); 1206 1206 if (i >= 400) 1207 1207 break; … … 1219 1219 cache.sfx(lnumber_value(space_snd))->play(sfx_volume * 90 / 127); 1220 1220 1221 frame.Wait Ms(25.f);1222 frame.Get Ms();1221 frame.Wait(0.025f); 1222 frame.Get(); 1223 1223 } 1224 1224 … … 1414 1414 1415 1415 time_marker *led_last_time = NULL; 1416 static float avg_ ms = 1000.0f / 15, possible_ms = 1000.0f / 15;1416 static float avg_time = 1.0f / 15, possible_time = 1.0f / 15; 1417 1417 1418 1418 void Game::toggle_delay() … … 1420 1420 no_delay = !no_delay; 1421 1421 show_help(symbol_str(no_delay ? "delay_off" : "delay_on")); 1422 avg_ ms = possible_ms = 1000.0f / 15;1422 avg_time = possible_time = 1.0f / 15; 1423 1423 } 1424 1424 … … 1429 1429 1430 1430 char str[16]; 1431 sprintf(str, "%ld", (long)(1 0000.0f / avg_ms));1431 sprintf(str, "%ld", (long)(1.0f / avg_time)); 1432 1432 console_font->PutString(main_screen, first_view->m_aa, str); 1433 1433 … … 1510 1510 1511 1511 // Find average fps for last 10 frames 1512 float delta ms = Max(1.0f, frame_timer.PollMs());1513 1514 avg_ ms = 0.9f * avg_ms + 0.1f * deltams;1515 possible_ ms = 0.9f * possible_ms + 0.1f * deltams;1516 1517 if (avg_ ms < 1000.0f / 14)1512 float deltatime = Max(0.001f, frame_timer.Poll()); 1513 1514 avg_time = 0.9f * avg_time + 0.1f * deltatime; 1515 possible_time = 0.9f * possible_time + 0.1f * deltatime; 1516 1517 if (avg_time < 1.0f / 14) 1518 1518 massive_frame_panic = Max(0, Min(20, massive_frame_panic - 1)); 1519 1519 … … 1524 1524 // ECS - Added this case and the wait. It's a cheap hack to ensure 1525 1525 // that we don't exceed 30FPS in edit mode and hog the CPU. 1526 frame_timer.Wait Ms(33);1527 } 1528 else if (avg_ ms < 1000.0f / 15 && need_delay)1526 frame_timer.Wait(0.033f); 1527 } 1528 else if (avg_time < 1.0f / 15 && need_delay) 1529 1529 { 1530 1530 frame_panic = 0; 1531 1531 if (!no_delay) 1532 1532 { 1533 frame_timer.Wait Ms(1000.0f / 15);1534 avg_ ms -= 0.1f * deltams;1535 avg_ ms += 0.1f * 1000.0f / 15;1533 frame_timer.Wait(1.0f / 15); 1534 avg_time -= 0.1f * deltatime; 1535 avg_time += 0.1f * 1.0f / 15; 1536 1536 } 1537 1537 } 1538 else if (avg_ ms > 1000.0f / 14)1539 { 1540 if(avg_ ms > 1000.0f / 10)1538 else if (avg_time > 1.0f / 14) 1539 { 1540 if(avg_time > 1.0f / 10) 1541 1541 massive_frame_panic++; 1542 1542 frame_panic++; … … 1546 1546 1547 1547 // Ignore our wait time, we're more interested in the frame time 1548 frame_timer.Get Ms();1548 frame_timer.Get(); 1549 1549 return ret; 1550 1550 } … … 2441 2441 delete chat; 2442 2442 2443 Timer tmp; tmp.Wait Ms(500);2443 Timer tmp; tmp.Wait(0.5f); 2444 2444 2445 2445 delete small_render; small_render = NULL; -
abuse/branches/lol/src/gamma.cpp
r682 r686 216 216 uint8_t oldr, oldg, oldb; 217 217 old_pal->get(i, oldr, oldg, oldb); 218 pal->set(i, (int)( pow(oldr / 255.0, gamma) * 255),219 (int)( pow(oldg / 255.0, gamma) * 255),220 (int)( pow(oldb / 255.0, gamma) * 255));218 pal->set(i, (int)(lol::pow(oldr / 255.0, gamma) * 255), 219 (int)(lol::pow(oldg / 255.0, gamma) * 255), 220 (int)(lol::pow(oldb / 255.0, gamma) * 255)); 221 221 } 222 222 -
abuse/branches/lol/src/go.cpp
r555 r686 155 155 { 156 156 int yd=o[i]->y-y; 157 if ( abs(yd)<=speed && o[i]->x>x1 && o[i]->x<x2)157 if (lol::abs(yd)<=speed && o[i]->x>x1 && o[i]->x<x2) 158 158 return (elcontrol *)(o[i]); 159 159 } … … 167 167 int elevator::decide() 168 168 { 169 if ( abs(dir)<=1) // the elevator is stopped169 if (lol::abs(dir)<=1) // the elevator is stopped 170 170 { 171 171 switch (state) … … 222 222 } 223 223 224 if ( abs(dir)>1) // are we moving?224 if (lol::abs(dir)>1) // are we moving? 225 225 { 226 226 next_picture(); … … 230 230 else adder=speed; 231 231 232 if ( abs(dir)==8) // are we checking for stops yet?232 if (lol::abs(dir)==8) // are we checking for stops yet? 233 233 { 234 234 elcontrol *s=find_stop(); -
abuse/branches/lol/src/imlib/event.cpp
r682 r686 60 60 f.Apply(im); 61 61 62 m_sprite = new Sprite(screen, im, ivec2(100, 100));62 m_sprite = new ASprite(screen, im, ivec2(100, 100)); 63 63 m_pos = screen->Size() / 2; 64 64 m_center = ivec2(0, 0); … … 86 86 87 87 if (!m_pending) 88 tmp.Wait Ms(1);88 tmp.Wait(0.001); 89 89 } 90 90 -
abuse/branches/lol/src/imlib/event.h
r682 r686 98 98 protected: 99 99 /* Mouse information */ 100 Sprite *m_sprite;100 ASprite *m_sprite; 101 101 ivec2 m_pos, m_center; 102 102 int m_button; -
abuse/branches/lol/src/imlib/filter.cpp
r682 r686 88 88 return; 89 89 90 aa += Max(caa - pos, 0);90 aa += Max(caa - pos, ivec2(0)); 91 91 pos = Max(pos, caa); 92 92 bb = Min(bb, cbb - pos + aa); -
abuse/branches/lol/src/imlib/image.cpp
r682 r686 222 222 int xi = (span.x < 0) ? -1 : 1; 223 223 int yi = (span.y < 0) ? -1 : 1; 224 int n = abs(span.x);225 int m = abs(span.y);224 int n = lol::abs(span.x); 225 int m = lol::abs(span.y); 226 226 227 227 uint8_t *start = scan_line(p1.y) + p1.x; … … 317 317 // with no dirty rectangle keeping. 318 318 if (!m_special) 319 m_special = new image_descriptor(m_size .x, m_size.y, 0);319 m_special = new image_descriptor(m_size, 0); 320 320 321 321 // set the image descriptor what the clip … … 351 351 // with no dirty rectangle keeping. 352 352 if (!m_special) 353 m_special = new image_descriptor(m_size .x, m_size.y, 0);353 m_special = new image_descriptor(m_size, 0); 354 354 355 355 // set the image descriptor what the clip … … 735 735 x1=Max(x1, caa.x); y1=Max(caa.y, y1); x2=Min(x2, cbb.x - 1); y2=Min(y2, cbb.y - 1); 736 736 } 737 int16_t xsrc, ysrc, xdst, ydst, xtot=x2-x1- abs(xd)+1, ytot, xt;737 int16_t xsrc, ysrc, xdst, ydst, xtot=x2-x1-lol::abs(xd)+1, ytot, xt; 738 738 uint8_t *src, *dst; 739 739 if (xd<0) { xsrc=x1-xd; xdst=x1; } else { xsrc=x2-xd; xdst=x2; } 740 740 if (yd<0) { ysrc=y1-yd; ydst=y1; } else { ysrc=y2-yd; ydst=y2; } 741 for (ytot=y2-y1- abs(yd)+1; ytot; ytot--)741 for (ytot=y2-y1-lol::abs(yd)+1; ytot; ytot--) 742 742 { src=scan_line(ysrc)+xsrc; 743 743 dst=scan_line(ydst)+xdst; -
abuse/branches/lol/src/imlib/jwindow.cpp
r682 r686 374 374 Jwindow::Jwindow(ivec2 pos, ivec2 size, ifield *f, char const *name) 375 375 { 376 m_size = 0;376 m_size = ivec2(0); 377 377 _hidden = false; 378 378 _moveable = true; -
abuse/branches/lol/src/imlib/palette.cpp
r653 r686 128 128 else 129 129 { 130 v=(int) ((double)i+(double)( sqrt(63.0-i)));130 v=(int) ((double)i+(double)(lol::sqrt(63.0-i))); 131 131 v<<=2; 132 132 } -
abuse/branches/lol/src/imlib/sprite.cpp
r682 r686 23 23 #include "sprite.h" 24 24 25 Sprite::Sprite(image *screen, image *visual, ivec2 pos)25 ASprite::ASprite(image *screen, image *visual, ivec2 pos) 26 26 { 27 27 CHECK(visual && screen); … … 31 31 m_save = new image(visual->Size()); 32 32 33 if (m_pos + visual->Size() >= 0&& m_pos < ivec2(xres, yres))34 m_save->PutPart(m_screen, ivec2(0 ,0), m_pos, m_pos + m_save->Size());33 if (m_pos + visual->Size() >= ivec2(0) && m_pos < ivec2(xres, yres)) 34 m_save->PutPart(m_screen, ivec2(0), m_pos, m_pos + m_save->Size()); 35 35 } 36 36 37 Sprite::~Sprite()37 ASprite::~ASprite() 38 38 { 39 39 delete m_save; 40 40 } 41 41 42 void Sprite::SetVisual(image *visual, int delete_old)42 void ASprite::SetVisual(image *visual, int delete_old) 43 43 { 44 44 if (delete_old) … … 51 51 } 52 52 53 if (m_pos + visual->Size() >= 0&& m_pos < ivec2(xres, yres))54 m_save->PutPart(m_screen, ivec2(0 ,0), m_pos, m_pos + m_save->Size());53 if (m_pos + visual->Size() >= ivec2(0) && m_pos < ivec2(xres, yres)) 54 m_save->PutPart(m_screen, ivec2(0), m_pos, m_pos + m_save->Size()); 55 55 } 56 56 -
abuse/branches/lol/src/imlib/sprite.h
r682 r686 15 15 #include "linked.h" 16 16 17 class Sprite : public linked_node17 class ASprite : public linked_node 18 18 { 19 19 public: 20 Sprite(image *screen, image *visual, ivec2 pos);21 ~ Sprite();20 ASprite(image *screen, image *visual, ivec2 pos); 21 ~ASprite(); 22 22 23 23 void SetVisual(image *visual, int delete_old = 0); -
abuse/branches/lol/src/imlib/transimage.cpp
r682 r686 277 277 void TransImage::PutImage(image *screen, ivec2 pos) 278 278 { 279 PutImageGeneric<NORMAL>(screen, pos, 0, NULL, 0, NULL, NULL,279 PutImageGeneric<NORMAL>(screen, pos, 0, NULL, ivec2(0), NULL, NULL, 280 280 0, 1, NULL, NULL, NULL); 281 281 } … … 283 283 void TransImage::PutRemap(image *screen, ivec2 pos, uint8_t *map) 284 284 { 285 PutImageGeneric<REMAP>(screen, pos, 0, NULL, 0, map, NULL,285 PutImageGeneric<REMAP>(screen, pos, 0, NULL, ivec2(0), map, NULL, 286 286 0, 1, NULL, NULL, NULL); 287 287 } … … 290 290 uint8_t *map, uint8_t *map2) 291 291 { 292 PutImageGeneric<REMAP2>(screen, pos, 0, NULL, 0, map, map2,292 PutImageGeneric<REMAP2>(screen, pos, 0, NULL, ivec2(0), map, map2, 293 293 0, 1, NULL, NULL, NULL); 294 294 } … … 298 298 ColorFilter *f, palette *pal) 299 299 { 300 PutImageGeneric<FADE>(screen, pos, 0, NULL, 0, NULL, NULL,300 PutImageGeneric<FADE>(screen, pos, 0, NULL, ivec2(0), NULL, NULL, 301 301 amount, nframes, NULL, f, pal); 302 302 } … … 305 305 uint8_t *tint, ColorFilter *f, palette *pal) 306 306 { 307 PutImageGeneric<FADE_TINT>(screen, pos, 0, NULL, 0, NULL, NULL,307 PutImageGeneric<FADE_TINT>(screen, pos, 0, NULL, ivec2(0), NULL, NULL, 308 308 amount, nframes, tint, f, pal); 309 309 } … … 311 311 void TransImage::PutColor(image *screen, ivec2 pos, uint8_t color) 312 312 { 313 PutImageGeneric<COLOR>(screen, pos, color, NULL, 0, NULL, NULL,313 PutImageGeneric<COLOR>(screen, pos, color, NULL, ivec2(0), NULL, NULL, 314 314 0, 1, NULL, NULL, NULL); 315 315 } … … 326 326 void TransImage::PutFilled(image *screen, ivec2 pos, uint8_t color) 327 327 { 328 PutImageGeneric<FILLED>(screen, pos, color, NULL, 0, NULL, NULL,328 PutImageGeneric<FILLED>(screen, pos, color, NULL, ivec2(0), NULL, NULL, 329 329 0, 1, NULL, NULL, NULL); 330 330 } … … 332 332 void TransImage::PutPredator(image *screen, ivec2 pos) 333 333 { 334 PutImageGeneric<PREDATOR>(screen, pos, 0, NULL, 0, NULL, NULL,334 PutImageGeneric<PREDATOR>(screen, pos, 0, NULL, ivec2(0), NULL, NULL, 335 335 0, 1, NULL, NULL, NULL); 336 336 } … … 338 338 void TransImage::PutScanLine(image *screen, ivec2 pos, int line) 339 339 { 340 PutImageGeneric<SCANLINE>(screen, pos, 0, NULL, 0, NULL, NULL,340 PutImageGeneric<SCANLINE>(screen, pos, 0, NULL, ivec2(0), NULL, NULL, 341 341 line, 1, NULL, NULL, NULL); 342 342 } -
abuse/branches/lol/src/intsect.cpp
r555 r686 13 13 #endif 14 14 15 #include "common.h" 16 15 17 #include <stdlib.h> 16 18 … … 121 123 else 122 124 { 123 if ( abs(mx1)>abs(my1))125 if (lol::abs(mx1)>lol::abs(my1)) 124 126 { 125 127 int32_t ae_bd=my1*mx2-mx1*my2; … … 138 140 } 139 141 140 if ( abs(tx2-x1)<abs(x2-x1) || abs(ty2-y1)<abs(y2-y1))142 if (lol::abs(tx2-x1)<lol::abs(x2-x1) || lol::abs(ty2-y1)<lol::abs(y2-y1)) 141 143 { 142 144 x2=tx2; … … 171 173 172 174 int32_t xdiff,ydiff; 173 /* int32_t xdiff= abs(xp1-xp2),ydiff=yp1-yp2;175 /* int32_t xdiff=lol::abs(xp1-xp2),ydiff=yp1-yp2; 174 176 if (xdiff>=ydiff) // increment the endpoints 175 177 if (xp2<xp1) { xp2--; xp1++; } … … 205 207 x2=(b1*c2-b2*c1)/(ae-bd); 206 208 y2=(a1*c2-a2*c1)/(bd-ae); 207 xdiff= abs(x2-x1);208 ydiff= abs(y2-y1);209 xdiff=lol::abs(x2-x1); 210 ydiff=lol::abs(y2-y1); 209 211 // if (xdiff<=ydiff) // push the intersection back one pixel 210 212 // { -
abuse/branches/lol/src/lcache.cpp
r636 r686 18 18 # include "config.h" 19 19 #endif 20 21 #include "common.h" 20 22 21 23 #include "lisp.h" … … 122 124 123 125 LList *last = NULL, *first = NULL; 124 for (size_t count = abs(t); count--; )126 for (size_t count = lol::abs(t); count--; ) 125 127 { 126 128 LList *c = LList::Create(); … … 134 136 135 137 last = first; 136 for (size_t count = abs(t); count--; last = (LList *)last->m_cdr)138 for (size_t count = lol::abs(t); count--; last = (LList *)last->m_cdr) 137 139 last->m_car = load_block(fp); 138 140 return first; -
abuse/branches/lol/src/level.cpp
r682 r686 55 55 if (f->m_focus) 56 56 { 57 int32_t tmp_d= abs(f->m_focus->x-who->x)+abs(f->m_focus->y-who->y);57 int32_t tmp_d=lol::abs(f->m_focus->x-who->x)+lol::abs(f->m_focus->y-who->y); 58 58 if (tmp_d<d) 59 59 { … … 378 378 { 379 379 int b1=subject->push_range(),b2=target->push_range(); 380 if ( abs(subject->x-target->x)<b1+b2)381 { 382 int32_t tmove=b1+b2- abs(subject->x-target->x),xv,yv=0,xv2;380 if (lol::abs(subject->x-target->x)<b1+b2) 381 { 382 int32_t tmove=b1+b2-lol::abs(subject->x-target->x),xv,yv=0,xv2; 383 383 if (subject->x>target->x) 384 384 xv=tmove/2; … … 692 692 else if (shutdown_lighting_value!=c->ambient) // do we need to lower light toward real ambient? 693 693 { 694 if ( abs(shutdown_lighting_value-c->ambient)<4)694 if (lol::abs(shutdown_lighting_value-c->ambient)<4) 695 695 shutdown_lighting_value=c->ambient; 696 696 else … … 2889 2889 if (o->otype==type) 2890 2890 { 2891 int x_dist= abs(x-o->x);2892 int y_dist= abs(y-o->y);2891 int x_dist=lol::abs(x-o->x); 2892 int y_dist=lol::abs(y-o->y); 2893 2893 2894 2894 if (x_dist<xd && y_dist<find_ydist) … … 2912 2912 if (o->otype==type && o!=who) 2913 2913 { 2914 int x_dist= abs(x-o->x);2914 int x_dist=lol::abs(x-o->x); 2915 2915 if (x_dist<find_xdist) 2916 2916 { 2917 2917 find_xdist=x_dist; 2918 find_ydist= abs(y-o->y);2918 find_ydist=lol::abs(y-o->y); 2919 2919 find=o; 2920 2920 } 2921 2921 else if (x_dist==find_xdist) 2922 2922 { 2923 int y_dist= abs(y-o->y);2923 int y_dist=lol::abs(y-o->y); 2924 2924 if (y_dist<find_ydist) 2925 2925 { … … 3000 3000 { 3001 3001 int32_t y1=o->y,y2=o->y-o->picture()->Size().y; 3002 int32_t cx= abs(o->x-x),cy1=abs(y1-y),d1,d2,cy2=abs(y2-y);3002 int32_t cx=lol::abs(o->x-x),cy1=lol::abs(y1-y),d1,d2,cy2=lol::abs(y2-y); 3003 3003 if (cx<cy1) 3004 3004 d1=cx+cy1-(cx>>1); … … 3061 3061 if (v!=exclude) 3062 3062 { 3063 int32_t cx= abs(v->x_center()-o->x),cy=abs(v->y_center()-o->y),d;3063 int32_t cx=lol::abs(v->x_center()-o->x),cy=lol::abs(v->y_center()-o->y),d; 3064 3064 if (cx<cy) 3065 3065 d=cx+cy-(cx>>1); … … 3172 3172 if (!NILP(v)) 3173 3173 { 3174 xo= abs(o->x-x);3175 yo= abs(o->y-y);3174 xo=lol::abs(o->x-x); 3175 yo=lol::abs(o->y-y); 3176 3176 distance=xo*xo+yo*yo; 3177 3177 if (distance<closest_distance) … … 3207 3207 if (!NILP(v)) 3208 3208 { 3209 xo= abs(o->x-x);3210 yo= abs(o->y-y);3209 xo=lol::abs(o->x-x); 3210 yo=lol::abs(o->y-y); 3211 3211 distance=xo*xo+yo*yo; 3212 3212 if (distance<closest_distance) -
abuse/branches/lol/src/light.cpp
r682 r686 553 553 else 554 554 { 555 int32_t dx= abs(fn->x-x)<<fn->xshift;556 int32_t dy= abs(fn->y-y)<<fn->yshift;555 int32_t dx=lol::abs(fn->x-x)<<fn->xshift; 556 int32_t dy=lol::abs(fn->y-y)<<fn->yshift; 557 557 int32_t r2; 558 558 if (dx<dy) … … 658 658 { 659 659 dt++; 660 dx= abs(*dt-sx); dt++; // xdist between light and this block (dt==x)660 dx=lol::abs(*dt-sx); dt++; // xdist between light and this block (dt==x) 661 661 dx<<=*dt; dt++; // shift makes distance further, 662 662 // making light skinner. (dt==xshift) 663 663 664 dy= abs(*dt-sy); dt++; // ydist (dt==y)664 dy=lol::abs(*dt-sy); dt++; // ydist (dt==y) 665 665 dy<<=*dt; dt++; // (dt==yshift) 666 666 -
abuse/branches/lol/src/lisp/lisp.cpp
r643 r686 678 678 if (dy>0) 679 679 { 680 if ( abs(dx)>abs(dy))680 if (lol::abs(dx)>lol::abs(dy)) 681 681 { 682 682 int32_t a=dx*29/dy; … … 692 692 } else 693 693 { 694 if ( abs(dx)>abs(dy))695 { 696 int32_t a=dx*29/ abs(dy);694 if (lol::abs(dx)>lol::abs(dy)) 695 { 696 int32_t a=dx*29/lol::abs(dy); 697 697 if (a>=TBS) 698 698 return 0; … … 702 702 else 703 703 { 704 int32_t a= abs(dy)*29/dx;704 int32_t a=lol::abs(dy)*29/dx; 705 705 if (a>=TBS) 706 706 return 260; … … 713 713 if (dy>0) 714 714 { 715 if ( abs(dx)>abs(dy))715 if (lol::abs(dx)>lol::abs(dy)) 716 716 { 717 717 int32_t a=-dx*29/dy; … … 731 731 } else 732 732 { 733 if ( abs(dx)>abs(dy))734 { 735 int32_t a=-dx*29/ abs(dy);733 if (lol::abs(dx)>lol::abs(dy)) 734 { 735 int32_t a=-dx*29/lol::abs(dy); 736 736 if (a>=TBS) 737 737 return 225-45; … … 740 740 else 741 741 { 742 int32_t a= abs(dy)*29/abs(dx);742 int32_t a=lol::abs(dy)*29/lol::abs(dx); 743 743 if (a>=TBS) 744 744 return 225+45; … … 2417 2417 } 2418 2418 case SYS_FUNC_ABS: 2419 ret = LNumber::Create( abs(lnumber_value(CAR(arg_list)->Eval())));2419 ret = LNumber::Create(lol::abs(lnumber_value(CAR(arg_list)->Eval()))); 2420 2420 break; 2421 2421 case SYS_FUNC_MIN: -
abuse/branches/lol/src/menu.cpp
r682 r686 233 233 wm->flush_screen(); 234 234 main_screen->PutImage(save, ivec2(mx + 1, by1)); 235 } else { Timer tmp; tmp.Wait Ms(10); }235 } else { Timer tmp; tmp.Wait(0.01f); } 236 236 237 237 } while (!done); … … 669 669 { 670 670 // ECS - Added so that main menu doesn't grab 100% of CPU 671 Timer tmp; tmp.Wait Ms(30);671 Timer tmp; tmp.Wait(0.03f); 672 672 } 673 673 -
abuse/branches/lol/src/netcfg.cpp
r682 r686 511 511 // pretending to broadcast. 512 512 // ECS - Added so waiting in dialog doesn't use 100% of CPU 513 Timer tmp; tmp.Wait Ms(5);513 Timer tmp; tmp.Wait(0.005f); 514 514 } 515 515 } -
abuse/branches/lol/src/newlight.cpp
r555 r686 438 438 else 439 439 { 440 long dx= abs(fn->x-x)<<fn->xshift;441 long dy= abs(fn->y-y)<<fn->yshift;440 long dx=lol::abs(fn->x-x)<<fn->xshift; 441 long dy=lol::abs(fn->y-y)<<fn->yshift; 442 442 long r2; 443 443 if (dx<dy) … … 531 531 { 532 532 dt++; 533 int dx= abs(*dt-sx); dt++;533 int dx=lol::abs(*dt-sx); dt++; 534 534 dx<<=*dt; dt++; 535 535 536 int dy= abs(*dt-sy); dt++;536 int dy=lol::abs(*dt-sy); dt++; 537 537 dy<<=*dt; dt++; 538 538 -
abuse/branches/lol/src/objects.cpp
r682 r686 1044 1044 1045 1045 climb_xvel=old_vx-xvel(); 1046 climb_yvel=-( abs(climb_xvel)); // now try 45 degree slope1046 climb_yvel=-(lol::abs(climb_xvel)); // now try 45 degree slope 1047 1047 try_move(x,y,climb_xvel,climb_yvel,3); 1048 1048 1049 if ( abs(climb_xvel)>0) // see if he got further by climbing1049 if (lol::abs(climb_xvel)>0) // see if he got further by climbing 1050 1050 { 1051 1051 blocked=blocked&(~(BLOCKED_LEFT|BLOCKED_RIGHT)); … … 1058 1058 1059 1059 // now put him back on the ground 1060 climb_yvel= abs(climb_xvel)+5; // plus one to put him back on the ground1060 climb_yvel=lol::abs(climb_xvel)+5; // plus one to put him back on the ground 1061 1061 climb_xvel=0; 1062 1062 try_move(x,y,climb_xvel,climb_yvel,1); … … 1418 1418 1419 1419 1420 if ( abs(xvel()+xacel())>top_speed)1420 if (lol::abs(xvel()+xacel())>top_speed) 1421 1421 { 1422 1422 if (xacel()<0) set_xacel(-top_speed-xvel()); -
abuse/branches/lol/src/particle.cpp
r682 r686 214 214 main_screen->GetClip(caa, cbb); 215 215 216 int t = 1 + Max( abs(p2.x - p1.x),abs(p2.y - p1.y));216 int t = 1 + Max(lol::abs(p2.x - p1.x), lol::abs(p2.y - p1.y)); 217 217 int xo = p1.x << 16, 218 218 yo = p1.y << 16, … … 244 244 main_screen->GetClip(caa, cbb); 245 245 246 int t = 1 + Max( abs(p2.x - p1.x),abs(p2.y - p1.y));246 int t = 1 + Max(lol::abs(p2.x - p1.x), lol::abs(p2.y - p1.y)); 247 247 int xo = p1.x << 16, 248 248 yo = p1.y << 16, -
abuse/branches/lol/src/sdlport/sound.cpp
r634 r686 25 25 #include <cstring> 26 26 27 #include "common.h" 28 27 29 #include <SDL.h> 28 30 #include <SDL/SDL_mixer.h> -
abuse/branches/lol/src/sensor.cpp
r676 r686 34 34 b=current_level->attacker(current_object); 35 35 else b=player_list->m_focus; 36 if ( abs(b->x-o->x)<o->xvel() &&abs(b->y-o->y)<o->yvel()) // inside area?36 if (lol::abs(b->x-o->x)<o->xvel() && lol::abs(b->y-o->y)<o->yvel()) // inside area? 37 37 { 38 38 if (!o->hp()) … … 50 50 b=current_level->attacker(current_object); 51 51 else b=player_list->m_focus; 52 if ( abs(o->x-b->x)>o->xacel() ||abs(o->y-b->y)>o->yacel())52 if (lol::abs(o->x-b->x)>o->xacel() || lol::abs(o->y-b->y)>o->yacel()) 53 53 o->set_aistate(0); 54 54 } else o->set_aistate(o->aistate()-1);
Note: See TracChangeset
for help on using the changeset viewer.