void CLightDlg::UpdateDialog(bool updateChecks)
{
	CString title;

	lightInfo.Defaults();
	lightInfoOriginal.Defaults();

	if (com_editorActive) {
		// used from Radiant
		entity_t *e = SingleLightSelected();

		if (e) {
			lightInfo.FromDict(&e->epairs);
			lightInfoOriginal.FromDict(&e->epairs); //our original copy of the values that we compare against for apply differences
			title = "Light Editor";
		} else {
			//find the last brush belonging to the last entity selected and use that as the source
			e = NULL;

			for (brush_t *b = selected_brushes.next ; b != &selected_brushes ; b = b->next) {
				if ((b->owner->eclass->nShowFlags & ECLASS_LIGHT) && !b->entityModel) {
					e = b->owner;
					break;
				}
			}

			if (e) {
				lightInfo.FromDict(&e->epairs);
				lightInfoOriginal.FromDict(&e->epairs); //our original copy of the values that we compaer against for apply differences
				title = "Light Editor - (Multiple lights selected)";
			} else {
				title = "Light Editor - (No lights selected)";
			}
		}
	} else {
		// used in-game
		idList<idEntity *> list;

		list.SetNum(128);
		int count = gameEdit->GetSelectedEntities(list.Ptr(), list.Num());
		list.SetNum(count);

		if (count > 0) {
			lightInfo.FromDict(gameEdit->EntityGetSpawnArgs(list[count-1]));
			title = "Light Editor";
		} else {
			title = "Light Editor - (No entities selected)";
		}
	}

	SetWindowText(title);

	UpdateDialogFromLightInfo();
	ColorButtons();

	if (updateChecks) {
		EnableControls();
	}
}
Exemple #2
0
void CLightDlg::UpdateColor( float r, float g, float b, float a ) {
	color[0] = a * r;
	color[1] = a * g;
	color[2] = a * b;
	ColorButtons();
	UpdateLightInfoFromDialog();
	SaveLightInfo( NULL );
	Sys_UpdateWindows( W_CAMERA );
}
Exemple #3
0
void CLightDlg::OnBtnColor() {
	int r, g, b;
	float ob;
	r = color[0];
	g = color[1];
	b = color[2];
	if ( DoNewColor( &r, &g, &b, &ob, UpdateLightDialog ) ) {
		color[0] = ob * r;
		color[1] = ob * g;
		color[2] = ob * b;
		ColorButtons();
	}
}