Ejemplo n.º 1
0
static void DisplayCharacter(int x, int y, const TBadGuy * data,
			     int hilite)
{
	struct CharacterDescription *cd;
	TOffsetPic body, head;

	cd = &characterDesc[0];
	SetupMissionCharacter(0, data);

	body.dx = cBodyOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dx;
	body.dy = cBodyOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dy;
	body.picIndex =
	    cBodyPic[cd->unarmedBodyPic][DIRECTION_DOWN][STATE_IDLE];

	head.dx =
	    cNeckOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dx +
	    cHeadOffset[cd->facePic][DIRECTION_DOWN].dx;
	head.dy =
	    cNeckOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dy +
	    cHeadOffset[cd->facePic][DIRECTION_DOWN].dy;
	head.picIndex = cHeadPic[cd->facePic][DIRECTION_DOWN][STATE_IDLE];

	DrawTTPic(x + body.dx, y + body.dy, gPics[body.picIndex],
		  cd->table, NULL);
	DrawTTPic(x + head.dx, y + head.dy, gPics[head.picIndex],
		  cd->table, NULL);

	if (hilite) {
		TextGoto(x - 8, y - 16);
		TextChar('\020');
	}
}
Ejemplo n.º 2
0
static void DrawObjectiveInfo(
	const struct MissionOptions *mo, const int idx, const Vec2i pos)
{
	const MissionObjective *mobj =
		CArrayGet(&mo->missionData->Objectives, idx);
	const ObjectiveDef *o = CArrayGet(&mo->Objectives, idx);
	const CharacterStore *store = &gCampaign.Setting.characters;

	switch (mobj->Type)
	{
	case OBJECTIVE_KILL:
		{
			const Character *cd = CArrayGet(
				&store->OtherChars, CharacterStoreGetSpecialId(store, 0));
			const int i = cd->looks.face;
			TOffsetPic pic;
			pic.picIndex = cHeadPic[i][DIRECTION_DOWN][STATE_IDLE];
			pic.dx = cHeadOffset[i][DIRECTION_DOWN].dx;
			pic.dy = cHeadOffset[i][DIRECTION_DOWN].dy;
			DrawTTPic(
				pos.x + pic.dx, pos.y + pic.dy,
				PicManagerGetOldPic(&gPicManager, pic.picIndex), &cd->table);
		}
		break;
	case OBJECTIVE_RESCUE:
		{
			const Character *cd = CArrayGet(
				&store->OtherChars, CharacterStoreGetPrisonerId(store, 0));
			const int i = cd->looks.face;
			TOffsetPic pic;
			pic.picIndex = cHeadPic[i][DIRECTION_DOWN][STATE_IDLE];
			pic.dx = cHeadOffset[i][DIRECTION_DOWN].dx;
			pic.dy = cHeadOffset[i][DIRECTION_DOWN].dy;
			DrawTTPic(
				pos.x + pic.dx, pos.y + pic.dy,
				PicManagerGetOldPic(&gPicManager, pic.picIndex), &cd->table);
		}
		break;
	case OBJECTIVE_COLLECT:
		{
			const Pic *p = o->pickupClass->Pic;
			Blit(&gGraphicsDevice, p, Vec2iAdd(pos, p->offset));
		}
		break;
	case OBJECTIVE_DESTROY:
		{
			Vec2i picOffset;
			const Pic *p =
				MapObjectGetPic(IntMapObject(mobj->Index), &picOffset, false);
			Blit(&gGraphicsDevice, p, Vec2iAdd(pos, picOffset));
		}
		break;
	case OBJECTIVE_INVESTIGATE:
		// Don't draw
		return;
	default:
		CASSERT(false, "Unknown objective type");
		return;
	}
}
Ejemplo n.º 3
0
void DisplayCharacter(int x, int y, int character, int hilite)
{
	struct CharacterDescription *cd;
	TOffsetPic body, head;

	cd = &characterDesc[character];

	body.dx = cBodyOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dx;
	body.dy = cBodyOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dy;
	body.picIndex =
	    cBodyPic[cd->unarmedBodyPic][DIRECTION_DOWN][STATE_IDLE];

	head.dx =
	    cNeckOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dx +
	    cHeadOffset[cd->facePic][DIRECTION_DOWN].dx;
	head.dy =
	    cNeckOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dy +
	    cHeadOffset[cd->facePic][DIRECTION_DOWN].dy;
	head.picIndex = cHeadPic[cd->facePic][DIRECTION_DOWN][STATE_IDLE];

	DrawTTPic(x + body.dx, y + body.dy, gPics[body.picIndex],
		  cd->table, NULL);
	DrawTTPic(x + head.dx, y + head.dy, gPics[head.picIndex],
		  cd->table, NULL);

	if (hilite) {
		TextGoto(x - 8, y - 16);
		TextChar('\020');
		TextGoto(x - 8, y + 8);
		TextString(gunDesc[cd->defaultGun].gunName);
	}
}
Ejemplo n.º 4
0
void TextCharWithTable(char c, TranslationTable * table)
{
    int i = CHAR_INDEX(c);
    if (i >= 0 && i <= CHARS_IN_FONT && font[i]) {
        DrawTTPic(xText, yText, font[i], table, rleFont[i]);
        xText += 1 + PicWidth(font[i]) + dxText;
    } else {
        i = CHAR_INDEX('.');
        DrawTTPic(xText, yText, font[i], table, rleFont[i]);
        xText += 1 + PicWidth(font[i]) + dxText;
    }
}
Ejemplo n.º 5
0
void DisplayPlayer(int x, struct PlayerData *data, int character,
		   int editingName)
{
	struct CharacterDescription *cd;
	TOffsetPic body, head;
	char s[22];
	int y;

	y = gGraphicsDevice.cachedConfig.ResolutionHeight / 10;

	cd = &characterDesc[character];

	if (editingName) {
		sprintf(s, "%c%s%c", '\020', data->name, '\021');
		CDogsTextStringAt(x, y, s);
	} else
		CDogsTextStringAt(x, y, data->name);

	body.dx = cBodyOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dx;
	body.dy = cBodyOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dy;
	body.picIndex =
	    cBodyPic[cd->unarmedBodyPic][DIRECTION_DOWN][STATE_IDLE];

	head.dx =
	    cNeckOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dx +
	    cHeadOffset[cd->facePic][DIRECTION_DOWN].dx;
	head.dy =
	    cNeckOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dy +
	    cHeadOffset[cd->facePic][DIRECTION_DOWN].dy;
	head.picIndex = cHeadPic[cd->facePic][DIRECTION_DOWN][STATE_IDLE];

	DrawTTPic(x + 20 + body.dx, y + 36 + body.dy, gPics[body.picIndex],
		  cd->table, gRLEPics[body.picIndex]);
	DrawTTPic(x + 20 + head.dx, y + 36 + head.dy, gPics[head.picIndex],
		  cd->table, gRLEPics[head.picIndex]);
}
Ejemplo n.º 6
0
static void DisplayPlayer(TActor * player)
{
	int x, y;
	struct CharacterDescription *c;
	int pic;

	if (player) {
		c = &characterDesc[player->character];
		pic = cHeadPic[c->facePic][DIRECTION_DOWN][STATE_IDLE];
		x = MAP_XOFFS +
		    MAP_FACTOR * player->tileItem.x / TILE_WIDTH;
		y = MAP_YOFFS +
		    MAP_FACTOR * player->tileItem.y / TILE_HEIGHT;
		x -= PicWidth(gPics[pic]) / 2;
		y -= PicHeight(gPics[pic]) / 2;
		DrawTTPic(x, y, gPics[pic], c->table, gRLEPics[pic]);
	}
}
Ejemplo n.º 7
0
void DrawObjectiveInfo(int index, int y, int xc)
{
	TOffsetPic pic;
	TranslationTable *table = NULL;
	int i;
	const char *typeText;
	char s[50];

	switch (currentMission->objectives[index].type) {
	case OBJECTIVE_KILL:
		typeText = "Kill";
		i = characterDesc[currentMission->baddieCount +
				  CHARACTER_OTHERS].facePic;
		table =
		    characterDesc[currentMission->baddieCount +
				  CHARACTER_OTHERS].table;
		pic.picIndex = cHeadPic[i][DIRECTION_DOWN][STATE_IDLE];
		pic.dx = cHeadOffset[i][DIRECTION_DOWN].dx;
		pic.dy = cHeadOffset[i][DIRECTION_DOWN].dy;
		break;
	case OBJECTIVE_RESCUE:
		typeText = "Rescue";
		i = characterDesc[CHARACTER_PRISONER].facePic;
		table = characterDesc[CHARACTER_PRISONER].table;
		pic.picIndex = cHeadPic[i][DIRECTION_DOWN][STATE_IDLE];
		pic.dx = cHeadOffset[i][DIRECTION_DOWN].dx;
		pic.dy = cHeadOffset[i][DIRECTION_DOWN].dy;
		break;
	case OBJECTIVE_COLLECT:
		typeText = "Collect";
		i = gMission.objectives[index].pickupItem;
		pic = cGeneralPics[i];
		break;
	case OBJECTIVE_DESTROY:
		typeText = "Destroy";
		i = gMission.objectives[index].blowupObject->pic;
		pic = cGeneralPics[i];
		break;
	case OBJECTIVE_INVESTIGATE:
		typeText = "Explore";
		break;
	default:
		typeText = "???";
		i = gMission.objectives[i].pickupItem;
		pic = cGeneralPics[i];
	}

	DisplayText(20, y, typeText, xc == XC_TYPE, 0);

	if (currentMission->objectives[index].type !=
	    OBJECTIVE_INVESTIGATE) {
		if (table)
			DrawTTPic(60 + pic.dx, y + 8 + pic.dy,
				  gPics[pic.picIndex], table, NULL);
		else
			DrawTPic(60 + pic.dx, y + 8 + pic.dy,
				 gPics[pic.picIndex], NULL);
	}

	sprintf(s, "%d", currentMission->objectives[index].required);
	DisplayText(90, y, s, xc == XC_REQUIRED, 0);
	sprintf(s, "out of %d", currentMission->objectives[index].count);
	DisplayText(110, y, s, xc == XC_TOTAL, 0);

	sprintf(s, "%s %s %s %s %s",
		(currentMission->objectives[index].
		 flags & OBJECTIVE_HIDDEN) != 0 ? "hidden" : "",
		(currentMission->objectives[index].
		 flags & OBJECTIVE_POSKNOWN) != 0 ? "pos.known" : "",
		(currentMission->objectives[index].
		 flags & OBJECTIVE_HIACCESS) != 0 ? "access" : "",
		(currentMission->objectives[index].
		 flags & OBJECTIVE_UNKNOWNCOUNT) != 0 ? "no-count" : "",
		(currentMission->objectives[index].
		 flags & OBJECTIVE_NOACCESS) != 0 ? "no-access" : "");
	DisplayText(150, y, s, xc == XC_FLAGS, 0);

	SetSecondaryMouseRects(localObjectiveClicks);
}
Ejemplo n.º 8
0
static void DrawWallsAndThings(DrawBuffer *b, Vec2i offset)
{
	Vec2i pos;
	Tile *tile = &b->tiles[0][0];
	pos.y = b->dy + cWallOffset.dy + offset.y;
	for (int y = 0; y < Y_TILES; y++, pos.y += TILE_HEIGHT)
	{
		TTileItem *displayList = NULL;
		pos.x = b->dx + cWallOffset.dx + offset.x;
		for (int x = 0; x < b->Size.x; x++, tile++, pos.x += TILE_WIDTH)
		{
			if (tile->flags & MAPTILE_IS_WALL)
			{
				if (!(tile->flags & MAPTILE_DELAY_DRAW))
				{
					DrawWallColumn(y, pos, tile);
				}
			}
			else if (tile->flags & MAPTILE_OFFSET_PIC)
			{
				// Drawing doors
				BlitMasked(
					&gGraphicsDevice,
					&tile->picAlt,
					pos,
					GetTileLOSMask(tile),
					0);
			}
			if (!(tile->flags & MAPTILE_OUT_OF_SIGHT))
			{
				// Draw the items that are in LOS
				for (int i = 0; i < (int)tile->things.size; i++)
				{
					TTileItem *ti =
						ThingIdGetTileItem(CArrayGet(&tile->things, i));
					if (!(ti->flags & TILEITEM_IS_WRECK))
					{
						AddItemToDisplayList(ti, &displayList);
					}
				}
			}
		}
		for (TTileItem *t = displayList; t; t = t->nextToDisplay)
		{
			Vec2i picPos = Vec2iNew(
				t->x - b->xTop + offset.x, t->y - b->yTop + offset.y);
			if (t->getPicFunc)
			{
				Vec2i picOffset;
				const Pic *pic = t->getPicFunc(t->id, &picOffset);
				Blit(&gGraphicsDevice, pic, Vec2iAdd(picPos, picOffset));
			}
			else if (t->getActorPicsFunc)
			{
				ActorPics pics = t->getActorPicsFunc(t->id);
				if (pics.IsDead)
				{
					if (pics.IsDying)
					{
						int pic = pics.OldPics[0];
						if (pic == 0)
						{
							continue;
						}
						if (pics.IsTransparent)
						{
							DrawBTPic(
								&gGraphicsDevice,
								PicManagerGetFromOld(&gPicManager, pic),
								Vec2iAdd(picPos, pics.Pics[0].offset),
								pics.Tint);
						}
						else
						{
							DrawTTPic(
								picPos.x + pics.Pics[0].offset.x,
								picPos.y + pics.Pics[0].offset.y,
								PicManagerGetOldPic(&gPicManager, pic),
								pics.Table);
						}
					}
				}
				else if (pics.IsTransparent)
				{
					for (int i = 0; i < 3; i++)
					{
						Pic *oldPic = PicManagerGetFromOld(
							&gPicManager, pics.OldPics[i]);
						if (oldPic == NULL)
						{
							continue;
						}
						DrawBTPic(
							&gGraphicsDevice,
							oldPic,
							Vec2iAdd(picPos, pics.Pics[i].offset),
							pics.Tint);
					}
				}
				else
				{
					DrawShadow(&gGraphicsDevice, picPos, Vec2iNew(8, 6));
					for (int i = 0; i < 3; i++)
					{
						PicPaletted *oldPic = PicManagerGetOldPic(
							&gPicManager, pics.OldPics[i]);
						if (oldPic == NULL)
						{
							continue;
						}
						BlitOld(
							picPos.x + pics.Pics[i].offset.x,
							picPos.y + pics.Pics[i].offset.y,
							oldPic,
							pics.Table, BLIT_TRANSPARENT);
					}
				}
			}
			else
			{
				(*(t->drawFunc))(picPos, &t->drawData);
			}
		}
		tile += X_TILES - b->Size.x;
	}
}
Ejemplo n.º 9
0
static void DrawActorPics(const TTileItem *t, const Vec2i picPos)
{
    const ActorPics pics = t->getActorPicsFunc(t->id);
    if (pics.IsDead)
    {
        if (pics.IsDying)
        {
            int pic = pics.OldPics[0];
            if (pic == 0)
            {
                return;
            }
            if (pics.IsTransparent)
            {
                DrawBTPic(
                    &gGraphicsDevice,
                    PicManagerGetFromOld(&gPicManager, pic),
                    Vec2iAdd(picPos, pics.Pics[0].offset),
                    pics.Tint);
            }
            else
            {
                DrawTTPic(
                    picPos.x + pics.Pics[0].offset.x,
                    picPos.y + pics.Pics[0].offset.y,
                    PicManagerGetOldPic(&gPicManager, pic),
                    pics.Table);
            }
        }
    }
    else if (pics.IsTransparent)
    {
        for (int i = 0; i < 3; i++)
        {
            Pic *oldPic = PicManagerGetFromOld(
                              &gPicManager, pics.OldPics[i]);
            if (oldPic == NULL)
            {
                continue;
            }
            DrawBTPic(
                &gGraphicsDevice,
                oldPic,
                Vec2iAdd(picPos, pics.Pics[i].offset),
                pics.Tint);
        }
    }
    else
    {
        DrawShadow(&gGraphicsDevice, picPos, Vec2iNew(8, 6));
        for (int i = 0; i < 3; i++)
        {
            PicPaletted *oldPic = PicManagerGetOldPic(
                                      &gPicManager, pics.OldPics[i]);
            if (oldPic == NULL)
            {
                continue;
            }
            BlitOld(
                picPos.x + pics.Pics[i].offset.x,
                picPos.y + pics.Pics[i].offset.y,
                oldPic,
                pics.Table, BLIT_TRANSPARENT);
        }

        const TActor *a = CArrayGet(&gActors, t->id);

        // Draw weapon indicators
        if (ConfigGetEnum(&gConfig, "Game.LaserSight") == LASER_SIGHT_ALL ||
                (ConfigGetEnum(&gConfig, "Game.LaserSight") == LASER_SIGHT_PLAYERS && a->PlayerUID >= 0))
        {
            DrawLaserSight(a, picPos);
        }
    }
}