-lSDL2main -lSDL2 -lSDL2_image -lSDL2_mixer -lfreetype
endif
- CXXFLAGS = -g -m$(TARGET_BITS) -std=c++1z
-CXXFLAGS = -m$(TARGET_BITS) -std=c++17
++CXXFLAGS = -g -m$(TARGET_BITS) -std=c++17
CXXINC = -Iinclude -Iinclude/freetype
CXXWARN = -Wall -Wextra -Werror -pedantic-errors
selected = true;
}
}
- if((ui::mouse.x - offset.x) < mouseStart.x){
+ if ((ui::mouse.x - offset.x) < mouseStart.x) {
thing = (mouseStart.x - (ui::mouse.x - offset.x))/80;
- if ((int)sel-(int)thing<0)highlight=0;
- else highlight=sel-thing;
- if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)) {
+ if ((int)sel - (int)thing < 0)
+ highlight = 0;
+ else
+ highlight = sel - thing;
+ if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)){
sel = highlight;
mouseSel=false;
invHover=false;
}
}
}
- std::cout << "Rays" << std::endl;
- for(auto &r : iray) {
- std::cout << "Setting angle" << std::endl;
- angle=180-(angleB*a) - angleB/2.0f;
- std::cout << "Currcourd" << std::endl;
+
+ a = 0;
+ for (auto &r : iray) {
+ angle = 180 - (angleB * a) - angleB / 2.0f;
-
curCoord[a].x += float(range) * cos(angle*PI/180);
curCoord[a].y += float(range) * sin(angle*PI/180);
- std::cout << "Ray.end" << std::endl;
r.end = curCoord[a];
- std::cout << "Draw" << std::endl;
+ // square drawing
glColor4f(0.0f, 0.0f, 0.0f, a == highlight ? 0.5f : 0.1f);
glBegin(GL_QUADS);
glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2));
}
a++;
}
+
+ if (highlight < items.size()) {
+ ui::putStringCentered(player->loc.x + player->width / 2,
+ player->loc.y + range * 0.75f,
+ itemMap[items[highlight].id]->name.c_str()
+ );
+ }
}
-
- if(!items.empty() && items.size() > sel && items[sel].count)
+ if (!items.empty() && items.size() > sel && items[sel].count)
itemDraw(player,items[sel].id);
}
singleDetect(Entity *e)
{
std::string killed;
- unsigned int i,j;
+ unsigned int i;
int l;
- /*
- * Kill any dead entities.
- */
-
+ // kill dead entities
if (e->alive && e->health <= 0) {
+ // die
e->alive = false;
e->health = 0;
+
+ // delete the entity
for (i = 0; i < entity.size(); i++) {
- if (entity[i] == e){
+ if (entity[i] == e) {
switch (e->type) {
case STRUCTURET:
killed = "structure";
deleteEntities();
}
-World *Arena::exitArena(Player *p){
+World *Arena::exitArena(Player *p) {
World *tmp;
if (!mmob->alive &&
- p->loc.x + p->width / 2 > mob[0].loc.x &&
- p->loc.x + p->width / 2 < mob[0].loc.x + HLINE * 12) {
+ p->loc.x + p->width / 2 > mob[0]->loc.x &&
+ p->loc.x + p->width / 2 < mob[0]->loc.x + HLINE * 12) {
tmp = battleNest.front();
battleNest.erase(battleNest.begin());