void DisplayTopBar(int ypos, int ttexcol, int backcol, char *title, char*texx, ...) { strcpy(topBar.text, get_translation(title)); char displbuf[3001]; va_list ap; va_start(ap,texx); my_sprintf(displbuf, get_translation(texx), ap); va_end(ap); if (ypos > 0) play.top_bar_ypos = ypos; if (ttexcol > 0) play.top_bar_textcolor = ttexcol; if (backcol > 0) play.top_bar_backcolor = backcol; topBar.wantIt = 1; topBar.font = FONT_NORMAL; topBar.height = wgetfontheight(topBar.font); topBar.height += multiply_up_coordinate(play.top_bar_borderwidth) * 2 + get_fixed_pixel_size(1); // they want to customize the font if (play.top_bar_font >= 0) topBar.font = play.top_bar_font; // DisplaySpeech normally sets this up, but since we're not going via it... if (play.cant_skip_speech & SKIP_AUTOTIMER) play.messagetime = GetTextDisplayTime(texx); DisplayAtY(play.top_bar_ypos, displbuf); }
Rectf DrawingContext::get_cliprect() const { return Rectf(get_translation().x, get_translation().y, get_translation().x + SCREEN_WIDTH, get_translation().y + SCREEN_HEIGHT); }
void Editor::scroll_up(float speed) { auto camera = currentsector->camera; if (can_scroll_vert()) { if (camera->get_translation().y >= speed*32) { camera->move(0,-32*speed); } else { //When is the camera less than one tile after the top limit, it puts the camera to the limit. camera->move(0, -camera->get_translation().y); } inputcenter.update_pos(); } }
void Editor::scroll_left(float speed) { auto camera = currentsector->camera; if (can_scroll_horz()) { if (camera->get_translation().x >= speed*32) { camera->move(-32 * speed, 0); } else { //When is the camera less than one tile after the left limit, it puts the camera to the limit. camera->move(-camera->get_translation().x, 0); } inputcenter.update_pos(); } }
void Editor::scroll_down(float speed) { auto camera = currentsector->camera; if (can_scroll_vert()) { if (camera->get_translation().y <= currentsector->get_height() - SCREEN_HEIGHT - 32 * speed) { camera->move(0, 32*speed); } else { //When is the camera less than one tile after the bottom limit, it puts the camera to the limit. // The limit is shifted 32 pixels to the bottom due to the layer toolbar. camera->move(0, currentsector->get_height() - camera->get_translation().y - SCREEN_HEIGHT +32); } inputcenter.update_pos(); } }
void Editor::scroll_right(float speed) { auto camera = currentsector->camera; if (can_scroll_horz()) { if (camera->get_translation().x <= currentsector->get_width() - SCREEN_WIDTH + 128 - 32 * speed) { camera->move(32*speed, 0); } else { //When is the camera less than one tile after the right limit, it puts the camera to the limit. // The limit is shifted 128 pixels to the right due to the input gui. camera->move(currentsector->get_width() - camera->get_translation().x - SCREEN_WIDTH +128, 0); } inputcenter.update_pos(); } }
void DisplayAtY (int ypos, char *texx) { if ((ypos < -1) || (ypos >= GetMaxScreenHeight())) quitprintf("!DisplayAtY: invalid Y co-ordinate supplied (used: %d; valid: 0..%d)", ypos, GetMaxScreenHeight()); // Display("") ... a bit of a stupid thing to do, so ignore it if (texx[0] == 0) return; if (ypos > 0) ypos = multiply_up_coordinate(ypos); if (game.options[OPT_ALWAYSSPCH]) DisplaySpeechAt(-1, (ypos > 0) ? divide_down_coordinate(ypos) : ypos, -1, game.playercharacter, texx); else { // Normal "Display" in text box if (screen_is_dirty) { // erase any previous DisplaySpeech play.disabled_user_interface ++; mainloop(); play.disabled_user_interface --; } _display_at(-1,ypos,scrnwid/2+scrnwid/4,get_translation(texx),1,0, 0, 0, false); } }
/* given an interface name, checks the interface to header name translation list for a match. If found, returns the translation, else returns interfacename. added by Dan Larner */ char* interface_header_name(char* pc_interfacename) { static list list_translations = NULL; static int i_list_creation_attempted = 0; char* pc_translated_name ; if (InterfaceHeaderTranslationFile == NULL) return pc_interfacename; /* there is no translations file */ if (list_translations == NULL) { /* first time through (or bad file) */ if (i_list_creation_attempted == 1) return pc_interfacename; /* already tried to create and failed */ list_translations = make_header_translation_list(InterfaceHeaderTranslationFile); i_list_creation_attempted = 1; if (list_translations == NULL) { fprintf (stderr, "Couldn't make translations from file %s - ignoring file", InterfaceHeaderTranslationFile); return pc_interfacename; /* problem making translation list */ } } /* end of creating translation list */ /* return the translation if there is one */ if ((pc_translated_name = get_translation(list_translations, pc_interfacename)) != NULL) return pc_translated_name; return pc_interfacename; }
CL_CollisionOutline CL_CollisionOutline::clone() const { CL_CollisionOutline copy; copy.impl->contours.clear(); copy.impl->contours.reserve(impl->contours.size()); for (size_t i = 0; i < impl->contours.size(); i++) copy.impl->contours.push_back(impl->contours[i].clone()); copy.impl->do_inside_test = get_inside_test(); copy.impl->width = get_width(); copy.impl->height = get_height(); copy.impl->position = get_translation(); copy.impl->scale_factor = get_scale(); copy.impl->angle = get_angle(); copy.impl->minimum_enclosing_disc = get_minimum_enclosing_disc(); bool points, normals, metadata, pendepths; get_collision_info_state(points,normals,metadata,pendepths); copy.enable_collision_info(points,normals,metadata,pendepths); CL_Origin origin; float x, y; get_alignment(origin,x,y); copy.impl->translation_origin = origin; copy.impl->translation_offset.x = x; copy.impl->translation_offset.y = y; get_rotation_hotspot(origin,x,y); copy.impl->rotation_origin = origin; copy.impl->rotation_hotspot.x = x; copy.impl->rotation_hotspot.y = y; return copy; }
/* Return NULL if failed */ VecDBL * sym_get_pure_translation(SPGCONST Cell *cell, const double symprec) { int multi; VecDBL * pure_trans; debug_print("sym_get_pure_translation (tolerance = %f):\n", symprec); multi = 0; pure_trans = NULL; if ((pure_trans = get_translation(identity, cell, symprec, 1)) == NULL) { warning_print("spglib: get_translation failed (line %d, %s).\n", __LINE__, __FILE__); return NULL; } multi = pure_trans->size; if ((cell->size / multi) * multi == cell->size) { debug_print(" sym_get_pure_translation: pure_trans->size = %d\n", multi); } else { ; warning_print("spglib: Finding pure translation failed (line %d, %s).\n", __LINE__, __FILE__); warning_print(" cell->size %d, multi %d\n", cell->size, multi); } return pure_trans; }
void planet_earth::update(const simulation_context *c) { large_rocky_body::update(c); // find the moon if we don't already have it if (!moon) { for (simple_array<node *>::iterator i = get_parent()->get_children().iter(); i.is_valid(); ++i) { if (*i && (*i)->get_name() == L"Moon") { moon = dynamic_cast<large_rocky_body *>(*i); break; } } } // offset the center of the planet to the real position of the earth relative to the earth-moon barysystem // we're one frame off, though, which is unfortunate if (moon) { vector moon_dir = moon->get_translation(); // the moon's position in the frame of the earth-moon barysystem moon_dir.normalize(); get_translation() = moon_dir * -BARYSYSTEM_OFFSET; } } // earth::update()
static int get_space_group_operation( int rot[][3][3], double trans[][3], SPGCONST PointSymmetry *lattice_sym, SPGCONST Cell *cell, const double symprec ) { int i, j, k, num_sym; VecDBL **tmp_trans; num_sym = 0; tmp_trans = (VecDBL**) malloc( sizeof( VecDBL* ) * lattice_sym->size ); #pragma omp parallel for for (i = 0; i < lattice_sym->size; i++) { /* get translation corresponding to a rotation */ tmp_trans[i] = get_translation( lattice_sym->rot[i], cell, symprec, 0 ); } for (i = 0; i < lattice_sym->size; i++) { for (j = 0; j < tmp_trans[i]->size; j++) { for (k = 0; k < 3; k++) { trans[num_sym + j][k] = tmp_trans[i]->vec[j][k]; } mat_copy_matrix_i3(rot[num_sym + j], lattice_sym->rot[i]); } num_sym += tmp_trans[i]->size; mat_free_VecDBL( tmp_trans[i] ); } free( tmp_trans ); tmp_trans = NULL; return num_sym; }
void AnimationNode::set_transform(const D3DXMATRIX& transform) { transform_ = transform; pos_ = get_translation(transform); D3DXQuaternionRotationMatrix(&rot_, &transform); scale_ = get_scale(transform); }
void GetHotspotName(int hotspot, char *buffer) { VALIDATE_STRING(buffer); if ((hotspot < 0) || (hotspot >= MAX_HOTSPOTS)) quit("!GetHotspotName: invalid hotspot number"); strcpy(buffer, get_translation(thisroom.hotspotnames[hotspot])); }
void orbital_frame::update(const simulation_context *c) { if (prop) prop->update(c->julian_cur, get_translation(), get_linear_velocity()); assert(get_angular_velocity().mag() == 0); } // orbital_frame::update()
void Display(char*texx, ...) { char displbuf[STD_BUFFER_SIZE]; va_list ap; va_start(ap,texx); my_sprintf(displbuf, get_translation(texx), ap); va_end(ap); DisplayAtY (-1, displbuf); }
Plane ARVRAnchor::get_plane() const { Vector3 location = get_translation(); Basis orientation = get_transform().basis; Plane plane(location, orientation.get_axis(1).normalized()); return plane; };
void Button_SetText(GUIButton *butt, const char *newtx) { newtx = get_translation(newtx); if (strlen(newtx) > 49) quit("!SetButtonText: text too long, button has 50 chars max"); if (strcmp(butt->text, newtx)) { guis_need_update = 1; strcpy(butt->text,newtx); } }
void SRS::SetAimGoal(const float goal[3], const float ax[3], float flex_angle) { float s[3]; cpvector(ee, goal); cpvector(axis, ax); get_translation(T, p_r1); get_translation(S, s); get_aim_circle_equation(goal, axis, p_r1, s, proj_axis, flex_angle, c, u, v, radius); rotation_principal_axis_to_matrix('y', flex_angle, Ry); vecmult(ee_r1, (float*)s, Ry); vecadd(ee_r1, ee_r1, (float*)p_r1); }
// // Constructor stores the T and S matrices and the // lengths of the upper and lower links // void SRS::init(const Matrix T1, const Matrix T2, const float a[3], const float p[3]) { cpmatrix(T, T1); cpmatrix(S, T2); cpvector(proj_axis, a); cpvector(pos_axis, p); float t[3]; get_translation(T, t); upper_len = norm(t); reciprocal_upper_len = 1.0f / upper_len; get_translation(S, t); lower_len = norm(t); project_to_workspace = 1; }
int SRS::SetGoalPos(const float eee[3], const Matrix E, float &rangle) { Matrix Temp, RY; float s[3]; // Find RY, and store the positions of the R jt and // the ee in the R1 frame as p_r1 and ee_r1 get_translation(T, p_r1); hmatmult(Temp,(float (*)[4]) E,S); get_translation(Temp, s); cpvector(ee,eee); if (project_to_workspace) scale_goal(p_r1,s,ee); // // Note instead of using the length of the lower limb // we use the length of the lower limb extended by E // radius = get_circle_equation(ee, proj_axis, pos_axis, upper_len, norm(s), c, u, v, n); if (!solve_R_angle(ee, s, p_r1, T, r_angle)) return 0; rangle = r_angle; // Find RY, and store the positions of the R jt and // the ee in the R1 frame as p_r1 and ee_r1 rotation_principal_axis_to_matrix('y', r_angle, RY); hmatmult(Temp, Temp, RY); hmatmult(Temp, Temp, T); get_translation(Temp, ee_r1); return 1; }
// // Given the goal matrix and the projection axis, find the position // of the end effector and the equation of the circle that defines // how the R joint can swivel. // // Also compute the matrix S*RY*T and save it for future computations // int SRS::SetGoal(const Matrix GG, float &rangle) { Matrix RY; float s[3]; cpmatrix(G, GG); get_translation(G, ee); get_translation(T, p_r1); get_translation(S, s); if (project_to_workspace && scale_goal(p_r1,s,ee)) set_translation(G,ee); EvaluateCircle(ee); //radius = get_circle_equation(ee, proj_axis, pos_axis, // upper_len, lower_len, c, u, v, n); // // Build rotation matrix about the R joint // if (!solve_R_angle(ee, s, p_r1, T, r_angle)) return 0; r_angle=-r_angle; rangle = r_angle; // Find RY, and store the positions of the R jt and // the ee in the R1 frame as p_r1 and ee_r1 // Also save matrix product S*RY*T rotation_principal_axis_to_matrix('y',-r_angle, RY); hmatmult(SRT, S, RY); hmatmult(SRT, SRT, T); get_translation(SRT, ee_r1); #ifdef SRSDEBUG printf("EE distance error is %lf\n", norm(ee_r1) - norm(ee)); #endif return 1; }
/* *** SCRIPT SYMBOL: [String] String::Format^101 *** */ static const char* String_Format(const char *texx, ...) { char displbuf[STD_BUFFER_SIZE]; va_list ap; va_start(ap,texx); my_sprintf(displbuf, get_translation(texx), ap); va_end(ap); return CreateNewScriptString(displbuf); }
int sym_get_multiplicity(SPGCONST Cell *cell, const double symprec) { int multi; VecDBL * trans; trans = get_translation(identity, cell, symprec, 1); multi = trans->size; mat_free_VecDBL(trans); return multi; }
/* *** SCRIPT SYMBOL: [String] StrFormat *** */ static void _sc_sprintf(char*destt,char*texx, ...) { char displbuf[STD_BUFFER_SIZE]; VALIDATE_STRING(destt); check_strlen(destt); va_list ap; va_start(ap,texx); my_sprintf(displbuf, get_translation(texx), ap); va_end(ap); my_strncpy(destt, displbuf, MAXSTRLEN - 1); }
inline void rebuild() { glm::mat4 matrix; matrix = glm::translate(get_translation()); matrix *= glm::mat4(glm::mat3_cast( get_rotation())); matrix = glm::scale(matrix, get_scale()); m_matrix = glm::mat4x3(matrix); }
void DisplayAt(int xxp,int yyp,int widd,char*texx, ...) { char displbuf[STD_BUFFER_SIZE]; va_list ap; va_start(ap,texx); my_sprintf(displbuf, get_translation(texx), ap); va_end(ap); multiply_up_coordinates(&xxp, &yyp); widd = multiply_up_coordinate(widd); if (widd<1) widd=scrnwid/2; if (xxp<0) xxp=scrnwid/2-widd/2; _display_at(xxp,yyp,widd,displbuf,1,0, 0, 0, false); }
/** @brief translate the port and address of the exiting connect syscall * * We take the arguments in the registers, which correspond to the real * local address and port we established the connection on. We translate * them into global simulated ones and put the result back in the registers, * so that the application gets wronged. */ void sys_translate_connect_out(process_descriptor_t * proc, syscall_arg_u * sysarg) { connect_arg_t arg = &(sysarg->connect); pid_t pid = proc->pid; reg_s reg; ptrace_get_register(pid, ®); translate_desc_t *td = get_translation(ntohs(arg->sai.sin_port)); arg->sai.sin_port = htons(td->port_num); arg->sai.sin_addr.s_addr = td->ip; XBT_DEBUG("Restore %s:%d", inet_ntoa(arg->sai.sin_addr), td->port_num); ptrace_poke(pid, (void *) reg.arg2, &(arg->sai), sizeof(struct sockaddr_in)); }
/** @brief translate the port and address of the exiting recvfrom syscall * * We take the arguments in the registers, which correspond to the real * local address and port we received the message from. We translate them * into global simulated ones and put the result back in the registers, so * that the application gets wronged. */ void sys_translate_recvfrom_out(process_descriptor_t * proc, syscall_arg_u * sysarg) { recvfrom_arg_t arg = &(sysarg->recvfrom); pid_t pid = proc->pid; reg_s reg; ptrace_get_register(pid, ®); if (reg.arg5 == 0) return; translate_desc_t *td = get_translation(ntohs(arg->sai.sin_port)); arg->sai.sin_port = htons(td->port_num); arg->sai.sin_addr.s_addr = td->ip; ptrace_poke(pid, (void *) reg.arg5, &(arg->sai), sizeof(struct sockaddr_in)); }
// [DEPRECATED] but still used by Character_SayBackground, might merge since there are no other instances int DisplaySpeechBackground(int charid, const char*speel) { // remove any previous background speech for this character int cc; for (cc = 0; cc < numscreenover; cc++) { if (screenover[cc].bgSpeechForChar == charid) { remove_screen_overlay_index(cc); cc--; } } int ovrl=CreateTextOverlay(OVR_AUTOPLACE,charid,play.viewport.GetWidth()/2,FONT_SPEECH, -game.chars[charid].talkcolor, get_translation(speel)); int scid = find_overlay_of_type(ovrl); screenover[scid].bgSpeechForChar = charid; screenover[scid].timeout = GetTextDisplayTime(speel, 1); return ovrl; }